From patchwork Wed Mar 30 16:12:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Hedde X-Patchwork-Id: 1611239 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=greensocs.com header.i=@greensocs.com header.a=rsa-sha256 header.s=mail header.b=y6ndgJ9A; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KTBWQ6pHjz9sFt for ; Thu, 31 Mar 2022 03:21:06 +1100 (AEDT) Received: from localhost ([::1]:44806 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZb4C-0007WT-JA for incoming@patchwork.ozlabs.org; Wed, 30 Mar 2022 12:21:04 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43704) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZavm-0001wm-R6 for qemu-devel@nongnu.org; Wed, 30 Mar 2022 12:12:22 -0400 Received: from beetle.greensocs.com ([5.135.226.135]:43274) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZavj-00015U-37 for qemu-devel@nongnu.org; Wed, 30 Mar 2022 12:12:22 -0400 Received: from crumble.bar.greensocs.com (unknown [172.17.10.6]) by beetle.greensocs.com (Postfix) with ESMTPS id A01FD21C38; Wed, 30 Mar 2022 16:12:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greensocs.com; s=mail; t=1648656736; 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=HZxEDrSOjfWFBbGyVVQI54kbQO1rmKUBNEhxdHOuVxU=; b=y6ndgJ9A6/RFgbYwrJvVOMdLPbhAeplamjZBCeSCbD8OAquaMwaRBRgqCw5KELAjLgOjiG rQKrKyzufNUxWPWbseU5Af9XWpOHVs8uRmLxPPAqfZZLD4SD4q6C9WGWpXqCTBWmnPHz2Z 3JmuUTab7eqt7HCNPOb1EzYY2U6GW0M= From: Damien Hedde To: qemu-devel@nongnu.org Subject: [PATCH 1/5] qdev: add uc_requires_machine_allowance flag Date: Wed, 30 Mar 2022 18:12:11 +0200 Message-Id: <20220330161215.235231-2-damien.hedde@greensocs.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220330161215.235231-1-damien.hedde@greensocs.com> References: <20220330161215.235231-1-damien.hedde@greensocs.com> MIME-Version: 1.0 X-Spam: Yes 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_P=2E_Berrang=C3=A9?= , =?utf-8?q?Phil?= =?utf-8?q?ippe_Mathieu-Daud=C3=A9?= , Yanan Wang , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 --- include/hw/qdev-core.h | 6 ++++++ hw/core/qdev.c | 1 + hw/core/sysbus.c | 1 + 3 files changed, 8 insertions(+) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 92c3d65208..f5a05ced39 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -123,6 +123,12 @@ struct DeviceClass { */ bool user_creatable; bool hotpluggable; + /* + * Some devices (eg: sysbus devices) are only user-creatable if + * the machine allowed it. user_creatable need still to be set to + * true, this is an additional constraint. + */ + bool uc_requires_machine_allowance; /* callbacks */ /* diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 84f3019440..0825277521 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 = true; dc->user_creatable = true; + dc->uc_requires_machine_allowance = false; vc->get_id = device_vmstate_if_get_id; rc->get_state = device_get_reset_state; rc->child_foreach = device_reset_child_foreach; diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index 05c1da3d31..462eb1116c 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=true. */ k->user_creatable = false; + k->uc_requires_machine_allowance = true; } static const TypeInfo sysbus_device_type_info = { From patchwork Wed Mar 30 16:12:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Damien Hedde X-Patchwork-Id: 1611238 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=greensocs.com header.i=@greensocs.com header.a=rsa-sha256 header.s=mail header.b=Lr42LR+6; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KTBWP5j2Rz9sFt for ; Thu, 31 Mar 2022 03:21:05 +1100 (AEDT) Received: from localhost ([::1]:44776 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZb4B-0007V9-ND for incoming@patchwork.ozlabs.org; Wed, 30 Mar 2022 12:21:03 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43716) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZavn-0001xZ-00 for qemu-devel@nongnu.org; Wed, 30 Mar 2022 12:12:23 -0400 Received: from beetle.greensocs.com ([5.135.226.135]:43288) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZavj-00015h-FF for qemu-devel@nongnu.org; Wed, 30 Mar 2022 12:12:22 -0400 Received: from crumble.bar.greensocs.com (unknown [172.17.10.6]) by beetle.greensocs.com (Postfix) with ESMTPS id 40A5721C6C; Wed, 30 Mar 2022 16:12:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greensocs.com; s=mail; t=1648656737; 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=Le3tVPTHEWz9KaJOBGhNj9RPl7j8R8+nX4XRhIBVFmQ=; b=Lr42LR+6BaYGc5pAZ6KM8fU0v6cdLhwmQmDSG6laO+p7aafdxRv4z+/tlybekG/7rCyVSM kTuHyQoptEosaBW2Y4FB/IYdP04eq9gC45ytFKVz3Qagu2uhsTYrvGKL9UQ5HJbDTE6GcT 53MuoiOii2hcnm+eG2v90tpw9z6sSDM= From: Damien Hedde To: qemu-devel@nongnu.org Subject: [PATCH 2/5] machine: update machine allowed list related functions/fields Date: Wed, 30 Mar 2022 18:12:12 +0200 Message-Id: <20220330161215.235231-3-damien.hedde@greensocs.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220330161215.235231-1-damien.hedde@greensocs.com> References: <20220330161215.235231-1-damien.hedde@greensocs.com> MIME-Version: 1.0 X-Spam: Yes 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_P=2E_Berrang=C3=A9?= , =?utf-8?q?Phil?= =?utf-8?q?ippe_Mathieu-Daud=C3=A9?= , Yanan Wang , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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é --- 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..9ce7d705c9 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); /** - * machine_class_allow_dynamic_sysbus_dev: Add type to list of valid devices + * 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); +} /** - * 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 void device_type_is_dynamic_sysbus(MachineClass *mc, + const char *type) +{ + device_type_is_dynamic_allowed(mc, type); +} /** * device_is_dynamic_sysbus: test whether device is a dynamic sysbus device @@ -74,12 +84,12 @@ bool device_type_is_dynamic_sysbus(MachineClass *mc, const 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 = g_strdup(value); } -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)); } bool device_is_dynamic_sysbus(MachineClass *mc, DeviceState *dev) @@ -558,16 +558,16 @@ bool device_is_dynamic_sysbus(MachineClass *mc, DeviceState *dev) return false; } - return device_type_is_dynamic_sysbus(mc, object_get_typename(obj)); + return device_type_is_dynamic_allowed(mc, object_get_typename(obj)); } -bool device_type_is_dynamic_sysbus(MachineClass *mc, const char *type) +bool device_type_is_dynamic_allowed(MachineClass *mc, const char *type) { bool allowed = false; strList *wl; ObjectClass *klass = object_class_by_name(type); - for (wl = mc->allowed_dynamic_sysbus_devices; + for (wl = mc->allowed_dynamic_devices; !allowed && wl; wl = wl->next) { allowed |= !!object_class_dynamic_cast(klass, wl->value); From patchwork Wed Mar 30 16:12:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Hedde X-Patchwork-Id: 1611235 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=greensocs.com header.i=@greensocs.com header.a=rsa-sha256 header.s=mail header.b=kRAjp0jR; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KTBMd2fb0z9sFq for ; Thu, 31 Mar 2022 03:14:21 +1100 (AEDT) Received: from localhost ([::1]:36880 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZaxf-0001wh-AU for incoming@patchwork.ozlabs.org; Wed, 30 Mar 2022 12:14:19 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43664) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZavl-0001ty-In for qemu-devel@nongnu.org; Wed, 30 Mar 2022 12:12:21 -0400 Received: from beetle.greensocs.com ([5.135.226.135]:43312) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZavj-00015k-Fv for qemu-devel@nongnu.org; Wed, 30 Mar 2022 12:12:21 -0400 Received: from crumble.bar.greensocs.com (unknown [172.17.10.6]) by beetle.greensocs.com (Postfix) with ESMTPS id C031221C73; Wed, 30 Mar 2022 16:12:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greensocs.com; s=mail; t=1648656737; 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=A+GahVX3SgP+ojB1yjeXegWLVNZJ2DRYwHbQs+spcYw=; b=kRAjp0jRbQ0x+OFf+/VugNaUo0rXQZZSBiAJh2L9oU7qUGjOsle1Yww08heFYGtSJtWesy gpxYhjCgpohGP3O+kPRSGkMFsm3ts7eOkYTDJfbdUKVePdzAHXi49G06VHLxchxDHvJfNK FqALLVaCdyef46aZo4nl2A+PH0ZAa+I= From: Damien Hedde To: qemu-devel@nongnu.org Subject: [PATCH 3/5] qdev-monitor: use the newly uc_requires_machine_allowance Date: Wed, 30 Mar 2022 18:12:13 +0200 Message-Id: <20220330161215.235231-4-damien.hedde@greensocs.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220330161215.235231-1-damien.hedde@greensocs.com> References: <20220330161215.235231-1-damien.hedde@greensocs.com> MIME-Version: 1.0 X-Spam: Yes 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_P=2E_Berrang=C3=A9?= , =?utf-8?q?Phil?= =?utf-8?q?ippe_Mathieu-Daud=C3=A9?= , Yanan Wang , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Damien Hedde --- 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..94e5f35127 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; } - if (object_class_dynamic_cast(oc, TYPE_SYS_BUS_DEVICE)) { - /* sysbus devices need to be allowed by the machine */ + if (dc->uc_requires_machine_allowance) { + /* some devices need to be allowed by the machine */ MachineClass *mc = MACHINE_CLASS(object_get_class(qdev_get_machine())); - 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; } } From patchwork Wed Mar 30 16:12:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Damien Hedde X-Patchwork-Id: 1611237 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=greensocs.com header.i=@greensocs.com header.a=rsa-sha256 header.s=mail header.b=Sk+369ZY; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KTBPD1brdz9sFk for ; Thu, 31 Mar 2022 03:15:44 +1100 (AEDT) Received: from localhost ([::1]:39334 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZaz0-0003db-5f for incoming@patchwork.ozlabs.org; Wed, 30 Mar 2022 12:15:42 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43712) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZavm-0001xI-UE for qemu-devel@nongnu.org; Wed, 30 Mar 2022 12:12:22 -0400 Received: from beetle.greensocs.com ([5.135.226.135]:43328) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZavj-00015u-N3 for qemu-devel@nongnu.org; Wed, 30 Mar 2022 12:12:22 -0400 Received: from crumble.bar.greensocs.com (unknown [172.17.10.6]) by beetle.greensocs.com (Postfix) with ESMTPS id 19ACF21CC1; Wed, 30 Mar 2022 16:12:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greensocs.com; s=mail; t=1648656738; 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=da5tG5/uo9U7uhUjFWYie79x+/a1q098bxeDSc86H54=; b=Sk+369ZYQkSDbRcdxzRNPcTV7EOkx6nfNBuEUOoA2OGAL8cAcW7dsOd8axd0nHZdw3VjMu joWuocXUomeMUxN8poXI6P0nNnmv04+KFo3M1W8cazk7uzdECGQxOGSbUx1PsVzFOw4ODX LsOHyHL+ujiTZhrXm9adhkq6s5R+EKY= From: Damien Hedde To: qemu-devel@nongnu.org Subject: [PATCH 4/5] rename machine_class_allow_dynamic_sysbus_dev Date: Wed, 30 Mar 2022 18:12:14 +0200 Message-Id: <20220330161215.235231-5-damien.hedde@greensocs.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220330161215.235231-1-damien.hedde@greensocs.com> References: <20220330161215.235231-1-damien.hedde@greensocs.com> MIME-Version: 1.0 X-Spam: Yes 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_P=2E_Berrang=C3=A9?= , =?utf-8?q?Phil?= =?utf-8?q?ippe_Mathieu-Daud=C3=A9?= , Yanan Wang , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" All callsite are updated to the new function name "machine_class_allow_dynamic_device" Signed-off-by: Damien Hedde Reviewed-by: Philippe Mathieu-Daudé --- 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 = 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 = IF_VIRTIO; mc->no_cdrom = 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 *data) MICROVM_MACHINE_AUTO_KERNEL_CMDLINE, "Set off to disable adding virtio-mmio devices to the kernel cmdline"); - machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE); + machine_class_allow_dynamic_device(mc, TYPE_RAMFB_DEVICE); } static const TypeInfo microvm_machine_info = { 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 = "Standard PC (i440FX + PIIX, 1996)"; m->default_machine_opts = "firmware=bios-256k.bin"; m->default_display = "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); } 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 = "std"; m->default_kernel_irqchip_split = false; m->no_floppy = 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 = 288; } 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 = 32; mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("e500v2_v30"); mc->default_ram_id = "mpc8544ds.ram"; - machine_class_allow_dynamic_sysbus_dev(mc, TYPE_ETSEC_COMMON); + machine_class_allow_dynamic_device(mc, TYPE_ETSEC_COMMON); } static const TypeInfo e500plat_info = { 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 = "ppc_spapr.ram"; mc->default_display = "std"; mc->kvm_type = 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 = true; assert(!mc->get_hotplug_handler); mc->get_hotplug_handler = 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 = true; mc->default_ram_id = "riscv_virt_board.ram"; - machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE); + machine_class_allow_dynamic_device(mc, TYPE_RAMFB_DEVICE); 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 = object_get_class(machine); MachineClass *mc = MACHINE_CLASS(oc); - machine_class_allow_dynamic_sysbus_dev(mc, TYPE_XENSYSDEV); + machine_class_allow_dynamic_device(mc, TYPE_XENSYSDEV); } int xen_be_register(const char *type, struct XenDevOps *ops) From patchwork Wed Mar 30 16:12:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Damien Hedde X-Patchwork-Id: 1611241 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=greensocs.com header.i=@greensocs.com header.a=rsa-sha256 header.s=mail header.b=QfHYqpjU; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KTBfg0wkwz9sFt for ; Thu, 31 Mar 2022 03:27:23 +1100 (AEDT) Received: from localhost ([::1]:54966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZbAH-0006C6-25 for incoming@patchwork.ozlabs.org; Wed, 30 Mar 2022 12:27:21 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43734) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZavn-000203-Ox for qemu-devel@nongnu.org; Wed, 30 Mar 2022 12:12:23 -0400 Received: from beetle.greensocs.com ([5.135.226.135]:43352) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZavm-000170-84 for qemu-devel@nongnu.org; Wed, 30 Mar 2022 12:12:23 -0400 Received: from crumble.bar.greensocs.com (unknown [172.17.10.6]) by beetle.greensocs.com (Postfix) with ESMTPS id 724B021EBD; Wed, 30 Mar 2022 16:12:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greensocs.com; s=mail; t=1648656738; 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=zbIDN0VeqBQJkoo/NdrYLZEhaopwl/+A49BtidvkoVA=; b=QfHYqpjUpUVfM/G3Jl7AxiCmnyy6RCsBO7QkH+PfZ9F6uIAPklQs+cmrQYwWGB5qNA5rrq CUCSjUTouAT1bYI5jF0quDFcIYpiqQUf7xakUAjhRmYGI49pX/oHZmxs0sWzK5xKLBomci bR+SbNc8P4RWes+BP0IIAqATWyTrB3k= From: Damien Hedde To: qemu-devel@nongnu.org Subject: [PATCH 5/5] machine: remove temporary inline functions Date: Wed, 30 Mar 2022 18:12:15 +0200 Message-Id: <20220330161215.235231-6-damien.hedde@greensocs.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220330161215.235231-1-damien.hedde@greensocs.com> References: <20220330161215.235231-1-damien.hedde@greensocs.com> MIME-Version: 1.0 X-Spam: Yes 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_P=2E_Berrang=C3=A9?= , =?utf-8?q?Phil?= =?utf-8?q?ippe_Mathieu-Daud=C3=A9?= , Yanan Wang , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Now we have renamed all call to these old functions, we can delete the temporary inline we've defined. Signed-off-by: Damien Hedde Reviewed-by: Philippe Mathieu-Daudé --- include/hw/boards.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index 9ce7d705c9..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); -} /** * device_type_is_dynamic_allowed: Check if type is an allowed device @@ -72,11 +67,6 @@ static inline void machine_class_allow_dynamic_sysbus_dev(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 void device_type_is_dynamic_sysbus(MachineClass *mc, - const char *type) -{ - device_type_is_dynamic_allowed(mc, type); -} /** * device_is_dynamic_sysbus: test whether device is a dynamic sysbus device