From nobody Tue Nov 26 20:34:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1704211589; cv=none; d=zohomail.com; s=zohoarc; b=jD7o6VRhueWQQmmdpb0pzPOWNCn45kI2SuMudeT4zgNCpzvkAqCqthlRSounFC3zk4z60kpbljPry9w0eokqCTdYXsytCHQbSVFSkOH+yzFMw/Th1Kxpdwl+8oUOlyhejcO2dm5tZxVJiLaheZT7X+O/lPJh0UvFvNFUDjZxruc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704211589; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=TVl3cttQKDPPU7GqDBLczNEA1v4uR7uW39llQJlVRbI=; b=NvE0vH3i+DddpndYC3vrmOFoavL7lu2H+AFFjDrg+X+cp1ALLcSYymp48RKxD9hZak4hibLek9uCSTueEcLXoiDXzM9Zr7VyvbgXi78Bn2e6L28dEaJDQ2hmcriX3JwFbRxst29APeaLecnZHc/WbR/7ZmxrZrt0qQ+UpDZMjXM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704211589433194.4104668230392; Tue, 2 Jan 2024 08:06:29 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AGHT+IH+Obc3ne7AAB3LoQIBsTVjLSH2urrV19UtpdDS4OFzucuPmDYGorqkMdUbkefjSu8sXVfrDQ== 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Eric Blake , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-arm@nongnu.org, Luc Michel , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mark Cave-Ayland , Eduardo Habkost , Frederic Konrad , Markus Armbruster , Paolo Bonzini , Kevin Wolf , =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1704211591426100001 We can add properties with qdev_property_add_static(). Add qdev_property_del_static() to delete them. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 r= et, Object *obj, */ void qdev_property_add_static(DeviceState *dev, Property *prop); =20 +void qdev_property_del_static(DeviceState *dev, Property *prop); + /** * qdev_alias_all_properties: Create aliases on source for all target prop= erties * @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, Proper= ty *prop) } } =20 +void qdev_property_del_static(DeviceState *dev, Property *prop) +{ + Object *obj =3D OBJECT(dev); + + object_property_del(obj, prop->name); +} + static void qdev_class_add_property(DeviceClass *klass, const char *name, Property *prop) { --=20 2.41.0 From nobody Tue Nov 26 20:34:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1704211639; cv=none; d=zohomail.com; s=zohoarc; b=kdBJSkjUruYKwX8tu5Brub/Ro3syF89lvjr8dn0LvXVLQQN0JIdcQOtUH/GeBvimTQqowYR+cMmgJRsyDi2pOVpd87bMSlNnZdfaN3k6Do8MtI7QsSVoIeTSvv460EnC9ViqFAIAl4K5vlGRZkqxyFOspBYnazf2fpO8joRrhRw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704211639; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ufonMTH/Sl8kmFdoBgYSf3okj9N+8Wa+NSxI0KCId+c=; b=dsvxjnaeY+YKLf2Ajq7jlFKPRoExSAA3xAGiqd0uTjF+Ltu5T6JLZTH9sSyDssLenNA2gGHysmr5ZgV6V7cBcK0C+c0KS3f70I4uBcQYgHAs32G4ufYuUz4D2LN7SC/JAEZLYb2e5f3m/FURo81sfsGbhCmm97Hpsc+pPo/zpCE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704211639087332.5858851105713; Tue, 2 Jan 2024 08:07:19 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AGHT+IEfenUzNg89P4j1gidzONQnhOe9H3bTMyqqyOK78NSJs8PafFY6IIv5Fgxey5SLF3EwUAq+cw== 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Eric Blake , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-arm@nongnu.org, Luc Michel , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mark Cave-Ayland , Eduardo Habkost , Frederic Konrad , Markus Armbruster , Paolo Bonzini , Kevin Wolf , =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1704211639513100001 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=C3=A9 --- 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 =3D true, \ .defval.u =3D (bool)_defval) =20 +#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 =3D { .set_default_value =3D set_default_value_bool, }; =20 +/* --- optional bool --- */ + +const PropertyInfo qdev_prop_bool_unset =3D { + .name =3D "OptionalBool", + .enum_table =3D &OptionalBool_lookup, + .get =3D qdev_propinfo_get_enum, + .set =3D qdev_propinfo_set_enum, + .set_default_value =3D qdev_propinfo_set_default_value_enum, +}; + /* --- 8bit integer --- */ =20 static void get_uint8(Object *obj, Visitor *v, const char *name, void *opa= que, --=20 2.41.0 From nobody Tue Nov 26 20:34:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1704211637; cv=none; d=zohomail.com; s=zohoarc; b=O0nv3c2WiEATJJFQhJ+1HmKsKcacmTSgxgKdPhqgmHNfFtVHfjQ9NzJZazgiBGN2g3bnoGl3WRSfp6lVlwvDYXC9BMQ3kvdTR8+48A+i6G/yLl4x4I96CkfW6PLGJQsMPMRcU3QghQ/nK6YPeOoSkKbqRVTykHaO7NOnEKUqdhs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704211637; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=J38P+ankfUbUztT5GJCTo6FfwFdn7YoTpHgRI5fDY8Q=; b=fQwqBn9xH5+542jqSQD+8I5sGcXT3VY707ta0sUWqccD8oYnl4dMPhj5vxdLwF3zwYCQ594R+BDShMaBIfmSLHAP/uZBf41weHVUe+zs8QTkHLNhUvfu5Mp4Q7/hWU3PuvU2Lp4gJn1T8IQxfZHL9EYJYDY6F1PmmCAnepozGvc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704211637721799.4805456762199; Tue, 2 Jan 2024 08:07:17 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AGHT+IGK81sSXeAZVigy9QHy8W3v7E9N09SlmUg/+/UeieW3S9EWG4i4DkIxryo3kfAalZFebgBIRA== 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Eric Blake , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-arm@nongnu.org, Luc Michel , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mark Cave-Ayland , Eduardo Habkost , Frederic Konrad , Markus Armbruster , Paolo Bonzini , Kevin Wolf , =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1704211639528100002 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=3D40 MHz clock-in "refclk" freq_hz=3D0 Hz cpu-type =3D "cortex-m33-arm-cpu" init-svtor =3D 270532608 (0x10200000) init-nsvtor =3D 0 (0x0) enable-bitband =3D false start-powered-off =3D false - vfp =3D false + vfp =3D "false" dsp =3D false mpu-ns-regions =3D 8 (0x8) mpu-s-regions =3D 8 (0x8) Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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; }; =20 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[] =3D { 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_M= AX), --=20 2.41.0 From nobody Tue Nov 26 20:34:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1704211569; cv=none; d=zohomail.com; s=zohoarc; b=dJIU3wXJOe8DONhgfNwMIc+7057fJ+XiO75lt+vtXShOY6iTWLyjFvGBGrLyMeDz3roKY18La6x59ut/+SauwJ+oVtMrENZs9dVL686eNyOKvBjEgb7jycKUIK2boxLAtml+s7P8rckOdyY0UpYCGW10ZhcROpZkg3TIFs3TaWM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704211569; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6BwjC+ujFoVcnh1DxjxgU1C6te3MWe6aqORUUnNaIGM=; b=mIB9iucqq8MKLrGRqut8uFVOjG3lal5rCTkf9YutWiU9mzOQ5T4Np7oH4JVP4F2lns/i47RwDgRoPPqDAwwBxbIIGsp9GFNayvJN2C5Qhlqqwrrv7pdj361Y1RXRDc2T7L9KwPuIGhw2cprrw9mlnjot/hIeyS5RWg0PSYEffnw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704211569341619.724106688082; Tue, 2 Jan 2024 08:06:09 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AGHT+IEr2Xaz+dnCGfu3Wh34558swFw/Oy2LhA/afKeYUi5+1wP3jjMtyLhrgd0jbz6osbxKK7xh4g== 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Eric Blake , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-arm@nongnu.org, Luc Michel , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mark Cave-Ayland , Eduardo Habkost , Frederic Konrad , Markus Armbruster , Paolo Bonzini , Kevin Wolf , =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1704211571385100001 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=C3=A9 --- 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 **er= rp) if (!object_property_set_bool(OBJECT(s->cpu), "vfp", s->vfp, errp)= ) { return; } + } else if (s->vfp =3D=3D 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)= ) { --=20 2.41.0 From nobody Tue Nov 26 20:34:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1704211604; cv=none; d=zohomail.com; s=zohoarc; b=RQvGpaaoLPp/+WS9zabcFA4bGYAhJmvhANNl8zHhwn7VAQyZJ/uYWuJ9oF6Wdrj80vcCdG7U+9yZZ2xzwHfp+i1XxGvIcXciqvnJootgLL1bpoQIDt3He1ipB3nDtgoYuXcH1rHwy7CjME8VbI8FQvVxK+Zhg7vwpnHyBmU42TI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704211604; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nwq5yDKl13Ts01PyVa9GJG2AkfcsezIrZC8dB60lDmQ=; b=dEVTujttdxpGEo0MgsTiAwatHK+Isup2YqudO3Zcz2xH2mWtv2yV3yrKIrFMc5GrtmixBLX+a14m/dooExaer2M2Su0jM8shlB17XpuOBJYd1Obhy01yLeLf5YczTyskGcBA4CuSv96T+nuychR6mivhaRcYfD4n7rmEufvcizg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704211604403752.6539997218823; Tue, 2 Jan 2024 08:06:44 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AGHT+IGb2XwyfuJx+sJgvN6SQmHHWUE9hIyqtWKh40xTmHinEm+AMoYcSkMlyySffPm9LMizi+tmsA== 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Eric Blake , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-arm@nongnu.org, Luc Michel , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mark Cave-Ayland , Eduardo Habkost , Frederic Konrad , Markus Armbruster , Paolo Bonzini , Kevin Wolf , =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1704211605411100001 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=3D40 MHz clock-in "refclk" freq_hz=3D0 Hz cpu-type =3D "cortex-m33-arm-cpu" init-svtor =3D 270532608 (0x10200000) init-nsvtor =3D 0 (0x0) enable-bitband =3D false start-powered-off =3D false - vfp =3D "false" dsp =3D false mpu-ns-regions =3D 8 (0x8) mpu-s-regions =3D 8 (0x8) Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 =3D { .valid.max_access_size =3D 8, }; =20 +static Property optional_arm_cpu_vfp_property =3D + DEFINE_PROP_BOOL_NODEFAULT("vfp", ARMv7MState, vfp); + static void armv7m_instance_init(Object *obj) { ARMv7MState *s =3D ARMV7M(obj); @@ -271,6 +274,9 @@ static void armv7m_instance_init(Object *obj) =20 s->refclk =3D qdev_init_clock_in(DEVICE(obj), "refclk", NULL, NULL, 0); s->cpuclk =3D qdev_init_clock_in(DEVICE(obj), "cpuclk", NULL, NULL, 0); + + qdev_property_add_static(DEVICE(obj), + &optional_arm_cpu_vfp_property); } =20 static void armv7m_realize(DeviceState *dev, Error **errp) @@ -331,6 +337,8 @@ static void armv7m_realize(DeviceState *dev, Error **er= rp) } else if (s->vfp =3D=3D 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[] =3D { 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_M= AX), --=20 2.41.0