From nobody Mon Feb 9 16:26:48 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1648729025412677.2071326208991; Thu, 31 Mar 2022 05:17:05 -0700 (PDT) Received: from localhost ([::1]:55896 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZtjc-0005jZ-5v for importer@patchew.org; Thu, 31 Mar 2022 08:17:04 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47986) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZtMi-00061n-3H for qemu-devel@nongnu.org; Thu, 31 Mar 2022 07:53:26 -0400 Received: from beetle.greensocs.com ([5.135.226.135]:54046) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZtMb-00005g-OT for qemu-devel@nongnu.org; Thu, 31 Mar 2022 07:53:23 -0400 Received: from crumble.bar.greensocs.com (unknown [172.17.10.10]) by beetle.greensocs.com (Postfix) with ESMTPS id BEBF321C39; Thu, 31 Mar 2022 11:53:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greensocs.com; s=mail; t=1648727593; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dsQmNcNr3FKvvqlW4Fm/tpXyRbUqSTE4gpq1FzHqJIY=; b=CY4M9NwccVDz3xvaHOXKuB5tNhZbON/w5pKw2FVG2iSPoKMaqhMO87Jx93EYx8oUZmTPNS EHXgESlw+G/lGZtaRpyi1x7/E0klL8ESOXNW1Fq+PR/CPg1uo6m7vw9FVrQlm9jKx3agyn UhqUdh0zs7dTK3xJ173fbeLeOFAjcp8= From: Damien Hedde To: qemu-devel@nongnu.org Subject: [PATCH v2 1/5] qdev: add user_creatable_requires_machine_allowance class flag Date: Thu, 31 Mar 2022 13:53:08 +0200 Message-Id: <20220331115312.30018-2-damien.hedde@greensocs.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220331115312.30018-1-damien.hedde@greensocs.com> References: <20220331115312.30018-1-damien.hedde@greensocs.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam: Yes 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=5.135.226.135; envelope-from=damien.hedde@greensocs.com; helo=beetle.greensocs.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, 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: , Cc: Damien Hedde , Eduardo Habkost , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Yanan Wang , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1648729027898100001 Content-Type: text/plain; charset="utf-8" This flag will be used in device_add to check if the device needs special allowance from the machine model. It will replace the current check based only on the device being a TYPE_SYB_BUS_DEVICE. Signed-off-by: Damien Hedde Reviewed-by: Edgar E. Iglesias --- v2: + change the flag name and put it just below user_creatable --- include/hw/qdev-core.h | 9 +++++++++ hw/core/qdev.c | 1 + hw/core/sysbus.c | 1 + 3 files changed, 11 insertions(+) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 92c3d65208..6a040fcd3b 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -122,6 +122,15 @@ struct DeviceClass { * TODO remove once we're there */ bool user_creatable; + /* + * Some devices can be user created under certain conditions (eg: + * specific machine support for sysbus devices), but it is + * preferable to prevent global allowance for the reasons + * described above. + * This flag is an additional constraint over user_creatable: + * user_creatable still needs to be set to true. + */ + bool user_creatable_requires_machine_allowance; bool hotpluggable; =20 /* callbacks */ diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 84f3019440..0844c85a21 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -833,6 +833,7 @@ static void device_class_init(ObjectClass *class, void = *data) */ dc->hotpluggable =3D true; dc->user_creatable =3D true; + dc->user_creatable_requires_machine_allowance =3D false; vc->get_id =3D device_vmstate_if_get_id; rc->get_state =3D device_get_reset_state; rc->child_foreach =3D device_reset_child_foreach; diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index 05c1da3d31..5f771ed1e9 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -325,6 +325,7 @@ static void sysbus_device_class_init(ObjectClass *klass= , void *data) * subclass needs to override it and set user_creatable=3Dtrue. */ k->user_creatable =3D false; + k->user_creatable_requires_machine_allowance =3D true; } =20 static const TypeInfo sysbus_device_type_info =3D { --=20 2.35.1 From nobody Mon Feb 9 16:26:48 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1648728056445564.6480996112126; Thu, 31 Mar 2022 05:00:56 -0700 (PDT) Received: from localhost ([::1]:42748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZtTy-0003zW-PJ for importer@patchew.org; Thu, 31 Mar 2022 08:00:54 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48022) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZtMk-00062E-3j for qemu-devel@nongnu.org; Thu, 31 Mar 2022 07:53:26 -0400 Received: from beetle.greensocs.com ([5.135.226.135]:54062) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZtMe-00005n-24 for qemu-devel@nongnu.org; Thu, 31 Mar 2022 07:53:25 -0400 Received: from crumble.bar.greensocs.com (unknown [172.17.10.10]) by beetle.greensocs.com (Postfix) with ESMTPS id 5CF0921C47; Thu, 31 Mar 2022 11:53:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greensocs.com; s=mail; t=1648727593; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1PfgWdlVUGs+KjbjO0RYJ3uN1s2MNL9Ymdw+vwjWH7w=; b=mnp16i6izQuAXpJu/HDa1a3EiIv6FgGtLax1ulWYpNBs2vjX6svzE/Zd7e0KX393YktT21 i6hDKqH7A0/SAVqVxoR/He4nMVnpmIzeAVqvQP4pkwrHs6AXRqADkinrNvco6fOy5eAcVf GEU6MsUm1QiKIv2Kv8cdLhB0iP1OFhI= From: Damien Hedde To: qemu-devel@nongnu.org Subject: [PATCH v2 2/5] machine: update machine allowed list related functions/fields Date: Thu, 31 Mar 2022 13:53:09 +0200 Message-Id: <20220331115312.30018-3-damien.hedde@greensocs.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220331115312.30018-1-damien.hedde@greensocs.com> References: <20220331115312.30018-1-damien.hedde@greensocs.com> 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=5.135.226.135; envelope-from=damien.hedde@greensocs.com; helo=beetle.greensocs.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, 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: , Cc: Damien Hedde , Eduardo Habkost , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Yanan Wang , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1648728059585100001 The list will now accept any device (not only sysbus devices) so we rename the related code and documentation. Create some temporary inline functions with old names until we've udpated callsites as well. Signed-off-by: Damien Hedde Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Edgar E. Iglesias --- include/hw/boards.h | 50 +++++++++++++++++++++++++++------------------ hw/core/machine.c | 10 ++++----- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index c92ac8815c..1814793175 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -38,35 +38,45 @@ void machine_parse_smp_config(MachineState *ms, const SMPConfiguration *config, Error **errp= ); =20 /** - * machine_class_allow_dynamic_sysbus_dev: Add type to list of valid devic= es + * machine_class_allow_dynamic_device: Add type to list of valid devices * @mc: Machine class - * @type: type to allow (should be a subtype of TYPE_SYS_BUS_DEVICE) + * @type: type to allow (should be a subtype of TYPE_DEVICE having the + * uc_requires_machine_allowance flag) * * Add the QOM type @type to the list of devices of which are subtypes - * of TYPE_SYS_BUS_DEVICE but which are still permitted to be dynamically - * created (eg by the user on the command line with -device). - * By default if the user tries to create any devices on the command line - * that are subtypes of TYPE_SYS_BUS_DEVICE they will get an error message; - * for the special cases which are permitted for this machine model, the - * machine model class init code must call this function to add them - * to the list of specifically permitted devices. + * of TYPE_DEVICE but which are only permitted to be dynamically + * created (eg by the user on the command line with -device) if the + * machine allowed it. + * + * Otherwise if the user tries to create such a device on the command line, + * it will get an error message. */ -void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, const char *= type); +void machine_class_allow_dynamic_device(MachineClass *mc, const char *type= ); +static inline void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, + const char *type) +{ + machine_class_allow_dynamic_device(mc, type); +} =20 /** - * device_type_is_dynamic_sysbus: Check if type is an allowed sysbus device + * device_type_is_dynamic_allowed: Check if type is an allowed device * type for the machine class. * @mc: Machine class - * @type: type to check (should be a subtype of TYPE_SYS_BUS_DEVICE) + * @type: type to check (should be a subtype of TYPE_DEVICE) * * Returns: true if @type is a type in the machine's list of - * dynamically pluggable sysbus devices; otherwise false. + * dynamically pluggable devices; otherwise false. * - * Check if the QOM type @type is in the list of allowed sysbus device - * types (see machine_class_allowed_dynamic_sysbus_dev()). + * Check if the QOM type @type is in the list of allowed device + * types (see machine_class_allowed_dynamic_device()). * Note that if @type has a parent type in the list, it is allowed too. */ -bool device_type_is_dynamic_sysbus(MachineClass *mc, const char *type); +bool device_type_is_dynamic_allowed(MachineClass *mc, const char *type); +static inline bool device_type_is_dynamic_sysbus(MachineClass *mc, + const char *type) +{ + return device_type_is_dynamic_allowed(mc, type); +} =20 /** * device_is_dynamic_sysbus: test whether device is a dynamic sysbus device @@ -74,12 +84,12 @@ bool device_type_is_dynamic_sysbus(MachineClass *mc, co= nst char *type); * @dev: device to check * * Returns: true if @dev is a sysbus device on the machine's list - * of dynamically pluggable sysbus devices; otherwise false. + * of dynamically pluggable devices; otherwise false. * * This function checks whether @dev is a valid dynamic sysbus device, * by first confirming that it is a sysbus device and then checking it - * against the list of permitted dynamic sysbus devices which has been - * set up by the machine using machine_class_allow_dynamic_sysbus_dev(). + * against the list of permitted dynamic devices which has been + * set up by the machine using machine_class_allow_dynamic_device(). * * It is valid to call this with something that is not a subclass of * TYPE_SYS_BUS_DEVICE; the function will return false in this case. @@ -263,7 +273,7 @@ struct MachineClass { bool ignore_memory_transaction_failures; int numa_mem_align_shift; const char **valid_cpu_types; - strList *allowed_dynamic_sysbus_devices; + strList *allowed_dynamic_devices; bool auto_enable_numa_with_memhp; bool auto_enable_numa_with_memdev; bool ignore_boot_device_suffixes; diff --git a/hw/core/machine.c b/hw/core/machine.c index d856485cb4..fb1f7c8e5a 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -545,9 +545,9 @@ static void machine_set_nvdimm_persistence(Object *obj,= const char *value, nvdimms_state->persistence_string =3D g_strdup(value); } =20 -void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, const char *= type) +void machine_class_allow_dynamic_device(MachineClass *mc, const char *type) { - QAPI_LIST_PREPEND(mc->allowed_dynamic_sysbus_devices, g_strdup(type)); + QAPI_LIST_PREPEND(mc->allowed_dynamic_devices, g_strdup(type)); } =20 bool device_is_dynamic_sysbus(MachineClass *mc, DeviceState *dev) @@ -558,16 +558,16 @@ bool device_is_dynamic_sysbus(MachineClass *mc, Devic= eState *dev) return false; } =20 - return device_type_is_dynamic_sysbus(mc, object_get_typename(obj)); + return device_type_is_dynamic_allowed(mc, object_get_typename(obj)); } =20 -bool device_type_is_dynamic_sysbus(MachineClass *mc, const char *type) +bool device_type_is_dynamic_allowed(MachineClass *mc, const char *type) { bool allowed =3D false; strList *wl; ObjectClass *klass =3D object_class_by_name(type); =20 - for (wl =3D mc->allowed_dynamic_sysbus_devices; + for (wl =3D mc->allowed_dynamic_devices; !allowed && wl; wl =3D wl->next) { allowed |=3D !!object_class_dynamic_cast(klass, wl->value); --=20 2.35.1 From nobody Mon Feb 9 16:26:48 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1648728206732316.1506343869746; Thu, 31 Mar 2022 05:03:26 -0700 (PDT) Received: from localhost ([::1]:45704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZtWP-0006Dc-GJ for importer@patchew.org; Thu, 31 Mar 2022 08:03:25 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48024) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZtMk-00062F-3k for qemu-devel@nongnu.org; Thu, 31 Mar 2022 07:53:26 -0400 Received: from beetle.greensocs.com ([5.135.226.135]:54076) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZtMe-00005u-2L for qemu-devel@nongnu.org; Thu, 31 Mar 2022 07:53:24 -0400 Received: from crumble.bar.greensocs.com (unknown [172.17.10.10]) by beetle.greensocs.com (Postfix) with ESMTPS id E908C21C69; Thu, 31 Mar 2022 11:53:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greensocs.com; s=mail; t=1648727594; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i93rJCS9n2343uMjZg2mso2OSD0aqFKwZlglzta+g5Q=; b=MiHlWvOkJN7t02v/UeR+loCbu0z2ltjMb0kZTC6Vt6hOr+nHyRh0C3D2YCRRq7vjDAHb1S mJk9rA9+UqFrkzGrlqyosPLmrIYABCAyFbt9PLmSJNb+R5GIiNcVse7N6lSq1hsG3GTcze 0Kv67k852dkyIwkRNS6+ScdrkOFHZOw= From: Damien Hedde To: qemu-devel@nongnu.org Subject: [PATCH v2 3/5] qdev-monitor: use the new user_creatable_requires_machine_allowance Date: Thu, 31 Mar 2022 13:53:10 +0200 Message-Id: <20220331115312.30018-4-damien.hedde@greensocs.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220331115312.30018-1-damien.hedde@greensocs.com> References: <20220331115312.30018-1-damien.hedde@greensocs.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam: Yes 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=5.135.226.135; envelope-from=damien.hedde@greensocs.com; helo=beetle.greensocs.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, 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: , Cc: Damien Hedde , Eduardo Habkost , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Yanan Wang , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1648728208723100001 Content-Type: text/plain; charset="utf-8" Instead of checking if the device is a sysbus device, just check the newly added flag in device class. Signed-off-by: Damien Hedde Reviewed-by: Edgar E. Iglesias --- v2: update the flag name --- softmmu/qdev-monitor.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c index 12fe60c467..77f468358d 100644 --- a/softmmu/qdev-monitor.c +++ b/softmmu/qdev-monitor.c @@ -258,12 +258,12 @@ static DeviceClass *qdev_get_device_class(const char = **driver, Error **errp) return NULL; } =20 - if (object_class_dynamic_cast(oc, TYPE_SYS_BUS_DEVICE)) { - /* sysbus devices need to be allowed by the machine */ + if (dc->user_creatable_requires_machine_allowance) { + /* some devices need to be allowed by the machine */ MachineClass *mc =3D MACHINE_CLASS(object_get_class(qdev_get_machi= ne())); - if (!device_type_is_dynamic_sysbus(mc, *driver)) { + if (!device_type_is_dynamic_allowed(mc, *driver)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "driver", - "a dynamic sysbus device type for the machine"); + "the device type is not allowed for this machine"); return NULL; } } --=20 2.35.1 From nobody Mon Feb 9 16:26:48 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1648729633745338.193210735512; Thu, 31 Mar 2022 05:27:13 -0700 (PDT) Received: from localhost ([::1]:43148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZttQ-00088S-7m for importer@patchew.org; Thu, 31 Mar 2022 08:27:12 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48034) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZtMk-000639-Vt for qemu-devel@nongnu.org; Thu, 31 Mar 2022 07:53:28 -0400 Received: from beetle.greensocs.com ([5.135.226.135]:54100) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZtMe-000061-2V for qemu-devel@nongnu.org; Thu, 31 Mar 2022 07:53:26 -0400 Received: from crumble.bar.greensocs.com (unknown [172.17.10.10]) by beetle.greensocs.com (Postfix) with ESMTPS id 4B1EE21CC4; Thu, 31 Mar 2022 11:53:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greensocs.com; s=mail; t=1648727594; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TtzRWK6oRCkkVEPihvusUuUO/HWewFUki8lfJUknad0=; b=CQhPO7ic4xsLlwzlo784GdXttSGJwHp7TbC/4v3kIwgY9vOVHL45R51PBou8VR0sX0hjFr jRrxziVlYoqwwclJrHroUojNoQ2vXk3RjDgJX5pMbdFFYPSm13q5hVwnI3QgsI5YhuwR+/ luCfafEe2KJDI4twVhhyF609tc1gELI= From: Damien Hedde To: qemu-devel@nongnu.org Subject: [PATCH v2 4/5] rename machine_class_allow_dynamic_sysbus_dev Date: Thu, 31 Mar 2022 13:53:11 +0200 Message-Id: <20220331115312.30018-5-damien.hedde@greensocs.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220331115312.30018-1-damien.hedde@greensocs.com> References: <20220331115312.30018-1-damien.hedde@greensocs.com> 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=5.135.226.135; envelope-from=damien.hedde@greensocs.com; helo=beetle.greensocs.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, 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: , Cc: Damien Hedde , Eduardo Habkost , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Yanan Wang , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1648729636203100001 All callsite are updated to the new function name "machine_class_allow_dynamic_device" Signed-off-by: Damien Hedde Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Edgar E. Iglesias --- hw/arm/virt.c | 10 +++++----- hw/i386/microvm.c | 2 +- hw/i386/pc_piix.c | 4 ++-- hw/i386/pc_q35.c | 8 ++++---- hw/ppc/e500plat.c | 2 +- hw/ppc/spapr.c | 2 +- hw/riscv/virt.c | 2 +- hw/xen/xen-legacy-backend.c | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index d2e5ecd234..1442b8840b 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2829,12 +2829,12 @@ static void virt_machine_class_init(ObjectClass *oc= , void *data) * configuration of the particular instance. */ mc->max_cpus =3D 512; - machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_CALXEDA_XGMAC); - machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_AMD_XGBE); - machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE); - machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_PLATFORM); + machine_class_allow_dynamic_device(mc, TYPE_VFIO_CALXEDA_XGMAC); + machine_class_allow_dynamic_device(mc, TYPE_VFIO_AMD_XGBE); + machine_class_allow_dynamic_device(mc, TYPE_RAMFB_DEVICE); + machine_class_allow_dynamic_device(mc, TYPE_VFIO_PLATFORM); #ifdef CONFIG_TPM - machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS); + machine_class_allow_dynamic_device(mc, TYPE_TPM_TIS_SYSBUS); #endif mc->block_default_type =3D IF_VIRTIO; mc->no_cdrom =3D 1; diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c index 4b3b1dd262..4f8f423d31 100644 --- a/hw/i386/microvm.c +++ b/hw/i386/microvm.c @@ -756,7 +756,7 @@ static void microvm_class_init(ObjectClass *oc, void *d= ata) MICROVM_MACHINE_AUTO_KERNEL_CMDLINE, "Set off to disable adding virtio-mmio devices to the kernel cmdli= ne"); =20 - machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE); + machine_class_allow_dynamic_device(mc, TYPE_RAMFB_DEVICE); } =20 static const TypeInfo microvm_machine_info =3D { diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index b72c03d0a6..27373cb16a 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -411,8 +411,8 @@ static void pc_i440fx_machine_options(MachineClass *m) m->desc =3D "Standard PC (i440FX + PIIX, 1996)"; m->default_machine_opts =3D "firmware=3Dbios-256k.bin"; m->default_display =3D "std"; - machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE); - machine_class_allow_dynamic_sysbus_dev(m, TYPE_VMBUS_BRIDGE); + machine_class_allow_dynamic_device(m, TYPE_RAMFB_DEVICE); + machine_class_allow_dynamic_device(m, TYPE_VMBUS_BRIDGE); } =20 static void pc_i440fx_7_0_machine_options(MachineClass *m) diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 1780f79bc1..8221615fa4 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -353,10 +353,10 @@ static void pc_q35_machine_options(MachineClass *m) m->default_display =3D "std"; m->default_kernel_irqchip_split =3D false; m->no_floppy =3D 1; - machine_class_allow_dynamic_sysbus_dev(m, TYPE_AMD_IOMMU_DEVICE); - machine_class_allow_dynamic_sysbus_dev(m, TYPE_INTEL_IOMMU_DEVICE); - machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE); - machine_class_allow_dynamic_sysbus_dev(m, TYPE_VMBUS_BRIDGE); + machine_class_allow_dynamic_device(m, TYPE_AMD_IOMMU_DEVICE); + machine_class_allow_dynamic_device(m, TYPE_INTEL_IOMMU_DEVICE); + machine_class_allow_dynamic_device(m, TYPE_RAMFB_DEVICE); + machine_class_allow_dynamic_device(m, TYPE_VMBUS_BRIDGE); m->max_cpus =3D 288; } =20 diff --git a/hw/ppc/e500plat.c b/hw/ppc/e500plat.c index fc911bbb7b..273cde9d06 100644 --- a/hw/ppc/e500plat.c +++ b/hw/ppc/e500plat.c @@ -102,7 +102,7 @@ static void e500plat_machine_class_init(ObjectClass *oc= , void *data) mc->max_cpus =3D 32; mc->default_cpu_type =3D POWERPC_CPU_TYPE_NAME("e500v2_v30"); mc->default_ram_id =3D "mpc8544ds.ram"; - machine_class_allow_dynamic_sysbus_dev(mc, TYPE_ETSEC_COMMON); + machine_class_allow_dynamic_device(mc, TYPE_ETSEC_COMMON); } =20 static const TypeInfo e500plat_info =3D { diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index a4372ba189..70e12d9037 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4586,7 +4586,7 @@ static void spapr_machine_class_init(ObjectClass *oc,= void *data) mc->default_ram_id =3D "ppc_spapr.ram"; mc->default_display =3D "std"; mc->kvm_type =3D spapr_kvm_type; - machine_class_allow_dynamic_sysbus_dev(mc, TYPE_SPAPR_PCI_HOST_BRIDGE); + machine_class_allow_dynamic_device(mc, TYPE_SPAPR_PCI_HOST_BRIDGE); mc->pci_allow_0_address =3D true; assert(!mc->get_hotplug_handler); mc->get_hotplug_handler =3D spapr_get_hotplug_handler; diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index da50cbed43..b6e2b0051b 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -1513,7 +1513,7 @@ static void virt_machine_class_init(ObjectClass *oc, = void *data) mc->numa_mem_supported =3D true; mc->default_ram_id =3D "riscv_virt_board.ram"; =20 - machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE); + machine_class_allow_dynamic_device(mc, TYPE_RAMFB_DEVICE); =20 object_class_property_add_bool(oc, "aclint", virt_get_aclint, virt_set_aclint); diff --git a/hw/xen/xen-legacy-backend.c b/hw/xen/xen-legacy-backend.c index 085fd31ef7..7c81c4846a 100644 --- a/hw/xen/xen-legacy-backend.c +++ b/hw/xen/xen-legacy-backend.c @@ -722,7 +722,7 @@ static void xen_set_dynamic_sysbus(void) ObjectClass *oc =3D object_get_class(machine); MachineClass *mc =3D MACHINE_CLASS(oc); =20 - machine_class_allow_dynamic_sysbus_dev(mc, TYPE_XENSYSDEV); + machine_class_allow_dynamic_device(mc, TYPE_XENSYSDEV); } =20 int xen_be_register(const char *type, struct XenDevOps *ops) --=20 2.35.1 From nobody Mon Feb 9 16:26:48 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1648728536129556.9939138375648; Thu, 31 Mar 2022 05:08:56 -0700 (PDT) Received: from localhost ([::1]:50080 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZtbi-0001SC-W3 for importer@patchew.org; Thu, 31 Mar 2022 08:08:55 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48036) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZtMl-00063Y-4v for qemu-devel@nongnu.org; Thu, 31 Mar 2022 07:53:28 -0400 Received: from beetle.greensocs.com ([5.135.226.135]:54116) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZtMi-00007D-Of for qemu-devel@nongnu.org; Thu, 31 Mar 2022 07:53:26 -0400 Received: from crumble.bar.greensocs.com (unknown [172.17.10.10]) by beetle.greensocs.com (Postfix) with ESMTPS id A5D0B21EBC; Thu, 31 Mar 2022 11:53:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greensocs.com; s=mail; t=1648727594; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Qxbod3xZWrGi3iOaENzr5nszU8j+mKdrSWBJDsqTqlo=; b=YrfhmoFB9S2VnL/AXQLjMvVbIsXfbIx6+tYeP8apYBWPT8dQDY72F0B4wk6w0VBsF6bsZQ W1InRHSjZ8eyylLlakzsdCSnU7lWjDIKbd9TAMp6cUAbtT6tRSKUZtZea9qebxZTrWvwUd YxdABKedLwA92U6RC+SBaitQxT+ttII= From: Damien Hedde To: qemu-devel@nongnu.org Subject: [PATCH v2 5/5] machine: remove temporary inline functions Date: Thu, 31 Mar 2022 13:53:12 +0200 Message-Id: <20220331115312.30018-6-damien.hedde@greensocs.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220331115312.30018-1-damien.hedde@greensocs.com> References: <20220331115312.30018-1-damien.hedde@greensocs.com> 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=5.135.226.135; envelope-from=damien.hedde@greensocs.com; helo=beetle.greensocs.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, 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: , Cc: Damien Hedde , Eduardo Habkost , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Yanan Wang , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1648728537525100001 Now we have renamed all calls to these old functions, we can delete the temporary inline we've defined. Signed-off-by: Damien Hedde Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Edgar E. Iglesias --- include/hw/boards.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index 1814793175..7efba048e9 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -52,11 +52,6 @@ void machine_parse_smp_config(MachineState *ms, * it will get an error message. */ void machine_class_allow_dynamic_device(MachineClass *mc, const char *type= ); -static inline void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, - const char *type) -{ - machine_class_allow_dynamic_device(mc, type); -} =20 /** * device_type_is_dynamic_allowed: Check if type is an allowed device @@ -72,11 +67,6 @@ static inline void machine_class_allow_dynamic_sysbus_de= v(MachineClass *mc, * Note that if @type has a parent type in the list, it is allowed too. */ bool device_type_is_dynamic_allowed(MachineClass *mc, const char *type); -static inline bool device_type_is_dynamic_sysbus(MachineClass *mc, - const char *type) -{ - return device_type_is_dynamic_allowed(mc, type); -} =20 /** * device_is_dynamic_sysbus: test whether device is a dynamic sysbus device --=20 2.35.1