From patchwork Tue Jan 2 16:04:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 759368 Delivered-To: patch@linaro.org Received: by 2002:a5d:67c6:0:b0:336:6142:bf13 with SMTP id n6csp6113131wrw; Tue, 2 Jan 2024 08:06:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IHFkJ1cshHpWFEXCn1oCmpyBsqhEH3l7FUlimIOvUz4k+PNuEIE4IASW0hkqbuP+Oh9TAti X-Received: by 2002:a05:620a:11a4:b0:781:2b9e:eda8 with SMTP id c4-20020a05620a11a400b007812b9eeda8mr25012947qkk.1.1704211589084; Tue, 02 Jan 2024 08:06:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704211589; cv=none; d=google.com; s=arc-20160816; b=Ln/2a3AAcunTSA3FnEAPi5Rv0g0fgzFbLbgPmbn/DZYaB1vPkWvEJpyrBc+SOJJUVI 8KX2vgVGC9Eua5dDJLk4CshYbejYuslthJbh9mUHzn6OYSMFCMZ95a3OkbTVMVHlKVPk HEJ0axF3NIMcEYd29jJx85nJnAgtYTb7UnEGMhgYOFMhQgijTfa10T6har94F/4EbeLM gcd4StHbWlKGsO+lCNpRvbSB6TXh7CeT+VB0FsqDt8Cobf0xQ0CicnkBfNoxEm0E/xaK NuVJheYNx9h1h3XCi78JioFZX7JLkraRyH8HCjHLavWhKqY/RpqyeZsko/wlbFinIxbI 7BRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TVl3cttQKDPPU7GqDBLczNEA1v4uR7uW39llQJlVRbI=; fh=Fbl4rt7vNadFyu+mhE5sPZ2m5GJmVL0UTbP+h3uuTlY=; b=auxpIklJsZWQlUJu60Fv/WY3PHUuUXfnwpdnjR6BRDp5A1V0MacpdC5WeEPKQGgDEa n/VCwl1lzr1+bM+7qjoedROzdiDb9wDnaxTD4fuPVnGUZJGfzJKauu7/fg7yGbADtjtY otH0X4rFgXSh6y2BkFp4mTzbvO3lnCWeL0PmipuOmptviiVM5I/u2RAKMMm23LKU/y5R rabum/IntotelKYuGdRCAGiFvApxSOulhYt4vJD9Nxkmp+1e5sCwF+lcSJSvU+OQr3Gz B1LL+BL2EZC1e1L66N7Xpc39+fzuaCKI7Cl8wlA638Iq1wxR4nSyfqEktadxLyJF/y5M bzfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CLftFzGq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u18-20020a05620a431200b00781bea73c70si5168076qko.669.2024.01.02.08.06.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Jan 2024 08:06:29 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CLftFzGq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rKhGh-0006Hs-P3; Tue, 02 Jan 2024 11:05:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rKhGQ-0006Dn-J9 for qemu-devel@nongnu.org; Tue, 02 Jan 2024 11:05:12 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rKhGN-0002bo-1p for qemu-devel@nongnu.org; Tue, 02 Jan 2024 11:05:09 -0500 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-40d2e56f3a6so54593985e9.1 for ; Tue, 02 Jan 2024 08:05:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704211504; x=1704816304; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TVl3cttQKDPPU7GqDBLczNEA1v4uR7uW39llQJlVRbI=; b=CLftFzGqukIDPysFORoEwcodOyqQQn9lZIVx9iNBxx3upXjybY0KP+wKv0KfLAWI3f v4lI3/UqSuV2N+DeZ6UNcAz7rbJRyI0rMf5Lf5FburOMKHHR4c3w/kbAboRh7hMaXfMd mMcjG0xI1O86vX1DmItVdP5YyhJNm1pxDXzs7NI7v2yM6zeQJmlwqRU6CDqxtaxABDFt daLtTdvRDrjRknzVmr1yRSpg1WfrRfmALKidL2FzLq9y/ZawuwySOA0peBRaqh7iqfm1 2ECxgPxtEzjAhL6CeYcirmoTz1tNYIb80+2wCKVbr216uVPPJ+XHPPAF09byCxiGqPvO 0t4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704211504; x=1704816304; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TVl3cttQKDPPU7GqDBLczNEA1v4uR7uW39llQJlVRbI=; b=TaQHTmoJU4s+GFEdfNHQnAjunMfwK8Wukrln6m8F3/GEQeJd946d0BtmErTbA8hgIL PmVxyuybyn1rFunGBjafV08Vqj9hS3C3UFBGmm5ZHvtoYyPmgcxxZ4Gf0yrfICQkl8ra Tj3X0i6gk6RJepeztwNLtGT7Zad5F0Iws1AA+TZlDwsmA+VBotYhuG7z68EkHxtpaRsR hTGkw6+poL7ER1pcQdl/HRI7QG8Tex0ryoqC1+lop0+mO7mBCbc2/Bcmya3aqQZdwuZR xXSfB7CCr6OE9Mc+nqUIjUQRIH8utL/NUjwMk9bKL2FU2HqZje6xNjrTAJfi6L3siq6r d/EA== X-Gm-Message-State: AOJu0YwUgPE43rT3zS9WhMmKoVWoMQAi7tY0yH1biBG7VCzyIMdm5Cpm 5hRY24uCS+BmTrTmp5VK7Y7vyDj9/toS0kKkRSryPxIPfAQ= X-Received: by 2002:a05:600c:4713:b0:40d:734e:665d with SMTP id v19-20020a05600c471300b0040d734e665dmr3139136wmo.41.1704211504678; Tue, 02 Jan 2024 08:05:04 -0800 (PST) Received: from m1x-phil.lan (sal63-h02-176-184-16-71.dsl.sta.abo.bbox.fr. [176.184.16.71]) by smtp.gmail.com with ESMTPSA id j16-20020a05600c191000b0040c11fbe581sm45314295wmq.27.2024.01.02.08.05.03 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 02 Jan 2024 08:05:04 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Eric Blake , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , qemu-arm@nongnu.org, Luc Michel , =?utf-8?q?Alex_Benn?= =?utf-8?q?=C3=A9e?= , Mark Cave-Ayland , Eduardo Habkost , Frederic Konrad , Markus Armbruster , Paolo Bonzini , Kevin Wolf , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH 1/5] qdev-properties: Add qdev_property_del_static() Date: Tue, 2 Jan 2024 17:04:50 +0100 Message-ID: <20240102160455.68612-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240102160455.68612-1-philmd@linaro.org> References: <20240102160455.68612-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We can add properties with qdev_property_add_static(). Add qdev_property_del_static() to delete them. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/qdev-properties.h | 2 ++ hw/core/qdev-properties.c | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 09aa04ca1e..0e1930177e 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -225,6 +225,8 @@ void error_set_from_qdev_prop_error(Error **errp, int ret, Object *obj, */ void qdev_property_add_static(DeviceState *dev, Property *prop); +void qdev_property_del_static(DeviceState *dev, Property *prop); + /** * qdev_alias_all_properties: Create aliases on source for all target properties * @target: Device which has properties to be aliased diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 7d6fa726fd..0c17a5de82 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -994,6 +994,13 @@ void qdev_property_add_static(DeviceState *dev, Property *prop) } } +void qdev_property_del_static(DeviceState *dev, Property *prop) +{ + Object *obj = OBJECT(dev); + + object_property_del(obj, prop->name); +} + static void qdev_class_add_property(DeviceClass *klass, const char *name, Property *prop) { From patchwork Tue Jan 2 16:04:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 759371 Delivered-To: patch@linaro.org Received: by 2002:a5d:67c6:0:b0:336:6142:bf13 with SMTP id n6csp6113612wrw; Tue, 2 Jan 2024 08:07:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IFyt0dMTopjdCbOtqMmNJrIJUMu72bJ2oiI3PlTMU6LGTf9qnIGLuO23tKTeBBrpxZ6Eqkt X-Received: by 2002:ac8:774f:0:b0:428:23f2:401d with SMTP id g15-20020ac8774f000000b0042823f2401dmr3159459qtu.60.1704211638846; Tue, 02 Jan 2024 08:07:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704211638; cv=none; d=google.com; s=arc-20160816; b=AuRNZ9gEBeI6yP/uFlPqvGUf8zwjrzYcWZ5BbGaSNXWYpxm9/RO6Cs+64qnaB7fncz SesDlQk+T3URS3kMDYCI25qXTX9oyWQU1uud6+HTUUnCYx7FWavDAtFQ2C4efnq8BvzI 24idOrWoWNAoEPcZTRtmNVMJFSY/gwotnR6SAi60NTTotbpfur/K7xvS75HTTaX/Xdgl EJuVt6Wzb+tHM390HRffKcGPwvd1FCrTL2tcgNRRtXGhrQZ8PR6aLexn3veBVI1bI5YR gTPlP9VKVyoMDpb5TZyUZH3VzDWO1uMGL5PVj6FH59wC9rMkATAufo3k0fI2py1FZqgb AWqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ufonMTH/Sl8kmFdoBgYSf3okj9N+8Wa+NSxI0KCId+c=; fh=Fbl4rt7vNadFyu+mhE5sPZ2m5GJmVL0UTbP+h3uuTlY=; b=Tb/ZSruLlfGvBHlMN2uj4Iboyr3Hzc+Q2r1UPWViCAGr5wcs4yRInbhWy2anESoI8H 0bcOFnCEp2SVElrdmWTssLqk0lmKdisQBIPKPrmfI/mHhqmxIbUzIgTSrQk9v9IIL11y ucAd5IL8P+r7F44i2D06MDLtqW9e7xq12stV37AIiJ1Xcy49xY5e4QQYVOEoFYwKV3cX sQwGpw3En4u/cDa7ppv6Kh9qzhZhT/kaBwUYvrUyzNATsADHyhUgDa8Gur6gRtOI0E0q +rqPbC3WjKOFnCBEwR+rIyTPIn+ZK3aXYOSuV9YBKWnwPQoQjdk5uCI6U7PKFvkZT/6o l/1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D1llJWyG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id cc5-20020a05622a410500b0042588d183b4si27112269qtb.753.2024.01.02.08.07.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Jan 2024 08:07:18 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D1llJWyG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rKhGj-0006K2-Qz; Tue, 02 Jan 2024 11:05:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rKhGY-0006Gg-1g for qemu-devel@nongnu.org; Tue, 02 Jan 2024 11:05:18 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rKhGS-0002cW-Th for qemu-devel@nongnu.org; Tue, 02 Jan 2024 11:05:17 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-40d5b89e2bfso56729165e9.0 for ; Tue, 02 Jan 2024 08:05:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704211511; x=1704816311; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ufonMTH/Sl8kmFdoBgYSf3okj9N+8Wa+NSxI0KCId+c=; b=D1llJWyGhZgFxn3O2fUJEH05tVzdAkpeFyOfCxiUWfIyhoaJ6XD+ovIJKi+cSAc/na oCEwjCsJjOVzfue1dERqMHkBmP0ZeU47qtZf40eJb8ChQxGqpp0614Zd1NuuiPNhh+dL XGPvzbiCu9G/Dsopzsm+e85Es7B0fCJh2zAc1JOBxxIHZVqin1YtoulBbVUlvzEbu3Mv 3vAif3PBo/OjNhH0Gs1g3gaX6bol55Z45uuNAspe6Br2h+pbCqQymOrzfr1Wk6Ka/lWY t/kXvLBIE0j9CdTiHEAaPmizxBFphCdTubarCDlYhAZMjbWnnw6rM8EpMDMMmMQrxOkq LMQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704211511; x=1704816311; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ufonMTH/Sl8kmFdoBgYSf3okj9N+8Wa+NSxI0KCId+c=; b=rwbyIZUQEYBHh43jeEMoQSzKv5NqVKYemgtvDObc1eU3ekjkj+yO7EhxMnCFsWu0en NborIQSxVgivfwA/PdaPjTlGd5Sa4SgAnhD+M11lPo9MH41y+5mt58wHzwpmljrS3i67 Qw4WhUdo3zJydDUpyPew0EfmnWpOA15WYUWS5GZk+BX9prJy5GGTVlnsKXEbuDFs2rhY r1ruZ71ayVeZudwo/1+Qr9xZmejr1GTlqrNp3uqPkjE3pZbv0MAkrugapzRWONmhZB4M uVk1Aiz4VuyE8SsFeNSlXubttr7WWRZZVjUhHEOWU8bKEObjM/fS7CudvHSSIvEiw4hp LoyQ== X-Gm-Message-State: AOJu0Yyzgv7CSkv/+2fbZ5pjA6J7LeBvgG/LXD6ij8Zm/BR8C/prySQ7 +qKYrsII4rK17R7FH53BTlaHZPnsOPc2TEvJVX33YGoOHXQ= X-Received: by 2002:a05:600c:520c:b0:40d:8a04:a134 with SMTP id fb12-20020a05600c520c00b0040d8a04a134mr934490wmb.79.1704211511039; Tue, 02 Jan 2024 08:05:11 -0800 (PST) Received: from m1x-phil.lan (sal63-h02-176-184-16-71.dsl.sta.abo.bbox.fr. [176.184.16.71]) by smtp.gmail.com with ESMTPSA id bg29-20020a05600c3c9d00b0040d6d755c90sm19136952wmb.42.2024.01.02.08.05.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 02 Jan 2024 08:05:10 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Eric Blake , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , qemu-arm@nongnu.org, Luc Michel , =?utf-8?q?Alex_Benn?= =?utf-8?q?=C3=A9e?= , Mark Cave-Ayland , Eduardo Habkost , Frederic Konrad , Markus Armbruster , Paolo Bonzini , Kevin Wolf , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH 2/5] qdev-properties: Add OptionalBool QAPI type Date: Tue, 2 Jan 2024 17:04:51 +0100 Message-ID: <20240102160455.68612-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240102160455.68612-1-philmd@linaro.org> References: <20240102160455.68612-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org To be able to distinct whether a boolean qdev property has been set or not, add the DEFINE_PROP_BOOL_NODEFAULT() qdev macro based on the tri-state OptionalBool QAPI type. Signed-off-by: Philippe Mathieu-Daudé --- qapi/common.json | 16 ++++++++++++++++ include/hw/qdev-properties.h | 5 +++++ hw/core/qdev-properties.c | 10 ++++++++++ 3 files changed, 31 insertions(+) diff --git a/qapi/common.json b/qapi/common.json index 6fed9cde1a..884c143e2a 100644 --- a/qapi/common.json +++ b/qapi/common.json @@ -207,3 +207,19 @@ ## { 'struct': 'HumanReadableText', 'data': { 'human-readable-text': 'str' } } + +## +# @OptionalBool: +# +# An enumeration of three options: true, false, and unset +# +# @unset: Unset (default) +# +# @false: False +# +# @true: True +# +# Since: 9.0 +## +{ 'enum': 'OptionalBool', + 'data': [ 'false', 'true', 'unset' ] } diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 0e1930177e..8cf95da2c3 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -49,6 +49,7 @@ struct PropertyInfo { extern const PropertyInfo qdev_prop_bit; extern const PropertyInfo qdev_prop_bit64; extern const PropertyInfo qdev_prop_bool; +extern const PropertyInfo qdev_prop_bool_unset; extern const PropertyInfo qdev_prop_enum; extern const PropertyInfo qdev_prop_uint8; extern const PropertyInfo qdev_prop_uint16; @@ -105,6 +106,10 @@ extern const PropertyInfo qdev_prop_link; .set_default = true, \ .defval.u = (bool)_defval) +#define DEFINE_PROP_BOOL_NODEFAULT(_name, _state, _field) \ + DEFINE_PROP_SIGNED(_name, _state, _field, OPTIONAL_BOOL_UNSET, \ + qdev_prop_bool_unset, OptionalBool) + /** * The DEFINE_PROP_UINT64_CHECKMASK macro checks a user-supplied value * against corresponding bitmask, rejects the value if it violates. diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 0c17a5de82..1bec8ee679 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -260,6 +260,16 @@ const PropertyInfo qdev_prop_bool = { .set_default_value = set_default_value_bool, }; +/* --- optional bool --- */ + +const PropertyInfo qdev_prop_bool_unset = { + .name = "OptionalBool", + .enum_table = &OptionalBool_lookup, + .get = qdev_propinfo_get_enum, + .set = qdev_propinfo_set_enum, + .set_default_value = qdev_propinfo_set_default_value_enum, +}; + /* --- 8bit integer --- */ static void get_uint8(Object *obj, Visitor *v, const char *name, void *opaque, From patchwork Tue Jan 2 16:04:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 759370 Delivered-To: patch@linaro.org Received: by 2002:a5d:67c6:0:b0:336:6142:bf13 with SMTP id n6csp6113600wrw; Tue, 2 Jan 2024 08:07:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IHAhYBSRUK4d9hqXrzttKnJZYDBcXuULMdREqC6hSwmQkyV3HAWQ9cRYqewEXmCQHVEQVNG X-Received: by 2002:a05:622a:1715:b0:427:7e53:15ec with SMTP id h21-20020a05622a171500b004277e5315ecmr25832202qtk.64.1704211637284; Tue, 02 Jan 2024 08:07:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704211637; cv=none; d=google.com; s=arc-20160816; b=v8qETVEoowrtnqTyTwJ+/GUbV7Qi4ntj6Nyqma35TZ2KhqIioH8O2h4U3AhgAUzhzx dRHSb7qefUJ+H/uOi5FnvflbCs0BQzY9Fw8Ye08TmFHTrPAggxjeblnHNSXJ8Q7FJmpj zLm3rPoJfRM80HyTOm7XIRIElfLCgRzZaaSMsU/MFMEib1OOl5CL4agLk/c4+YXRUOpA SJN2pKcRauDGCzFyiuqKmWuDqUjJvW8+IKDIgYm8V55nmIL/m5hPpgarlR8SE10uiDp8 ZgymTkZxzJ4ALqLXVsObhGL5xdV76M8eou6BIcjJb6JqaGq2Qk/TuD0tVI7OeQnYSCRA 0XAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=J38P+ankfUbUztT5GJCTo6FfwFdn7YoTpHgRI5fDY8Q=; fh=Fbl4rt7vNadFyu+mhE5sPZ2m5GJmVL0UTbP+h3uuTlY=; b=RnTLzYHQJgiGUxrXdP6hrpEpdJC2BGa2s40OGWYP0Sofqk5c9sLszT55IibDEQT161 g3ujnvWnYILhHgN3xsJsJL0dTQyvRgiLj4NUTavgAQzqSdnoQKmHdbqpdnr+aeLt+gbA FsTbVbcaHweJ+btu8lEGI/vPGpMEoLfsEV4qGgQgbPYog7vub7wO8DglEA9fPwanZtay J0fMDBGFb32YcNTi0qKyv3gD0fn1CKt9BAzeMID+MhMoFpZzlgh7TbyxN9OU8BmuZyxG SmvJ/MKpPQQhtL7K7LFsuR3iQP3GdgqpF+oC35YUtsxvEb0w29uFaQewNfgvKSIxS6U0 nZTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Kh0/g3pW"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u11-20020a05622a010b00b0042830650bafsi1282436qtw.67.2024.01.02.08.07.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Jan 2024 08:07:17 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Kh0/g3pW"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rKhGn-0006NG-Fv; Tue, 02 Jan 2024 11:05:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rKhGc-0006HB-GJ for qemu-devel@nongnu.org; Tue, 02 Jan 2024 11:05:24 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rKhGa-0002dS-4T for qemu-devel@nongnu.org; Tue, 02 Jan 2024 11:05:22 -0500 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-3367632ce7bso8283814f8f.2 for ; Tue, 02 Jan 2024 08:05:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704211518; x=1704816318; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=J38P+ankfUbUztT5GJCTo6FfwFdn7YoTpHgRI5fDY8Q=; b=Kh0/g3pWmtcjNrg2GA+ugfeewPTLorGSMcQtucfc0dK86ejPhvL8cAAgZTqvDKUVl5 p/uXgdMDSrEY85KGPdwoQECS0/qG98VIrE9x3kObWu29mSleCdUOM7+8AvapXPT9xeVn kjPLi5E1zm3CsFxYozi4kK73PGXvBbNoKEOZB/fECvArh7KciYy4UAAJnhPE04OOKWE+ CdZfJPy7CcHp8L3cElNUFwRXf1E6gN9CzFbvlGlY2xIQUYpY1xDPBQEPVjIhb1y4ce5t 96ji0Ip9YsSR/G83ZJ/Q/3JAQi6nMBjZ5Xsz88GGnevAgGt+DVxOPKChrE5olH198mga 0FYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704211518; x=1704816318; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=J38P+ankfUbUztT5GJCTo6FfwFdn7YoTpHgRI5fDY8Q=; b=GYg6uweQpgAc7/UUjly63AX3TiBtBl12dnvM1fvP/cFES/NsJZQ1dRRCstdoJoTn6N JtyLhecOKSqhqMToa+QKmxB58friS9a5LG9Om1bvFi4FC7K4f4A9qwXkxNryTWf1Zh83 qKW9F3rQoFg7HA499JgFJHC7YgAWhVNq84kORN3/Uhk0/aeBh1v8MOCUwZNn/UyhavsA 2QgqYS1Nql9fGReS/wh2YqjsR6Bk2HpCmD8KwfBwPZfMAwnHuLRMVQ+8pcqbKoaXoTA1 Pl4eoauRFL5cKCz+PjznS1ZMEXMGDhvmMgQHnKOYm0bztM+zGz+d/ggGv7aCG4SBiAAK 46Cg== X-Gm-Message-State: AOJu0Yxg18DrG8SeZ+wlG/wH+twAr9YsvhT+quUfnfTsIeGmFB4s7akA c2FYIoX7pBOTuzvkE5SH/nMhN+PsPI6gGDkBlSG8W4mq9qg= X-Received: by 2002:adf:ec82:0:b0:337:37c2:fc57 with SMTP id z2-20020adfec82000000b0033737c2fc57mr2610183wrn.106.1704211518286; Tue, 02 Jan 2024 08:05:18 -0800 (PST) Received: from m1x-phil.lan (sal63-h02-176-184-16-71.dsl.sta.abo.bbox.fr. [176.184.16.71]) by smtp.gmail.com with ESMTPSA id b16-20020a056000055000b003372dcd739csm9582956wrf.86.2024.01.02.08.05.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 02 Jan 2024 08:05:17 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Eric Blake , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , qemu-arm@nongnu.org, Luc Michel , =?utf-8?q?Alex_Benn?= =?utf-8?q?=C3=A9e?= , Mark Cave-Ayland , Eduardo Habkost , Frederic Konrad , Markus Armbruster , Paolo Bonzini , Kevin Wolf , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH 3/5] hw/arm/armv7m: Convert ARMv7MState::vfp from bool to OptionalBool Date: Tue, 2 Jan 2024 17:04:52 +0100 Message-ID: <20240102160455.68612-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240102160455.68612-1-philmd@linaro.org> References: <20240102160455.68612-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=philmd@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We want to know if the 'vfp' property has been initialized. Convert it from boolean to OptionalBool (which contain the 'unset' enum). Note the monitor output is changed as: (qemu) info qtree ... dev: armv7m, id "" gpio-in "NMI" 1 gpio-out "SYSRESETREQ" 1 gpio-in "" 96 clock-in "cpuclk" freq_hz=40 MHz clock-in "refclk" freq_hz=0 Hz cpu-type = "cortex-m33-arm-cpu" init-svtor = 270532608 (0x10200000) init-nsvtor = 0 (0x0) enable-bitband = false start-powered-off = false - vfp = false + vfp = "false" dsp = false mpu-ns-regions = 8 (0x8) mpu-s-regions = 8 (0x8) Signed-off-by: Philippe Mathieu-Daudé --- include/hw/arm/armv7m.h | 2 +- hw/arm/armsse.c | 2 +- hw/arm/armv7m.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/hw/arm/armv7m.h b/include/hw/arm/armv7m.h index e2cebbd15c..6c9e65b644 100644 --- a/include/hw/arm/armv7m.h +++ b/include/hw/arm/armv7m.h @@ -105,7 +105,7 @@ struct ARMv7MState { uint32_t mpu_s_regions; bool enable_bitband; bool start_powered_off; - bool vfp; + OptionalBool vfp; bool dsp; }; diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c index 31acbf7347..472b16fc30 100644 --- a/hw/arm/armsse.c +++ b/hw/arm/armsse.c @@ -1028,7 +1028,7 @@ static void armsse_realize(DeviceState *dev, Error **errp) } } if (!s->cpu_fpu[i]) { - if (!object_property_set_bool(cpuobj, "vfp", false, errp)) { + if (!object_property_set_str(cpuobj, "vfp", "false", errp)) { return; } } diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c index d10abb36a8..3610f6f4a1 100644 --- a/hw/arm/armv7m.c +++ b/hw/arm/armv7m.c @@ -548,7 +548,7 @@ static Property armv7m_properties[] = { DEFINE_PROP_BOOL("enable-bitband", ARMv7MState, enable_bitband, false), DEFINE_PROP_BOOL("start-powered-off", ARMv7MState, start_powered_off, false), - DEFINE_PROP_BOOL("vfp", ARMv7MState, vfp, true), + DEFINE_PROP_BOOL_NODEFAULT("vfp", ARMv7MState, vfp), DEFINE_PROP_BOOL("dsp", ARMv7MState, dsp, true), DEFINE_PROP_UINT32("mpu-ns-regions", ARMv7MState, mpu_ns_regions, UINT_MAX), DEFINE_PROP_UINT32("mpu-s-regions", ARMv7MState, mpu_s_regions, UINT_MAX), From patchwork Tue Jan 2 16:04:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 759366 Delivered-To: patch@linaro.org Received: by 2002:a5d:67c6:0:b0:336:6142:bf13 with SMTP id n6csp6112930wrw; Tue, 2 Jan 2024 08:06:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IFQYPsahLO4+G8jauptKddf033E+qFTAMmw8EB3sINobMMzP0TfjNQ86GFVmTGYMporz8eN X-Received: by 2002:a05:622a:48b:b0:423:8b9f:3a03 with SMTP id p11-20020a05622a048b00b004238b9f3a03mr24220964qtx.26.1704211568966; Tue, 02 Jan 2024 08:06:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704211568; cv=none; d=google.com; s=arc-20160816; b=wAE5RWgJUpF8R6WYHTwFYwaYXh7Mdwq9oDY2VyCJxYCYwcFS43z1KFntnwoOdKJNAo VmH/xC6/HpoZZCpk6TGwU3h/DSAZvYZh/uVuKXNRYD6B9QBW5moGSvlR9UzRWUWej0vF WmnUd6BXQvJ8rU5yw5J/9wsEFcyv43xG5xUm7J+DQo51catsLBd5eWsd7coPOInpGHCH 0O999mMiWbRFoEj1TEnb1XYIgoXqrFOI34K0iprIypKZJDFXGYkydj6KWfzsmw62/BVv 5jyOe8Cto4Uk2X21mqYVCWKlX8Q+QkwxNLGGQHWmuZ0EU+gElwxfwizTU2zk7rflEU0H i1EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6BwjC+ujFoVcnh1DxjxgU1C6te3MWe6aqORUUnNaIGM=; fh=Fbl4rt7vNadFyu+mhE5sPZ2m5GJmVL0UTbP+h3uuTlY=; b=hwiQlpFR58UOF1iRKYhvGxXN8uEYermIZ6SYvO3Qoov8LE9rrgGFkGmhTOSD5WbL0o 7VXH19ugP071mW+OoTv3vvg841mprp6o5ydN503i+l+Mo8t0UHGSPAutyjFgiEYzV+1g bYqj9e9WjL4iX/Pw1XyA4CE11/e2pUT5zby+qQcxx6pBdIdM9CCSzi6AsI7Er79FYCnp 5BHy0s3Duniwrxv58HKNixqUuEHdGdJXlZc924jhR8b6N4w5Q2yNBO6opmkZdmB1ipcy JAYtAHrVt0400X3rEzG4Z86YB6YR5MqmR/qTZV/c5kpAaTxR+aPuVtfLAj/S33P1y3Rk 5i2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PMU2ZMTZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 13-20020ac8590d000000b004277e6e3345si27638301qty.71.2024.01.02.08.06.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Jan 2024 08:06:08 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PMU2ZMTZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rKhGu-0006QC-US; Tue, 02 Jan 2024 11:05:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rKhGi-0006JI-07 for qemu-devel@nongnu.org; Tue, 02 Jan 2024 11:05:28 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rKhGg-0002eD-Ee for qemu-devel@nongnu.org; Tue, 02 Jan 2024 11:05:27 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40d8909a6feso15060345e9.2 for ; Tue, 02 Jan 2024 08:05:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704211524; x=1704816324; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6BwjC+ujFoVcnh1DxjxgU1C6te3MWe6aqORUUnNaIGM=; b=PMU2ZMTZF9/le816mASMlytGfTgze2mTIUiyDNIE2b4tFg1eEgGv3Lx3nTACUsoeAB WG8/c6M4jmL85IezF2nCXfonD7znmIqZ4PPkn7EtOqV+6VNM4PYRAhacGl4qUb/eQhCy YPDS7Go0HG0mc1EaXN/9JmIpXrRecZ8r8vAON9HB1LYZZTDf28znJuzra84XGoenWQhy m9nGm+UfrLXujOxUCypLsOq9BFTeEIp1Ca94D4TZuznHBG7zmb+f2wFk70dvAMR+XmV1 uj/OnnyiwhBqRRnLsz4eNeuL+cOU3ViNHq+BfbzTjN3CTSeBcfQufBl91x9pX2e3rPmM rjLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704211524; x=1704816324; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6BwjC+ujFoVcnh1DxjxgU1C6te3MWe6aqORUUnNaIGM=; b=K02uNwmeVTrga6rhU9Zoe7kv9r+EepyKJpCblmxgA5ovv2hOGicfJL8xfnGiZUA3U4 6dGSlOw3s0I9EnwyaQg5ywMOzC5x4cPhT1/SKdfVilB3p9T25zD6IOM0gzuTuG4sWAfQ Bt1gZAppyZrCb5Mclf8U2xuN8T77ESEkRVRMP/aUCtkxhkQ50S3cD9NsDHDgJCnsW7Ze KCoHenx6+If+ojGyfxSHSRvO8ZFgyCOKZe8q2LBQ/zHcxWLmKFEuqrYooumfaCj1ngTC iqjgmLBgwuoLqpKluaT5XRe5D+GbyB2SPs29R3f58vco/4RmtxyG/lwN05P1/SnX7lrj ascA== X-Gm-Message-State: AOJu0Yy4dh6gJoSfIuN1XY4vYg+GE6uz+6o7xGEawOu+Qm8dHfkp0MRg 2GLA0gdAOyeSrNgLrNfy2yQv9mUWvTb+RlEahFuapEQKKCw= X-Received: by 2002:a05:600c:a44:b0:40d:7822:bf54 with SMTP id c4-20020a05600c0a4400b0040d7822bf54mr2417553wmq.132.1704211524670; Tue, 02 Jan 2024 08:05:24 -0800 (PST) Received: from m1x-phil.lan (sal63-h02-176-184-16-71.dsl.sta.abo.bbox.fr. [176.184.16.71]) by smtp.gmail.com with ESMTPSA id h15-20020a05600c314f00b0040d5f466deesm22836750wmo.38.2024.01.02.08.05.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 02 Jan 2024 08:05:24 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Eric Blake , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , qemu-arm@nongnu.org, Luc Michel , =?utf-8?q?Alex_Benn?= =?utf-8?q?=C3=A9e?= , Mark Cave-Ayland , Eduardo Habkost , Frederic Konrad , Markus Armbruster , Paolo Bonzini , Kevin Wolf , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH 4/5] hw/arm/armv7m: Error if trying to set unavailable ARMCPU::vfp property Date: Tue, 2 Jan 2024 17:04:53 +0100 Message-ID: <20240102160455.68612-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240102160455.68612-1-philmd@linaro.org> References: <20240102160455.68612-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Do not ignore impossible configuration requested by the user. For example, when trying to enable VFP on a Cortex-M33 we now get: qemu-system-arm: 'cortex-m33-arm-cpu' does not support VFP Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/armv7m.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c index 3610f6f4a1..12cdad09f9 100644 --- a/hw/arm/armv7m.c +++ b/hw/arm/armv7m.c @@ -328,6 +328,9 @@ static void armv7m_realize(DeviceState *dev, Error **errp) if (!object_property_set_bool(OBJECT(s->cpu), "vfp", s->vfp, errp)) { return; } + } else if (s->vfp == OPTIONAL_BOOL_TRUE) { + error_setg(errp, "'%s' does not support VFP", s->cpu_type); + return; } if (object_property_find(OBJECT(s->cpu), "dsp")) { if (!object_property_set_bool(OBJECT(s->cpu), "dsp", s->dsp, errp)) { From patchwork Tue Jan 2 16:04:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 759369 Delivered-To: patch@linaro.org Received: by 2002:a5d:67c6:0:b0:336:6142:bf13 with SMTP id n6csp6113269wrw; Tue, 2 Jan 2024 08:06:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IHzPgY8oUE92jBKOQvDUdaRbp/vEJMhoST1V9jIS3aoHkheTFmkEHqRlcb+clWnprpbYgAv X-Received: by 2002:a05:622a:18a6:b0:427:8ff9:39be with SMTP id v38-20020a05622a18a600b004278ff939bemr28163095qtc.28.1704211604313; Tue, 02 Jan 2024 08:06:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704211604; cv=none; d=google.com; s=arc-20160816; b=Anbh0s+525Kvds3AI6TpjcPAE3JogCVJbCOAsLOu7l2/d1LzsSStXrJmD+CI9ERVbo MhLhNXKtgvkouYGDLLJNM5e7uX59Nmy869JrDbxOS7WHgdUhaRJnFeEypS5lt4DZ1Nrw BdEXJSIMnaguxx0W2zWAlC3Jbm7eGBuL1TFymG9yfFur7oRcXccdkCXknbxSiJyggPbp J3H9TPK0Dr5b8Du5EGORs3Y3OsTOj5LcfoYl8gvgRkftUsK/fC5IHavFgAfVUKSzJz02 oLQ9KJVeT+c3QNrGLmKIIOeh4QjEJjJBOS7PcF25psKMWBYyD542E7NPIDT/KLc3LL6x 8gRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nwq5yDKl13Ts01PyVa9GJG2AkfcsezIrZC8dB60lDmQ=; fh=Fbl4rt7vNadFyu+mhE5sPZ2m5GJmVL0UTbP+h3uuTlY=; b=cvMMe3XU209sWQGb1Vnh8OkKGBjsTTjoH1JdmOz3JGEcnfJ9k2WDFiNGcjUzPjztaM DzK2RI5TEfTO/fS75mxttYQtTRVGGq2zNfkk/9sttOryTdqpl+blnwTamJ+YVm1zuk4t swS2Gsum3dIaQX39FND3RDhOrt80gsQUzssVz7vz5zhFLi0CHYRYL02ejh03HoOmcfdk nf/vc/n9BNosLNtizp0KpvZJd4Z9GPs5z7VTbxvfszdTfgTfEFByGEVaK+Jn21dM7o7v Cu5RG30KwG4YEj/I8wWLSSFKhh+jzxkU1bwOfPku/EvEfq55PlurahEoMzNFinvTAwQ/ Pj0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dZ+S+nwx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t2-20020ac85882000000b00427eed70978si14395384qta.537.2024.01.02.08.06.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Jan 2024 08:06:44 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dZ+S+nwx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rKhH8-0006Xz-N3; Tue, 02 Jan 2024 11:05:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rKhGp-0006Ot-FT for qemu-devel@nongnu.org; Tue, 02 Jan 2024 11:05:35 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rKhGm-0002el-LB for qemu-devel@nongnu.org; Tue, 02 Jan 2024 11:05:35 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-40d5b89e2bfso56739265e9.0 for ; Tue, 02 Jan 2024 08:05:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704211531; x=1704816331; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nwq5yDKl13Ts01PyVa9GJG2AkfcsezIrZC8dB60lDmQ=; b=dZ+S+nwxV3iOZ9wwFf0r1YiyjxD9X6YhqmAIzZj7qhc8hc1/EvTZ48C2nQN6NvVa7B 5vl7lcewVRU0f4BftFxQNB5CWWNO0QuYwFVNR9QPnSHMvBzSlVx41XK7Fi+zKVM2D7ge SMLikimAJeRhPu4dnvBELYmBb67aZM5jNKpdSYgUKrwKD5ryTvuGxQJsmlOT4xEPow1z i8O2r2JVn5LYjSt+uEo7gnJ4uFde+VRvpehhC/6E4ltvymGfH0viOPDnbZjJ0GYVBypA bhVIl6wNdWKJ73hze9swZRiyOsbg+hj78hJkOqLZ4kDAHG2fhEHxBHuT6C9tHJgoSOlf 1ajA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704211531; x=1704816331; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nwq5yDKl13Ts01PyVa9GJG2AkfcsezIrZC8dB60lDmQ=; b=Vbq1Vri1eKqAe+KgHyuoj37kO2x9VlLWSTCzROhNLZb0pV2gdTlbXDI3ZYsf8iuIc4 1MKh/ZTIHLEtiC7zzatxrVkLNekjyvvwE4R85r1azINWcGKSOumPwYZ6n0VxoXin06iE tYWh10pFQ7qO0RexZuuAlLayxPxd1veq3MKsql3AnQVJCqNcRYNPwa947gNyoX7+sOts PBo6TMty9qyes+Tp8hS7r1pshLR5TCEkNlv/GW+QJSulU9RHrolGucYJ8SgJV5ChUAE2 x8IUEgHpf/UKYM1iIX7uyXdeCCgBdFKQh0QjXZsYnye35bffEDYIP+RT+x5BZ32FQ6jk o22A== X-Gm-Message-State: AOJu0YyPNzk+0hkVlOz2Wxk9dzQM0PXW+V7MCXjTSTtF8NknJJllSJJX XeAE1zesOkDPza0tKQfHI/EYf5mnM8tjn4uTHNCc3NT1uZY= X-Received: by 2002:a05:600c:ca:b0:40d:3a32:7d51 with SMTP id u10-20020a05600c00ca00b0040d3a327d51mr8132657wmm.119.1704211531140; Tue, 02 Jan 2024 08:05:31 -0800 (PST) Received: from m1x-phil.lan (sal63-h02-176-184-16-71.dsl.sta.abo.bbox.fr. [176.184.16.71]) by smtp.gmail.com with ESMTPSA id c18-20020a05600c0a5200b0040c6d559490sm45764022wmq.3.2024.01.02.08.05.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 02 Jan 2024 08:05:30 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Eric Blake , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , qemu-arm@nongnu.org, Luc Michel , =?utf-8?q?Alex_Benn?= =?utf-8?q?=C3=A9e?= , Mark Cave-Ayland , Eduardo Habkost , Frederic Konrad , Markus Armbruster , Paolo Bonzini , Kevin Wolf , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH 5/5] hw/arm/armv7m: Do not expose 'vfp' property if ARM CPU doesn't have it Date: Tue, 2 Jan 2024 17:04:54 +0100 Message-ID: <20240102160455.68612-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240102160455.68612-1-philmd@linaro.org> References: <20240102160455.68612-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Since the TYPE_ARMV7M object doesn't know its CPU type at the time armv7m_instance_init() is called, we need to prepare to forward any CPU properties there, then we can forward them in armv7m_realize(). But then when introspecting at runtime, in the case the requested CPU doesn't expose such properties, we can still see them exposed in the container. It is possible to remove an unmeaningful property with qdev_property_del_static(). As an example, remove the 'vfp' property when not relevant. When running the musca-a board, the monitor output changes as: (qemu) info qtree ... dev: armv7m, id "" gpio-in "NMI" 1 gpio-out "SYSRESETREQ" 1 gpio-in "" 96 clock-in "cpuclk" freq_hz=40 MHz clock-in "refclk" freq_hz=0 Hz cpu-type = "cortex-m33-arm-cpu" init-svtor = 270532608 (0x10200000) init-nsvtor = 0 (0x0) enable-bitband = false start-powered-off = false - vfp = "false" dsp = false mpu-ns-regions = 8 (0x8) mpu-s-regions = 8 (0x8) Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/armv7m.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c index 12cdad09f9..f1f40353cb 100644 --- a/hw/arm/armv7m.c +++ b/hw/arm/armv7m.c @@ -244,6 +244,9 @@ static const MemoryRegionOps ppb_default_ops = { .valid.max_access_size = 8, }; +static Property optional_arm_cpu_vfp_property = + DEFINE_PROP_BOOL_NODEFAULT("vfp", ARMv7MState, vfp); + static void armv7m_instance_init(Object *obj) { ARMv7MState *s = ARMV7M(obj); @@ -271,6 +274,9 @@ static void armv7m_instance_init(Object *obj) s->refclk = qdev_init_clock_in(DEVICE(obj), "refclk", NULL, NULL, 0); s->cpuclk = qdev_init_clock_in(DEVICE(obj), "cpuclk", NULL, NULL, 0); + + qdev_property_add_static(DEVICE(obj), + &optional_arm_cpu_vfp_property); } static void armv7m_realize(DeviceState *dev, Error **errp) @@ -331,6 +337,8 @@ static void armv7m_realize(DeviceState *dev, Error **errp) } else if (s->vfp == OPTIONAL_BOOL_TRUE) { error_setg(errp, "'%s' does not support VFP", s->cpu_type); return; + } else { + qdev_property_del_static(dev, &optional_arm_cpu_vfp_property); } if (object_property_find(OBJECT(s->cpu), "dsp")) { if (!object_property_set_bool(OBJECT(s->cpu), "dsp", s->dsp, errp)) { @@ -551,7 +559,6 @@ static Property armv7m_properties[] = { DEFINE_PROP_BOOL("enable-bitband", ARMv7MState, enable_bitband, false), DEFINE_PROP_BOOL("start-powered-off", ARMv7MState, start_powered_off, false), - DEFINE_PROP_BOOL_NODEFAULT("vfp", ARMv7MState, vfp), DEFINE_PROP_BOOL("dsp", ARMv7MState, dsp, true), DEFINE_PROP_UINT32("mpu-ns-regions", ARMv7MState, mpu_ns_regions, UINT_MAX), DEFINE_PROP_UINT32("mpu-s-regions", ARMv7MState, mpu_s_regions, UINT_MAX),