From nobody Tue Oct 7 11:03:58 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543933359174271.6969221212888; Tue, 4 Dec 2018 06:22:39 -0800 (PST) Received: from localhost ([::1]:57057 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBav-00059E-Iu for importer@patchew.org; Tue, 04 Dec 2018 09:22:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47377) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBZ3-0004BJ-PX for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:20:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUBZ1-0006jg-Rp for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:20:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52810) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUBZ0-0006jM-66 for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:20:39 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6098030A7B84 for ; Tue, 4 Dec 2018 14:20:37 +0000 (UTC) Received: from localhost (ovpn-112-31.ams2.redhat.com [10.36.112.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 69D4E709EC; Tue, 4 Dec 2018 14:20:33 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 4 Dec 2018 18:20:05 +0400 Message-Id: <20181204142023.15982-2-marcandre.lureau@redhat.com> In-Reply-To: <20181204142023.15982-1-marcandre.lureau@redhat.com> References: <20181204142023.15982-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Tue, 04 Dec 2018 14:20:37 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v5 01/19] tests: qdev_prop_check_globals() doesn't return "all_used" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: imammedo@redhat.com, ehabkost@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Instead, it returns 1 if an error was detected, which is the case for: /qdev/properties/dynamic/global/subprocess: warning: global dynamic-prop-type-bad.prop3 has invalid class name warning: global nohotplug-type.prop5=3D105 not used warning: global nondevice-type.prop6 has invalid class name Clarify the function return value. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Igor Mammedov Reviewed-by: Eduardo Habkost --- tests/test-qdev-global-props.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/test-qdev-global-props.c b/tests/test-qdev-global-props.c index d81b0862d5..ccdf6c57c1 100644 --- a/tests/test-qdev-global-props.c +++ b/tests/test-qdev-global-props.c @@ -214,7 +214,7 @@ static void test_dynamic_globalprop_subprocess(void) { TYPE_NONDEVICE, "prop6", "106", true }, {} }; - int all_used; + int global_error; =20 qdev_prop_register_global_list(props); =20 @@ -223,8 +223,8 @@ static void test_dynamic_globalprop_subprocess(void) =20 g_assert_cmpuint(mt->prop1, =3D=3D, 101); g_assert_cmpuint(mt->prop2, =3D=3D, 102); - all_used =3D qdev_prop_check_globals(); - g_assert_cmpuint(all_used, =3D=3D, 1); + global_error =3D qdev_prop_check_globals(); + g_assert_cmpuint(global_error, =3D=3D, 1); g_assert(props[0].used); g_assert(props[1].used); g_assert(!props[2].used); @@ -259,7 +259,7 @@ static void test_dynamic_globalprop_nouser_subprocess(v= oid) { TYPE_NONDEVICE, "prop6", "106" }, {} }; - int all_used; + int global_error; =20 qdev_prop_register_global_list(props); =20 @@ -268,8 +268,8 @@ static void test_dynamic_globalprop_nouser_subprocess(v= oid) =20 g_assert_cmpuint(mt->prop1, =3D=3D, 101); g_assert_cmpuint(mt->prop2, =3D=3D, 102); - all_used =3D qdev_prop_check_globals(); - g_assert_cmpuint(all_used, =3D=3D, 0); + global_error =3D qdev_prop_check_globals(); + g_assert_cmpuint(global_error, =3D=3D, 0); g_assert(props[0].used); g_assert(props[1].used); g_assert(!props[2].used); --=20 2.20.0.rc1 From nobody Tue Oct 7 11:03:58 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543933560959239.43787497146548; Tue, 4 Dec 2018 06:26:00 -0800 (PST) Received: from localhost ([::1]:57078 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBeB-00081B-7S for importer@patchew.org; Tue, 04 Dec 2018 09:25:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47535) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBZV-0004W0-Ii for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUBZN-0006rI-IT for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:07 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50826) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUBZG-0006nW-TZ; Tue, 04 Dec 2018 09:20:55 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5E97789AE3; Tue, 4 Dec 2018 14:20:53 +0000 (UTC) Received: from localhost (ovpn-112-31.ams2.redhat.com [10.36.112.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 29B1F5C6BF; Tue, 4 Dec 2018 14:20:40 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 4 Dec 2018 18:20:06 +0400 Message-Id: <20181204142023.15982-3-marcandre.lureau@redhat.com> In-Reply-To: <20181204142023.15982-1-marcandre.lureau@redhat.com> References: <20181204142023.15982-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 04 Dec 2018 14:20:53 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v5 02/19] qom: make interface types abstract X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , ehabkost@redhat.com, Corey Minyard , "Michael S. Tsirkin" , "open list:PReP" , "open list:ARM" , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , imammedo@redhat.com, =?UTF-8?q?Andreas=20F=C3=A4rber?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Interfaces don't have instance, let's make the interface type really abstract to avoid confusion. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Igor Mammedov Reviewed-by: Eduardo Habkost --- include/hw/acpi/acpi_dev_interface.h | 6 +----- include/hw/arm/linux-boot-if.h | 5 +---- include/hw/fw-path-provider.h | 4 +--- include/hw/hotplug.h | 6 +----- include/hw/intc/intc.h | 4 +--- include/hw/ipmi/ipmi.h | 4 +--- include/hw/isa/isa.h | 4 ---- include/hw/mem/memory-device.h | 4 +--- include/hw/nmi.h | 4 +--- include/hw/stream.h | 4 +--- include/hw/timer/m48t59.h | 4 +--- include/qom/object_interfaces.h | 6 +----- include/sysemu/tpm.h | 4 +--- target/arm/idau.h | 4 +--- tests/check-qom-interface.c | 4 +--- 15 files changed, 14 insertions(+), 53 deletions(-) diff --git a/include/hw/acpi/acpi_dev_interface.h b/include/hw/acpi/acpi_de= v_interface.h index dabf4c4fc9..43ff119179 100644 --- a/include/hw/acpi/acpi_dev_interface.h +++ b/include/hw/acpi/acpi_dev_interface.h @@ -25,11 +25,7 @@ typedef enum { INTERFACE_CHECK(AcpiDeviceIf, (obj), \ TYPE_ACPI_DEVICE_IF) =20 - -typedef struct AcpiDeviceIf { - /* */ - Object Parent; -} AcpiDeviceIf; +typedef struct AcpiDeviceIf AcpiDeviceIf; =20 void acpi_send_event(DeviceState *dev, AcpiEventStatusBits event); =20 diff --git a/include/hw/arm/linux-boot-if.h b/include/hw/arm/linux-boot-if.h index aba4479a14..7bbdfd1cc6 100644 --- a/include/hw/arm/linux-boot-if.h +++ b/include/hw/arm/linux-boot-if.h @@ -16,10 +16,7 @@ #define ARM_LINUX_BOOT_IF(obj) \ INTERFACE_CHECK(ARMLinuxBootIf, (obj), TYPE_ARM_LINUX_BOOT_IF) =20 -typedef struct ARMLinuxBootIf { - /*< private >*/ - Object parent_obj; -} ARMLinuxBootIf; +typedef struct ARMLinuxBootIf ARMLinuxBootIf; =20 typedef struct ARMLinuxBootIfClass { /*< private >*/ diff --git a/include/hw/fw-path-provider.h b/include/hw/fw-path-provider.h index 050cb05d92..5df893a3d8 100644 --- a/include/hw/fw-path-provider.h +++ b/include/hw/fw-path-provider.h @@ -30,9 +30,7 @@ #define FW_PATH_PROVIDER(obj) \ INTERFACE_CHECK(FWPathProvider, (obj), TYPE_FW_PATH_PROVIDER) =20 -typedef struct FWPathProvider { - Object parent_obj; -} FWPathProvider; +typedef struct FWPathProvider FWPathProvider; =20 typedef struct FWPathProviderClass { InterfaceClass parent_class; diff --git a/include/hw/hotplug.h b/include/hw/hotplug.h index 1a0516a479..6321e292fd 100644 --- a/include/hw/hotplug.h +++ b/include/hw/hotplug.h @@ -23,11 +23,7 @@ #define HOTPLUG_HANDLER(obj) \ INTERFACE_CHECK(HotplugHandler, (obj), TYPE_HOTPLUG_HANDLER) =20 - -typedef struct HotplugHandler { - /* */ - Object Parent; -} HotplugHandler; +typedef struct HotplugHandler HotplugHandler; =20 /** * hotplug_fn: diff --git a/include/hw/intc/intc.h b/include/hw/intc/intc.h index 27d9828943..fb3e8e621f 100644 --- a/include/hw/intc/intc.h +++ b/include/hw/intc/intc.h @@ -15,9 +15,7 @@ INTERFACE_CHECK(InterruptStatsProvider, (obj), \ TYPE_INTERRUPT_STATS_PROVIDER) =20 -typedef struct InterruptStatsProvider { - Object parent; -} InterruptStatsProvider; +typedef struct InterruptStatsProvider InterruptStatsProvider; =20 typedef struct InterruptStatsProviderClass { InterfaceClass parent; diff --git a/include/hw/ipmi/ipmi.h b/include/hw/ipmi/ipmi.h index 0affe5a4d8..99661d2bf0 100644 --- a/include/hw/ipmi/ipmi.h +++ b/include/hw/ipmi/ipmi.h @@ -114,9 +114,7 @@ uint32_t ipmi_next_uuid(void); #define IPMI_INTERFACE_GET_CLASS(class) \ OBJECT_GET_CLASS(IPMIInterfaceClass, (class), TYPE_IPMI_INTERFACE) =20 -typedef struct IPMIInterface { - Object parent; -} IPMIInterface; +typedef struct IPMIInterface IPMIInterface; =20 typedef struct IPMIInterfaceClass { InterfaceClass parent; diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h index b9dbab24b4..e62ac91c19 100644 --- a/include/hw/isa/isa.h +++ b/include/hw/isa/isa.h @@ -43,10 +43,6 @@ static inline uint16_t applesmc_port(void) #define ISADMA(obj) \ INTERFACE_CHECK(IsaDma, (obj), TYPE_ISADMA) =20 -struct IsaDma { - Object parent; -}; - typedef enum { ISADMA_TRANSFER_VERIFY, ISADMA_TRANSFER_READ, diff --git a/include/hw/mem/memory-device.h b/include/hw/mem/memory-device.h index e904e194d5..0293a96abb 100644 --- a/include/hw/mem/memory-device.h +++ b/include/hw/mem/memory-device.h @@ -25,9 +25,7 @@ #define MEMORY_DEVICE(obj) \ INTERFACE_CHECK(MemoryDeviceState, (obj), TYPE_MEMORY_DEVICE) =20 -typedef struct MemoryDeviceState { - Object parent_obj; -} MemoryDeviceState; +typedef struct MemoryDeviceState MemoryDeviceState; =20 /** * MemoryDeviceClass: diff --git a/include/hw/nmi.h b/include/hw/nmi.h index d092c684a1..ad857f3832 100644 --- a/include/hw/nmi.h +++ b/include/hw/nmi.h @@ -34,9 +34,7 @@ #define NMI(obj) \ INTERFACE_CHECK(NMI, (obj), TYPE_NMI) =20 -typedef struct NMIState { - Object parent_obj; -} NMIState; +typedef struct NMIState NMIState; =20 typedef struct NMIClass { InterfaceClass parent_class; diff --git a/include/hw/stream.h b/include/hw/stream.h index c370ba0c66..15774f07ab 100644 --- a/include/hw/stream.h +++ b/include/hw/stream.h @@ -14,9 +14,7 @@ #define STREAM_SLAVE(obj) \ INTERFACE_CHECK(StreamSlave, (obj), TYPE_STREAM_SLAVE) =20 -typedef struct StreamSlave { - Object Parent; -} StreamSlave; +typedef struct StreamSlave StreamSlave; =20 typedef void (*StreamCanPushNotifyFn)(void *opaque); =20 diff --git a/include/hw/timer/m48t59.h b/include/hw/timer/m48t59.h index db5e43a8da..6f8db04fce 100644 --- a/include/hw/timer/m48t59.h +++ b/include/hw/timer/m48t59.h @@ -13,9 +13,7 @@ #define NVRAM(obj) \ INTERFACE_CHECK(Nvram, (obj), TYPE_NVRAM) =20 -typedef struct Nvram { - Object parent; -} Nvram; +typedef struct Nvram Nvram; =20 typedef struct NvramClass { InterfaceClass parent; diff --git a/include/qom/object_interfaces.h b/include/qom/object_interface= s.h index 4d513fb329..652a16d2ba 100644 --- a/include/qom/object_interfaces.h +++ b/include/qom/object_interfaces.h @@ -16,11 +16,7 @@ INTERFACE_CHECK(UserCreatable, (obj), \ TYPE_USER_CREATABLE) =20 - -typedef struct UserCreatable { - /* */ - Object Parent; -} UserCreatable; +typedef struct UserCreatable UserCreatable; =20 /** * UserCreatableClass: diff --git a/include/sysemu/tpm.h b/include/sysemu/tpm.h index 17a97ed77a..5b541a71c8 100644 --- a/include/sysemu/tpm.h +++ b/include/sysemu/tpm.h @@ -33,9 +33,7 @@ typedef enum TPMVersion { #define TPM_IF(obj) \ INTERFACE_CHECK(TPMIf, (obj), TYPE_TPM_IF) =20 -typedef struct TPMIf { - Object parent_obj; -} TPMIf; +typedef struct TPMIf TPMIf; =20 typedef struct TPMIfClass { InterfaceClass parent_class; diff --git a/target/arm/idau.h b/target/arm/idau.h index cac27b95fa..7c0e4e3776 100644 --- a/target/arm/idau.h +++ b/target/arm/idau.h @@ -38,9 +38,7 @@ #define IDAU_INTERFACE_GET_CLASS(obj) \ OBJECT_GET_CLASS(IDAUInterfaceClass, (obj), TYPE_IDAU_INTERFACE) =20 -typedef struct IDAUInterface { - Object parent; -} IDAUInterface; +typedef struct IDAUInterface IDAUInterface; =20 #define IREGION_NOTVALID -1 =20 diff --git a/tests/check-qom-interface.c b/tests/check-qom-interface.c index f87c9aaa8a..2177f0dce5 100644 --- a/tests/check-qom-interface.c +++ b/tests/check-qom-interface.c @@ -23,9 +23,7 @@ #define TEST_IF(obj) \ INTERFACE_CHECK(TestIf, (obj), TYPE_TEST_IF) =20 -typedef struct TestIf { - Object parent_obj; -} TestIf; +typedef struct TestIf TestIf; =20 typedef struct TestIfClass { InterfaceClass parent_class; --=20 2.20.0.rc1 From nobody Tue Oct 7 11:03:58 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543933395906339.35766924260133; Tue, 4 Dec 2018 06:23:15 -0800 (PST) Received: from localhost ([::1]:57058 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBbV-0005bF-On for importer@patchew.org; Tue, 04 Dec 2018 09:23:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47529) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBZS-0004VI-EX for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUBZM-0006qw-Hs for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50916) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUBZM-0006qT-9h for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:00 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 637AA87629; Tue, 4 Dec 2018 14:20:59 +0000 (UTC) Received: from localhost (ovpn-112-31.ams2.redhat.com [10.36.112.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id E56F15C26A; Tue, 4 Dec 2018 14:20:57 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 4 Dec 2018 18:20:07 +0400 Message-Id: <20181204142023.15982-4-marcandre.lureau@redhat.com> In-Reply-To: <20181204142023.15982-1-marcandre.lureau@redhat.com> References: <20181204142023.15982-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 04 Dec 2018 14:20:59 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v5 03/19] qom: make user_creatable_complete() specific to UserCreatable X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ehabkost@redhat.com, Amit Shah , "Michael S. Tsirkin" , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , imammedo@redhat.com, =?UTF-8?q?Andreas=20F=C3=A4rber?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Instead of accepting any Object*, change user_creatable_complete() to require a UserCreatable*. Modify the callers to pass the appropriate argument, removing redundant dynamic cast checks in object creation. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Igor Mammedov Reviewed-by: Eduardo Habkost --- include/qom/object_interfaces.h | 4 ++-- hw/misc/ivshmem.c | 2 +- hw/virtio/virtio-rng.c | 2 +- qom/object.c | 12 ++++++++---- qom/object_interfaces.c | 14 +++----------- 5 files changed, 15 insertions(+), 19 deletions(-) diff --git a/include/qom/object_interfaces.h b/include/qom/object_interface= s.h index 652a16d2ba..682ba1d9b0 100644 --- a/include/qom/object_interfaces.h +++ b/include/qom/object_interfaces.h @@ -51,14 +51,14 @@ typedef struct UserCreatableClass { =20 /** * user_creatable_complete: - * @obj: the object whose complete() method is called if defined + * @uc: the user-creatable object whose complete() method is called if def= ined * @errp: if an error occurs, a pointer to an area to store the error * * Wrapper to call complete() method if one of types it's inherited * from implements USER_CREATABLE interface, otherwise the call does * nothing. */ -void user_creatable_complete(Object *obj, Error **errp); +void user_creatable_complete(UserCreatable *uc, Error **errp); =20 /** * user_creatable_can_be_deleted: diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index ecfd10a29a..8213659602 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -1280,7 +1280,7 @@ static void desugar_shm(IVShmemState *s) object_property_add_child(OBJECT(s), "internal-shm-backend", obj, &error_abort); object_unref(obj); - user_creatable_complete(obj, &error_abort); + user_creatable_complete(USER_CREATABLE(obj), &error_abort); s->hostmem =3D MEMORY_BACKEND(obj); } =20 diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c index 855f1b41d1..30493a2586 100644 --- a/hw/virtio/virtio-rng.c +++ b/hw/virtio/virtio-rng.c @@ -191,7 +191,7 @@ static void virtio_rng_device_realize(DeviceState *dev,= Error **errp) if (vrng->conf.rng =3D=3D NULL) { vrng->conf.default_backend =3D RNG_RANDOM(object_new(TYPE_RNG_RAND= OM)); =20 - user_creatable_complete(OBJECT(vrng->conf.default_backend), + user_creatable_complete(USER_CREATABLE(vrng->conf.default_backend), &local_err); if (local_err) { error_propagate(errp, local_err); diff --git a/qom/object.c b/qom/object.c index 547dcf97c3..eb770dbf7f 100644 --- a/qom/object.c +++ b/qom/object.c @@ -417,6 +417,7 @@ void object_initialize_childv(Object *parentobj, const = char *propname, { Error *local_err =3D NULL; Object *obj; + UserCreatable *uc; =20 object_initialize(childobj, size, type); obj =3D OBJECT(childobj); @@ -431,8 +432,9 @@ void object_initialize_childv(Object *parentobj, const = char *propname, goto out; } =20 - if (object_dynamic_cast(obj, TYPE_USER_CREATABLE)) { - user_creatable_complete(obj, &local_err); + uc =3D (UserCreatable *)object_dynamic_cast(obj, TYPE_USER_CREATABLE); + if (uc) { + user_creatable_complete(uc, &local_err); if (local_err) { object_unparent(obj); goto out; @@ -590,6 +592,7 @@ Object *object_new_with_propv(const char *typename, Object *obj; ObjectClass *klass; Error *local_err =3D NULL; + UserCreatable *uc; =20 klass =3D object_class_by_name(typename); if (!klass) { @@ -612,8 +615,9 @@ Object *object_new_with_propv(const char *typename, goto error; } =20 - if (object_dynamic_cast(obj, TYPE_USER_CREATABLE)) { - user_creatable_complete(obj, &local_err); + uc =3D (UserCreatable *)object_dynamic_cast(obj, TYPE_USER_CREATABLE); + if (uc) { + user_creatable_complete(uc, &local_err); if (local_err) { object_unparent(obj); goto error; diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c index 97b79b48bb..db85d1eb75 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -8,18 +8,10 @@ #include "qapi/opts-visitor.h" #include "qemu/config-file.h" =20 -void user_creatable_complete(Object *obj, Error **errp) +void user_creatable_complete(UserCreatable *uc, Error **errp) { + UserCreatableClass *ucc =3D USER_CREATABLE_GET_CLASS(uc); =20 - UserCreatableClass *ucc; - UserCreatable *uc =3D - (UserCreatable *)object_dynamic_cast(obj, TYPE_USER_CREATABLE); - - if (!uc) { - return; - } - - ucc =3D USER_CREATABLE_GET_CLASS(uc); if (ucc->complete) { ucc->complete(uc, errp); } @@ -89,7 +81,7 @@ Object *user_creatable_add_type(const char *type, const c= har *id, goto out; } =20 - user_creatable_complete(obj, &local_err); + user_creatable_complete(USER_CREATABLE(obj), &local_err); if (local_err) { object_property_del(object_get_objects_root(), id, &error_abort); --=20 2.20.0.rc1 From nobody Tue Oct 7 11:03:58 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543933738253658.7051362048546; Tue, 4 Dec 2018 06:28:58 -0800 (PST) Received: from localhost ([::1]:57098 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBgv-0004ve-4r for importer@patchew.org; Tue, 04 Dec 2018 09:28:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47561) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBZX-0004XR-JL for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUBZW-0006vD-LE for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50166) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUBZW-0006uo-Dj for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:10 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C88BA2D7F3 for ; Tue, 4 Dec 2018 14:21:09 +0000 (UTC) Received: from localhost (ovpn-112-31.ams2.redhat.com [10.36.112.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1667D5B692; Tue, 4 Dec 2018 14:21:02 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 4 Dec 2018 18:20:08 +0400 Message-Id: <20181204142023.15982-5-marcandre.lureau@redhat.com> In-Reply-To: <20181204142023.15982-1-marcandre.lureau@redhat.com> References: <20181204142023.15982-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 04 Dec 2018 14:21:09 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v5 04/19] accel: register global_props like machine globals X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: imammedo@redhat.com, ehabkost@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" global_props is only used for Xen xen_compat_props. It's a static array of GlobalProperty, like machine globals in SET_MACHINE_COMPAT(). Let's register the globals the same way, without extra copy allocation. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Igor Mammedov --- include/hw/qdev-properties.h | 29 ----------------------------- accel/accel.c | 9 ++++++++- hw/core/qdev-properties.c | 21 --------------------- 3 files changed, 8 insertions(+), 51 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 4f60cc88f3..a95f4a73eb 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -255,35 +255,6 @@ void qdev_prop_set_globals(DeviceState *dev); void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *de= v, Property *prop, const char *value); =20 -/** - * register_compat_prop: - * - * Register internal (not user-provided) global property, changing the - * default value of a given property in a device type. This can be used - * for enabling machine-type compatibility or for enabling - * accelerator-specific defaults in devices. - * - * The property values set using this function must be always valid and - * never report setter errors, as the property will have - * GlobalProperty::errp set to &error_abort. - * - * User-provided global properties should override internal global - * properties, so callers of this function should ensure that it is - * called before user-provided global properties are registered. - * - * @driver: Device type to be affected - * @property: Property whose default value is going to be changed - * @value: New default value for the property - */ -void register_compat_prop(const char *driver, const char *property, - const char *value); -/* - * register_compat_props_array(): using register_compat_prop(), which - * only registers internal global properties (which has lower priority - * than user-provided global properties) - */ -void register_compat_props_array(GlobalProperty *prop); - /** * qdev_property_add_static: * @dev: Device to add the property to. diff --git a/accel/accel.c b/accel/accel.c index 966b2d8f53..3da26eb90f 100644 --- a/accel/accel.c +++ b/accel/accel.c @@ -34,6 +34,7 @@ #include "qom/object.h" #include "qemu/error-report.h" #include "qemu/option.h" +#include "qapi/error.h" =20 static const TypeInfo accel_type =3D { .name =3D TYPE_ACCEL, @@ -121,7 +122,13 @@ void configure_accelerator(MachineState *ms) void accel_register_compat_props(AccelState *accel) { AccelClass *class =3D ACCEL_GET_CLASS(accel); - register_compat_props_array(class->global_props); + GlobalProperty *prop =3D class->global_props; + + for (; prop && prop->driver; prop++) { + /* Any compat_props must never cause error */ + prop->errp =3D &error_abort; + qdev_prop_register_global(prop); + } } =20 void accel_setup_post(MachineState *ms) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 35072dec1e..ab61d502fd 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -1180,27 +1180,6 @@ void qdev_prop_register_global(GlobalProperty *prop) global_props =3D g_list_append(global_props, prop); } =20 -void register_compat_prop(const char *driver, - const char *property, - const char *value) -{ - GlobalProperty *p =3D g_new0(GlobalProperty, 1); - - /* Any compat_props must never cause error */ - p->errp =3D &error_abort; - p->driver =3D driver; - p->property =3D property; - p->value =3D value; - qdev_prop_register_global(p); -} - -void register_compat_props_array(GlobalProperty *prop) -{ - for (; prop && prop->driver; prop++) { - register_compat_prop(prop->driver, prop->property, prop->value); - } -} - void qdev_prop_register_global_list(GlobalProperty *props) { int i; --=20 2.20.0.rc1 From nobody Tue Oct 7 11:03:58 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543933921685174.33358169105338; Tue, 4 Dec 2018 06:32:01 -0800 (PST) Received: from localhost ([::1]:57116 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBjz-0007Sd-MJ for importer@patchew.org; Tue, 04 Dec 2018 09:31:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47616) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBZd-0004cc-5E for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUBZc-0006xK-1r for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40364) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUBZb-0006ww-OE for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:15 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BEE392F3D; Tue, 4 Dec 2018 14:21:14 +0000 (UTC) Received: from localhost (ovpn-112-31.ams2.redhat.com [10.36.112.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C84D69117; Tue, 4 Dec 2018 14:21:13 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 4 Dec 2018 18:20:09 +0400 Message-Id: <20181204142023.15982-6-marcandre.lureau@redhat.com> In-Reply-To: <20181204142023.15982-1-marcandre.lureau@redhat.com> References: <20181204142023.15982-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 04 Dec 2018 14:21:14 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v5 05/19] qdev: move qdev_prop_register_global_list() to tests X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: imammedo@redhat.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , ehabkost@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The function is only used by a test, move it there. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Eduardo Habkost Reviewed-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/qdev-properties.h | 1 - hw/core/qdev-properties.c | 9 --------- tests/test-qdev-global-props.c | 18 ++++++++++++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index a95f4a73eb..3ab9cd2eb6 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -249,7 +249,6 @@ void qdev_prop_set_enum(DeviceState *dev, const char *n= ame, int value); void qdev_prop_set_ptr(DeviceState *dev, const char *name, void *value); =20 void qdev_prop_register_global(GlobalProperty *prop); -void qdev_prop_register_global_list(GlobalProperty *props); int qdev_prop_check_globals(void); void qdev_prop_set_globals(DeviceState *dev); void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *de= v, diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index ab61d502fd..bd84c4ea4c 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -1180,15 +1180,6 @@ void qdev_prop_register_global(GlobalProperty *prop) global_props =3D g_list_append(global_props, prop); } =20 -void qdev_prop_register_global_list(GlobalProperty *props) -{ - int i; - - for (i =3D 0; props[i].driver !=3D NULL; i++) { - qdev_prop_register_global(props+i); - } -} - int qdev_prop_check_globals(void) { GList *l; diff --git a/tests/test-qdev-global-props.c b/tests/test-qdev-global-props.c index ccdf6c57c1..b1eb505442 100644 --- a/tests/test-qdev-global-props.c +++ b/tests/test-qdev-global-props.c @@ -89,6 +89,16 @@ static void test_static_prop(void) g_test_trap_assert_stdout(""); } =20 +static void register_global_properties(GlobalProperty *props) +{ + int i; + + for (i =3D 0; props[i].driver !=3D NULL; i++) { + qdev_prop_register_global(props + i); + } +} + + /* Test setting of static property using global properties */ static void test_static_globalprop_subprocess(void) { @@ -98,7 +108,7 @@ static void test_static_globalprop_subprocess(void) {} }; =20 - qdev_prop_register_global_list(props); + register_global_properties(props); =20 mt =3D STATIC_TYPE(object_new(TYPE_STATIC_PROPS)); qdev_init_nofail(DEVICE(mt)); @@ -216,7 +226,7 @@ static void test_dynamic_globalprop_subprocess(void) }; int global_error; =20 - qdev_prop_register_global_list(props); + register_global_properties(props); =20 mt =3D DYNAMIC_TYPE(object_new(TYPE_DYNAMIC_PROPS)); qdev_init_nofail(DEVICE(mt)); @@ -261,7 +271,7 @@ static void test_dynamic_globalprop_nouser_subprocess(v= oid) }; int global_error; =20 - qdev_prop_register_global_list(props); + register_global_properties(props); =20 mt =3D DYNAMIC_TYPE(object_new(TYPE_DYNAMIC_PROPS)); qdev_init_nofail(DEVICE(mt)); @@ -299,7 +309,7 @@ static void test_subclass_global_props(void) {} }; =20 - qdev_prop_register_global_list(props); + register_global_properties(props); =20 mt =3D STATIC_TYPE(object_new(TYPE_SUBCLASS)); qdev_init_nofail(DEVICE(mt)); --=20 2.20.0.rc1 From nobody Tue Oct 7 11:03:58 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543933596841434.30150944780655; Tue, 4 Dec 2018 06:26:36 -0800 (PST) Received: from localhost ([::1]:57082 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBel-0001N0-Cx for importer@patchew.org; Tue, 04 Dec 2018 09:26:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBZi-0004fE-8G for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUBZg-0006zE-Df for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50768) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUBZg-0006z0-6Z for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:20 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7B45B58E42; Tue, 4 Dec 2018 14:21:19 +0000 (UTC) Received: from localhost (ovpn-112-31.ams2.redhat.com [10.36.112.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 67C721001944; Tue, 4 Dec 2018 14:21:17 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 4 Dec 2018 18:20:10 +0400 Message-Id: <20181204142023.15982-7-marcandre.lureau@redhat.com> In-Reply-To: <20181204142023.15982-1-marcandre.lureau@redhat.com> References: <20181204142023.15982-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 04 Dec 2018 14:21:19 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v5 06/19] qom: remove unimplemented class_finalize X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: imammedo@redhat.com, =?UTF-8?q?Andreas=20F=C3=A4rber?= , ehabkost@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Instead of trying to implement something that isn't well specified, remove it. (it would be tricky to implement, since a class struct is memcpy on children types...) Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Igor Mammedov Reviewed-by: Eduardo Habkost --- include/qom/object.h | 7 ++----- hw/core/machine.c | 11 ----------- qom/object.c | 2 -- 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index f0b0bf39cc..0139838b69 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -455,10 +455,8 @@ struct Object * parent class initialization has occurred, but before the class itself * is initialized. This is the function to use to undo the effects of * memcpy from the parent class to the descendants. - * @class_finalize: This function is called during class destruction and is - * meant to release and dynamic parameters allocated by @class_init. - * @class_data: Data to pass to the @class_init, @class_base_init and - * @class_finalize functions. This can be useful when building dynamic + * @class_data: Data to pass to the @class_init, + * @class_base_init. This can be useful when building dynamic * classes. * @interfaces: The list of interfaces associated with this type. This * should point to a static array that's terminated with a zero filled @@ -479,7 +477,6 @@ struct TypeInfo =20 void (*class_init)(ObjectClass *klass, void *data); void (*class_base_init)(ObjectClass *klass, void *data); - void (*class_finalize)(ObjectClass *klass, void *data); void *class_data; =20 InterfaceInfo *interfaces; diff --git a/hw/core/machine.c b/hw/core/machine.c index da50ad6de7..c51423b647 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -834,16 +834,6 @@ void machine_run_board_init(MachineState *machine) machine_class->init(machine); } =20 -static void machine_class_finalize(ObjectClass *klass, void *data) -{ - MachineClass *mc =3D MACHINE_CLASS(klass); - - if (mc->compat_props) { - g_array_free(mc->compat_props, true); - } - g_free(mc->name); -} - void machine_register_compat_props(MachineState *machine) { MachineClass *mc =3D MACHINE_GET_CLASS(machine); @@ -869,7 +859,6 @@ static const TypeInfo machine_info =3D { .class_size =3D sizeof(MachineClass), .class_init =3D machine_class_init, .class_base_init =3D machine_class_base_init, - .class_finalize =3D machine_class_finalize, .instance_size =3D sizeof(MachineState), .instance_init =3D machine_initfn, .instance_finalize =3D machine_finalize, diff --git a/qom/object.c b/qom/object.c index eb770dbf7f..17921c0a71 100644 --- a/qom/object.c +++ b/qom/object.c @@ -49,7 +49,6 @@ struct TypeImpl =20 void (*class_init)(ObjectClass *klass, void *data); void (*class_base_init)(ObjectClass *klass, void *data); - void (*class_finalize)(ObjectClass *klass, void *data); =20 void *class_data; =20 @@ -114,7 +113,6 @@ static TypeImpl *type_new(const TypeInfo *info) =20 ti->class_init =3D info->class_init; ti->class_base_init =3D info->class_base_init; - ti->class_finalize =3D info->class_finalize; ti->class_data =3D info->class_data; =20 ti->instance_init =3D info->instance_init; --=20 2.20.0.rc1 From nobody Tue Oct 7 11:03:58 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543933774462618.2938280574697; Tue, 4 Dec 2018 06:29:34 -0800 (PST) Received: from localhost ([::1]:57099 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBhd-0005f1-7U for importer@patchew.org; Tue, 04 Dec 2018 09:29:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47721) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBZn-0004jR-8I for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUBZm-00072O-06 for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40486) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUBZl-00071v-NF for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:25 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D1C3FB4C0; Tue, 4 Dec 2018 14:21:24 +0000 (UTC) Received: from localhost (ovpn-112-31.ams2.redhat.com [10.36.112.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 226FE6E70E; Tue, 4 Dec 2018 14:21:22 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 4 Dec 2018 18:20:11 +0400 Message-Id: <20181204142023.15982-8-marcandre.lureau@redhat.com> In-Reply-To: <20181204142023.15982-1-marcandre.lureau@redhat.com> References: <20181204142023.15982-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 04 Dec 2018 14:21:25 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v5 07/19] hw: apply accel compat properties without touching globals X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , ehabkost@redhat.com, "open list:X86" , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Anthony Perard , imammedo@redhat.com, =?UTF-8?q?Andreas=20F=C3=A4rber?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Instead of registering compat properties as globals, let's keep them in their own array, to avoid mixing with user globals. Introduce object_apply_global_props() function, to apply compatibility properties from a GPtrArray. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Igor Mammedov --- include/hw/qdev-core.h | 10 ++++++++++ include/qom/object.h | 3 +++ include/sysemu/accel.h | 4 +--- accel/accel.c | 12 ------------ hw/core/qdev.c | 9 +++++++++ hw/xen/xen-common.c | 9 ++++++--- qom/object.c | 25 +++++++++++++++++++++++++ vl.c | 1 - 8 files changed, 54 insertions(+), 19 deletions(-) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index a24d0dd566..aeaa6dbbb8 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -267,6 +267,16 @@ typedef struct GlobalProperty { Error **errp; } GlobalProperty; =20 +static inline void +compat_props_add(GPtrArray *arr, + GlobalProperty props[], size_t nelem) +{ + int i; + for (i =3D 0; i < nelem; i++) { + g_ptr_array_add(arr, (void *)&props[i]); + } +} + /*** Board API. This should go away once we have a machine config file. = ***/ =20 DeviceState *qdev_create(BusState *bus, const char *name); diff --git a/include/qom/object.h b/include/qom/object.h index 0139838b69..5183c587f3 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -676,6 +676,9 @@ Object *object_new_with_propv(const char *typename, Error **errp, va_list vargs); =20 +void object_apply_global_props(Object *obj, const GPtrArray *props, + Error **errp); + /** * object_set_props: * @obj: the object instance to set properties on diff --git a/include/sysemu/accel.h b/include/sysemu/accel.h index 637358f430..f331d128e9 100644 --- a/include/sysemu/accel.h +++ b/include/sysemu/accel.h @@ -49,7 +49,7 @@ typedef struct AccelClass { * global properties may be overridden by machine-type * compat_props or user-provided global properties. */ - GlobalProperty *global_props; + GPtrArray *compat_props; } AccelClass; =20 #define TYPE_ACCEL "accel" @@ -67,8 +67,6 @@ typedef struct AccelClass { extern unsigned long tcg_tb_size; =20 void configure_accelerator(MachineState *ms); -/* Register accelerator specific global properties */ -void accel_register_compat_props(AccelState *accel); /* Called just before os_setup_post (ie just before drop OS privs) */ void accel_setup_post(MachineState *ms); =20 diff --git a/accel/accel.c b/accel/accel.c index 3da26eb90f..6db5d8f4df 100644 --- a/accel/accel.c +++ b/accel/accel.c @@ -119,18 +119,6 @@ void configure_accelerator(MachineState *ms) } } =20 -void accel_register_compat_props(AccelState *accel) -{ - AccelClass *class =3D ACCEL_GET_CLASS(accel); - GlobalProperty *prop =3D class->global_props; - - for (; prop && prop->driver; prop++) { - /* Any compat_props must never cause error */ - prop->errp =3D &error_abort; - qdev_prop_register_global(prop); - } -} - void accel_setup_post(MachineState *ms) { AccelState *accel =3D ms->accelerator; diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 6b3cc55b27..53b507164f 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -972,6 +972,15 @@ static void device_initfn(Object *obj) =20 static void device_post_init(Object *obj) { + if (object_dynamic_cast(qdev_get_machine(), TYPE_MACHINE)) { + MachineState *m =3D MACHINE(qdev_get_machine()); + AccelClass *ac =3D ACCEL_GET_CLASS(m->accelerator); + + if (ac->compat_props) { + object_apply_global_props(obj, ac->compat_props, &error_abort); + } + } + qdev_prop_set_globals(DEVICE(obj)); } =20 diff --git a/hw/xen/xen-common.c b/hw/xen/xen-common.c index 6ec14c73ca..4532aa8632 100644 --- a/hw/xen/xen-common.c +++ b/hw/xen/xen-common.c @@ -174,18 +174,21 @@ static GlobalProperty xen_compat_props[] =3D { .driver =3D "migration", .property =3D "send-section-footer", .value =3D "off", - }, - { /* end of list */ }, + } }; =20 static void xen_accel_class_init(ObjectClass *oc, void *data) { AccelClass *ac =3D ACCEL_CLASS(oc); + ac->name =3D "Xen"; ac->init_machine =3D xen_init; ac->setup_post =3D xen_setup_post; ac->allowed =3D &xen_allowed; - ac->global_props =3D xen_compat_props; + ac->compat_props =3D g_ptr_array_new(); + + compat_props_add(ac->compat_props, + xen_compat_props, G_N_ELEMENTS(xen_compat_props)); } =20 #define TYPE_XEN_ACCEL ACCEL_CLASS_NAME("xen") diff --git a/qom/object.c b/qom/object.c index 17921c0a71..dbdab0aead 100644 --- a/qom/object.c +++ b/qom/object.c @@ -370,6 +370,31 @@ static void object_post_init_with_type(Object *obj, Ty= peImpl *ti) } } =20 +void object_apply_global_props(Object *obj, const GPtrArray *props, Error = **errp) +{ + Error *err =3D NULL; + int i; + + if (!props) { + return; + } + + for (i =3D 0; i < props->len; i++) { + GlobalProperty *p =3D g_ptr_array_index(props, i); + + if (object_dynamic_cast(obj, p->driver) =3D=3D NULL) { + continue; + } + p->used =3D true; + object_property_parse(obj, p->value, p->property, &err); + if (err !=3D NULL) { + error_prepend(&err, "can't apply global %s.%s=3D%s: ", + p->driver, p->property, p->value); + error_propagate(errp, err); + } + } +} + static void object_initialize_with_type(void *data, size_t size, TypeImpl = *type) { Object *obj =3D data; diff --git a/vl.c b/vl.c index a5ae5f23d2..88ba658572 100644 --- a/vl.c +++ b/vl.c @@ -2968,7 +2968,6 @@ static void user_register_global_props(void) */ static void register_global_properties(MachineState *ms) { - accel_register_compat_props(ms->accelerator); machine_register_compat_props(ms); user_register_global_props(); } --=20 2.20.0.rc1 From nobody Tue Oct 7 11:03:58 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543934179670899.8491388089191; Tue, 4 Dec 2018 06:36:19 -0800 (PST) Received: from localhost ([::1]:57139 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBo9-0003k0-Em for importer@patchew.org; Tue, 04 Dec 2018 09:36:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47923) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBaD-000546-V8 for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUBa8-0007Fr-QL for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34756) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUBZt-00076H-SN; Tue, 04 Dec 2018 09:21:34 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A0472A403B; Tue, 4 Dec 2018 14:21:31 +0000 (UTC) Received: from localhost (ovpn-112-31.ams2.redhat.com [10.36.112.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7765D648BA; Tue, 4 Dec 2018 14:21:28 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 4 Dec 2018 18:20:12 +0400 Message-Id: <20181204142023.15982-9-marcandre.lureau@redhat.com> In-Reply-To: <20181204142023.15982-1-marcandre.lureau@redhat.com> References: <20181204142023.15982-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 04 Dec 2018 14:21:31 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v5 08/19] hw: apply machine compat properties without touching globals X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Cornelia Huck , ehabkost@redhat.com, "Michael S. Tsirkin" , David Hildenbrand , Christian Borntraeger , "open list:S390" , Paolo Bonzini , "open list:sPAPR" , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , imammedo@redhat.com, David Gibson , "open list:Virt" , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Similarly to accel properties, move compat properties out of globals registration, and apply the machine compat properties during device_post_init(). As suggested during review, populating the arrays can be done directly without resorting to using macros. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/hw/boards.h | 3 +- hw/arm/virt.c | 48 ++- hw/core/machine.c | 19 +- hw/core/qdev.c | 2 + hw/i386/pc_piix.c | 588 +++++++++++++++++++++---------------- hw/i386/pc_q35.c | 70 ++++- hw/ppc/spapr.c | 209 +++++++------ hw/s390x/s390-virtio-ccw.c | 220 +++++++------- vl.c | 1 - 9 files changed, 673 insertions(+), 487 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index f82f28468b..28c2b0af41 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -69,7 +69,6 @@ int machine_kvm_shadow_mem(MachineState *machine); int machine_phandle_start(MachineState *machine); bool machine_dump_guest_core(MachineState *machine); bool machine_mem_merge(MachineState *machine); -void machine_register_compat_props(MachineState *machine); HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine= ); void machine_set_cpu_numa_node(MachineState *machine, const CpuInstanceProperties *props, @@ -191,7 +190,7 @@ struct MachineClass { const char *default_machine_opts; const char *default_boot_order; const char *default_display; - GArray *compat_props; + GPtrArray *compat_props; const char *hw_version; ram_addr_t default_ram_size; const char *default_cpu_type; diff --git a/hw/arm/virt.c b/hw/arm/virt.c index f69e7eb399..530c8ca89d 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1872,8 +1872,9 @@ static void virt_machine_3_1_options(MachineClass *mc) } DEFINE_VIRT_MACHINE_AS_LATEST(3, 1) =20 -#define VIRT_COMPAT_3_0 \ +static GlobalProperty virt_compat_3_0[] =3D { HW_COMPAT_3_0 +}; =20 static void virt_3_0_instance_init(Object *obj) { @@ -1883,12 +1884,14 @@ static void virt_3_0_instance_init(Object *obj) static void virt_machine_3_0_options(MachineClass *mc) { virt_machine_3_1_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_3_0); + compat_props_add(mc->compat_props, + virt_compat_3_0, G_N_ELEMENTS(virt_compat_3_0)); } DEFINE_VIRT_MACHINE(3, 0) =20 -#define VIRT_COMPAT_2_12 \ +static GlobalProperty virt_compat_2_12[] =3D { HW_COMPAT_2_12 +}; =20 static void virt_2_12_instance_init(Object *obj) { @@ -1900,14 +1903,16 @@ static void virt_machine_2_12_options(MachineClass = *mc) VirtMachineClass *vmc =3D VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); =20 virt_machine_3_0_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_12); + compat_props_add(mc->compat_props, + virt_compat_2_12, G_N_ELEMENTS(virt_compat_2_12)); vmc->no_highmem_ecam =3D true; mc->max_cpus =3D 255; } DEFINE_VIRT_MACHINE(2, 12) =20 -#define VIRT_COMPAT_2_11 \ +static GlobalProperty virt_compat_2_11[] =3D { HW_COMPAT_2_11 +}; =20 static void virt_2_11_instance_init(Object *obj) { @@ -1919,13 +1924,15 @@ static void virt_machine_2_11_options(MachineClass = *mc) VirtMachineClass *vmc =3D VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); =20 virt_machine_2_12_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_11); + compat_props_add(mc->compat_props, + virt_compat_2_11, G_N_ELEMENTS(virt_compat_2_11)); vmc->smbios_old_sys_ver =3D true; } DEFINE_VIRT_MACHINE(2, 11) =20 -#define VIRT_COMPAT_2_10 \ +static GlobalProperty virt_compat_2_10[] =3D { HW_COMPAT_2_10 +}; =20 static void virt_2_10_instance_init(Object *obj) { @@ -1935,14 +1942,16 @@ static void virt_2_10_instance_init(Object *obj) static void virt_machine_2_10_options(MachineClass *mc) { virt_machine_2_11_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_10); + compat_props_add(mc->compat_props, + virt_compat_2_10, G_N_ELEMENTS(virt_compat_2_10)); /* before 2.11 we never faulted accesses to bad addresses */ mc->ignore_memory_transaction_failures =3D true; } DEFINE_VIRT_MACHINE(2, 10) =20 -#define VIRT_COMPAT_2_9 \ +static GlobalProperty virt_compat_2_9[] =3D { HW_COMPAT_2_9 +}; =20 static void virt_2_9_instance_init(Object *obj) { @@ -1952,12 +1961,14 @@ static void virt_2_9_instance_init(Object *obj) static void virt_machine_2_9_options(MachineClass *mc) { virt_machine_2_10_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_9); + compat_props_add(mc->compat_props, + virt_compat_2_9, G_N_ELEMENTS(virt_compat_2_9)); } DEFINE_VIRT_MACHINE(2, 9) =20 -#define VIRT_COMPAT_2_8 \ +static GlobalProperty virt_compat_2_8[] =3D { HW_COMPAT_2_8 +}; =20 static void virt_2_8_instance_init(Object *obj) { @@ -1969,7 +1980,8 @@ static void virt_machine_2_8_options(MachineClass *mc) VirtMachineClass *vmc =3D VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); =20 virt_machine_2_9_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_8); + compat_props_add(mc->compat_props, + virt_compat_2_8, G_N_ELEMENTS(virt_compat_2_8)); /* For 2.8 and earlier we falsely claimed in the DT that * our timers were edge-triggered, not level-triggered. */ @@ -1977,8 +1989,9 @@ static void virt_machine_2_8_options(MachineClass *mc) } DEFINE_VIRT_MACHINE(2, 8) =20 -#define VIRT_COMPAT_2_7 \ +static GlobalProperty virt_compat_2_7[] =3D { HW_COMPAT_2_7 +}; =20 static void virt_2_7_instance_init(Object *obj) { @@ -1990,7 +2003,8 @@ static void virt_machine_2_7_options(MachineClass *mc) VirtMachineClass *vmc =3D VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); =20 virt_machine_2_8_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_7); + compat_props_add(mc->compat_props, + virt_compat_2_7, G_N_ELEMENTS(virt_compat_2_7)); /* ITS was introduced with 2.8 */ vmc->no_its =3D true; /* Stick with 1K pages for migration compatibility */ @@ -1998,8 +2012,9 @@ static void virt_machine_2_7_options(MachineClass *mc) } DEFINE_VIRT_MACHINE(2, 7) =20 -#define VIRT_COMPAT_2_6 \ +static GlobalProperty virt_compat_2_6[] =3D { HW_COMPAT_2_6 +}; =20 static void virt_2_6_instance_init(Object *obj) { @@ -2011,7 +2026,8 @@ static void virt_machine_2_6_options(MachineClass *mc) VirtMachineClass *vmc =3D VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); =20 virt_machine_2_7_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_6); + compat_props_add(mc->compat_props, + virt_compat_2_6, G_N_ELEMENTS(virt_compat_2_6)); vmc->disallow_affinity_adjustment =3D true; /* Disable PMU for 2.6 as PMU support was first introduced in 2.7 */ vmc->no_pmu =3D true; diff --git a/hw/core/machine.c b/hw/core/machine.c index c51423b647..6e24924aba 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -647,6 +647,7 @@ static void machine_class_base_init(ObjectClass *oc, vo= id *data) assert(g_str_has_suffix(cname, TYPE_MACHINE_SUFFIX)); mc->name =3D g_strndup(cname, strlen(cname) - strlen(TYPE_MACHINE_SUFFIX)); + mc->compat_props =3D g_ptr_array_new(); } } =20 @@ -834,24 +835,6 @@ void machine_run_board_init(MachineState *machine) machine_class->init(machine); } =20 -void machine_register_compat_props(MachineState *machine) -{ - MachineClass *mc =3D MACHINE_GET_CLASS(machine); - int i; - GlobalProperty *p; - - if (!mc->compat_props) { - return; - } - - for (i =3D 0; i < mc->compat_props->len; i++) { - p =3D g_array_index(mc->compat_props, GlobalProperty *, i); - /* Machine compat_props must never cause errors: */ - p->errp =3D &error_abort; - qdev_prop_register_global(p); - } -} - static const TypeInfo machine_info =3D { .name =3D TYPE_MACHINE, .parent =3D TYPE_OBJECT, diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 53b507164f..d510340bac 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -974,11 +974,13 @@ static void device_post_init(Object *obj) { if (object_dynamic_cast(qdev_get_machine(), TYPE_MACHINE)) { MachineState *m =3D MACHINE(qdev_get_machine()); + MachineClass *mc =3D MACHINE_GET_CLASS(m); AccelClass *ac =3D ACCEL_GET_CLASS(m->accelerator); =20 if (ac->compat_props) { object_apply_global_props(obj, ac->compat_props, &error_abort); } + object_apply_global_props(obj, mc->compat_props, &error_abort); } =20 qdev_prop_set_globals(DEVICE(obj)); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 7092d6d13f..575566e466 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -438,74 +438,112 @@ static void pc_i440fx_3_1_machine_options(MachineCla= ss *m) DEFINE_I440FX_MACHINE(v3_1, "pc-i440fx-3.1", NULL, pc_i440fx_3_1_machine_options); =20 +static GlobalProperty pc_compat_3_0[] =3D { + PC_COMPAT_3_0 +}; + static void pc_i440fx_3_0_machine_options(MachineClass *m) { pc_i440fx_3_1_machine_options(m); m->is_default =3D 0; m->alias =3D NULL; - SET_MACHINE_COMPAT(m, PC_COMPAT_3_0); + + compat_props_add(m->compat_props, + pc_compat_3_0, G_N_ELEMENTS(pc_compat_3_0)); } =20 DEFINE_I440FX_MACHINE(v3_0, "pc-i440fx-3.0", NULL, pc_i440fx_3_0_machine_options); =20 +static GlobalProperty pc_compat_2_12[] =3D { + PC_COMPAT_2_12 +}; + static void pc_i440fx_2_12_machine_options(MachineClass *m) { pc_i440fx_3_0_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_12); + compat_props_add(m->compat_props, + pc_compat_2_12, G_N_ELEMENTS(pc_compat_2_12)); } =20 DEFINE_I440FX_MACHINE(v2_12, "pc-i440fx-2.12", NULL, pc_i440fx_2_12_machine_options); =20 +static GlobalProperty pc_compat_2_11[] =3D { + PC_COMPAT_2_11 +}; + static void pc_i440fx_2_11_machine_options(MachineClass *m) { pc_i440fx_2_12_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_11); + compat_props_add(m->compat_props, + pc_compat_2_11, G_N_ELEMENTS(pc_compat_2_11)); } =20 DEFINE_I440FX_MACHINE(v2_11, "pc-i440fx-2.11", NULL, pc_i440fx_2_11_machine_options); =20 +static GlobalProperty pc_compat_2_10[] =3D { + PC_COMPAT_2_10 +}; + static void pc_i440fx_2_10_machine_options(MachineClass *m) { pc_i440fx_2_11_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_10); + compat_props_add(m->compat_props, + pc_compat_2_10, G_N_ELEMENTS(pc_compat_2_10)); m->auto_enable_numa_with_memhp =3D false; } =20 DEFINE_I440FX_MACHINE(v2_10, "pc-i440fx-2.10", NULL, pc_i440fx_2_10_machine_options); =20 +static GlobalProperty pc_compat_2_9[] =3D { + PC_COMPAT_2_9 +}; + static void pc_i440fx_2_9_machine_options(MachineClass *m) { pc_i440fx_2_10_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_9); + compat_props_add(m->compat_props, + pc_compat_2_9, G_N_ELEMENTS(pc_compat_2_9)); m->numa_auto_assign_ram =3D numa_legacy_auto_assign_ram; } =20 DEFINE_I440FX_MACHINE(v2_9, "pc-i440fx-2.9", NULL, pc_i440fx_2_9_machine_options); =20 +static GlobalProperty pc_compat_2_8[] =3D { + PC_COMPAT_2_8 +}; + static void pc_i440fx_2_8_machine_options(MachineClass *m) { pc_i440fx_2_9_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_8); + compat_props_add(m->compat_props, + pc_compat_2_8, G_N_ELEMENTS(pc_compat_2_8)); } =20 DEFINE_I440FX_MACHINE(v2_8, "pc-i440fx-2.8", NULL, pc_i440fx_2_8_machine_options); =20 +static GlobalProperty pc_compat_2_7[] =3D { + PC_COMPAT_2_7 +}; =20 static void pc_i440fx_2_7_machine_options(MachineClass *m) { pc_i440fx_2_8_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_7); + compat_props_add(m->compat_props, + pc_compat_2_7, G_N_ELEMENTS(pc_compat_2_7)); } =20 DEFINE_I440FX_MACHINE(v2_7, "pc-i440fx-2.7", NULL, pc_i440fx_2_7_machine_options); =20 +static GlobalProperty pc_compat_2_6[] =3D { + PC_COMPAT_2_6 +}; =20 static void pc_i440fx_2_6_machine_options(MachineClass *m) { @@ -513,12 +551,16 @@ static void pc_i440fx_2_6_machine_options(MachineClas= s *m) pc_i440fx_2_7_machine_options(m); pcmc->legacy_cpu_hotplug =3D true; pcmc->linuxboot_dma_enabled =3D false; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_6); + compat_props_add(m->compat_props, + pc_compat_2_6, G_N_ELEMENTS(pc_compat_2_6)); } =20 DEFINE_I440FX_MACHINE(v2_6, "pc-i440fx-2.6", NULL, pc_i440fx_2_6_machine_options); =20 +static GlobalProperty pc_compat_2_5[] =3D { + PC_COMPAT_2_5 +}; =20 static void pc_i440fx_2_5_machine_options(MachineClass *m) { @@ -526,12 +568,16 @@ static void pc_i440fx_2_5_machine_options(MachineClas= s *m) pc_i440fx_2_6_machine_options(m); pcmc->save_tsc_khz =3D false; m->legacy_fw_cfg_order =3D 1; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_5); + compat_props_add(m->compat_props, + pc_compat_2_5, G_N_ELEMENTS(pc_compat_2_5)); } =20 DEFINE_I440FX_MACHINE(v2_5, "pc-i440fx-2.5", NULL, pc_i440fx_2_5_machine_options); =20 +static GlobalProperty pc_compat_2_4[] =3D { + PC_COMPAT_2_4 +}; =20 static void pc_i440fx_2_4_machine_options(MachineClass *m) { @@ -539,36 +585,48 @@ static void pc_i440fx_2_4_machine_options(MachineClas= s *m) pc_i440fx_2_5_machine_options(m); m->hw_version =3D "2.4.0"; pcmc->broken_reserved_end =3D true; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_4); + compat_props_add(m->compat_props, + pc_compat_2_4, G_N_ELEMENTS(pc_compat_2_4)); } =20 DEFINE_I440FX_MACHINE(v2_4, "pc-i440fx-2.4", NULL, - pc_i440fx_2_4_machine_options) + pc_i440fx_2_4_machine_options); =20 +static GlobalProperty pc_compatp_2_3[] =3D { + PC_COMPAT_2_3 +}; =20 static void pc_i440fx_2_3_machine_options(MachineClass *m) { pc_i440fx_2_4_machine_options(m); m->hw_version =3D "2.3.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_3); + compat_props_add(m->compat_props, + pc_compatp_2_3, G_N_ELEMENTS(pc_compatp_2_3)); } =20 DEFINE_I440FX_MACHINE(v2_3, "pc-i440fx-2.3", pc_compat_2_3, pc_i440fx_2_3_machine_options); =20 +static GlobalProperty pc_compatp_2_2[] =3D { + PC_COMPAT_2_2 +}; =20 static void pc_i440fx_2_2_machine_options(MachineClass *m) { PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); pc_i440fx_2_3_machine_options(m); m->hw_version =3D "2.2.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_2); + compat_props_add(m->compat_props, + pc_compatp_2_2, G_N_ELEMENTS(pc_compatp_2_2)); pcmc->rsdp_in_ram =3D false; } =20 DEFINE_I440FX_MACHINE(v2_2, "pc-i440fx-2.2", pc_compat_2_2, pc_i440fx_2_2_machine_options); =20 +static GlobalProperty pc_compatp_2_1[] =3D { + PC_COMPAT_2_1 +}; =20 static void pc_i440fx_2_1_machine_options(MachineClass *m) { @@ -576,7 +634,8 @@ static void pc_i440fx_2_1_machine_options(MachineClass = *m) pc_i440fx_2_2_machine_options(m); m->hw_version =3D "2.1.0"; m->default_display =3D NULL; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_1); + compat_props_add(m->compat_props, + pc_compatp_2_1, G_N_ELEMENTS(pc_compatp_2_1)); pcmc->smbios_uuid_encoded =3D false; pcmc->enforce_aligned_dimm =3D false; } @@ -584,14 +643,17 @@ static void pc_i440fx_2_1_machine_options(MachineClas= s *m) DEFINE_I440FX_MACHINE(v2_1, "pc-i440fx-2.1", pc_compat_2_1, pc_i440fx_2_1_machine_options); =20 - +static GlobalProperty pc_compatp_2_0[] =3D { + PC_COMPAT_2_0 +}; =20 static void pc_i440fx_2_0_machine_options(MachineClass *m) { PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); pc_i440fx_2_1_machine_options(m); m->hw_version =3D "2.0.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_0); + compat_props_add(m->compat_props, + pc_compatp_2_0, G_N_ELEMENTS(pc_compatp_2_0)); pcmc->smbios_legacy_mode =3D true; pcmc->has_reserved_memory =3D false; /* This value depends on the actual DSDT and SSDT compiled into @@ -617,6 +679,9 @@ static void pc_i440fx_2_0_machine_options(MachineClass = *m) DEFINE_I440FX_MACHINE(v2_0, "pc-i440fx-2.0", pc_compat_2_0, pc_i440fx_2_0_machine_options); =20 +static GlobalProperty pc_compatp_1_7[] =3D { + PC_COMPAT_1_7 +}; =20 static void pc_i440fx_1_7_machine_options(MachineClass *m) { @@ -625,7 +690,8 @@ static void pc_i440fx_1_7_machine_options(MachineClass = *m) m->hw_version =3D "1.7.0"; m->default_machine_opts =3D NULL; m->option_rom_has_mr =3D true; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_7); + compat_props_add(m->compat_props, + pc_compatp_1_7, G_N_ELEMENTS(pc_compatp_1_7)); pcmc->smbios_defaults =3D false; pcmc->gigabyte_align =3D false; pcmc->legacy_acpi_table_size =3D 6414; @@ -634,6 +700,9 @@ static void pc_i440fx_1_7_machine_options(MachineClass = *m) DEFINE_I440FX_MACHINE(v1_7, "pc-i440fx-1.7", pc_compat_1_7, pc_i440fx_1_7_machine_options); =20 +static GlobalProperty pc_compatp_1_6[] =3D { + PC_COMPAT_1_6 +}; =20 static void pc_i440fx_1_6_machine_options(MachineClass *m) { @@ -641,368 +710,391 @@ static void pc_i440fx_1_6_machine_options(MachineCl= ass *m) pc_i440fx_1_7_machine_options(m); m->hw_version =3D "1.6.0"; m->rom_file_has_mr =3D false; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_6); + compat_props_add(m->compat_props, + pc_compatp_1_6, G_N_ELEMENTS(pc_compatp_1_6)); pcmc->has_acpi_build =3D false; } =20 DEFINE_I440FX_MACHINE(v1_6, "pc-i440fx-1.6", pc_compat_1_6, pc_i440fx_1_6_machine_options); =20 +static GlobalProperty pc_compatp_1_5[] =3D { + PC_COMPAT_1_5 +}; =20 static void pc_i440fx_1_5_machine_options(MachineClass *m) { pc_i440fx_1_6_machine_options(m); m->hw_version =3D "1.5.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_5); + compat_props_add(m->compat_props, + pc_compatp_1_5, G_N_ELEMENTS(pc_compatp_1_5)); } =20 DEFINE_I440FX_MACHINE(v1_5, "pc-i440fx-1.5", pc_compat_1_5, pc_i440fx_1_5_machine_options); =20 +static GlobalProperty pc_compatp_1_4[] =3D { + PC_COMPAT_1_4 +}; =20 static void pc_i440fx_1_4_machine_options(MachineClass *m) { pc_i440fx_1_5_machine_options(m); m->hw_version =3D "1.4.0"; m->hot_add_cpu =3D NULL; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_4); + compat_props_add(m->compat_props, + pc_compatp_1_4, G_N_ELEMENTS(pc_compatp_1_4)); } =20 DEFINE_I440FX_MACHINE(v1_4, "pc-i440fx-1.4", pc_compat_1_4, pc_i440fx_1_4_machine_options); =20 - -#define PC_COMPAT_1_3 \ - PC_CPU_MODEL_IDS("1.3.0") \ - {\ - .driver =3D "usb-tablet",\ - .property =3D "usb_version",\ - .value =3D stringify(1),\ - },{\ - .driver =3D "virtio-net-pci",\ - .property =3D "ctrl_mac_addr",\ - .value =3D "off", \ - },{ \ - .driver =3D "virtio-net-pci", \ - .property =3D "mq", \ - .value =3D "off", \ - }, {\ - .driver =3D "e1000",\ - .property =3D "autonegotiation",\ - .value =3D "off",\ - }, - +static GlobalProperty pc_compatp_1_3[] =3D { + PC_CPU_MODEL_IDS("1.3.0") + { + .driver =3D "usb-tablet", + .property =3D "usb_version", + .value =3D stringify(1), + },{ + .driver =3D "virtio-net-pci", + .property =3D "ctrl_mac_addr", + .value =3D "off", + },{ + .driver =3D "virtio-net-pci", + .property =3D "mq", + .value =3D "off", + }, { + .driver =3D "e1000", + .property =3D "autonegotiation", + .value =3D "off", + }, +}; =20 static void pc_i440fx_1_3_machine_options(MachineClass *m) { pc_i440fx_1_4_machine_options(m); m->hw_version =3D "1.3.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_3); + compat_props_add(m->compat_props, + pc_compatp_1_3, G_N_ELEMENTS(pc_compatp_1_3)); } =20 DEFINE_I440FX_MACHINE(v1_3, "pc-1.3", pc_compat_1_3, pc_i440fx_1_3_machine_options); =20 =20 -#define PC_COMPAT_1_2 \ - PC_CPU_MODEL_IDS("1.2.0") \ - {\ - .driver =3D "nec-usb-xhci",\ - .property =3D "msi",\ - .value =3D "off",\ - },{\ - .driver =3D "nec-usb-xhci",\ - .property =3D "msix",\ - .value =3D "off",\ - },{\ - .driver =3D "ivshmem",\ - .property =3D "use64",\ - .value =3D "0",\ - },{\ - .driver =3D "qxl",\ - .property =3D "revision",\ - .value =3D stringify(3),\ - },{\ - .driver =3D "qxl-vga",\ - .property =3D "revision",\ - .value =3D stringify(3),\ - },{\ - .driver =3D "VGA",\ - .property =3D "mmio",\ - .value =3D "off",\ - }, +static GlobalProperty pc_compatp_1_2[] =3D { + PC_CPU_MODEL_IDS("1.2.0") + { + .driver =3D "nec-usb-xhci", + .property =3D "msi", + .value =3D "off", + },{ + .driver =3D "nec-usb-xhci", + .property =3D "msix", + .value =3D "off", + },{ + .driver =3D "ivshmem", + .property =3D "use64", + .value =3D "0", + },{ + .driver =3D "qxl", + .property =3D "revision", + .value =3D stringify(3), + },{ + .driver =3D "qxl-vga", + .property =3D "revision", + .value =3D stringify(3), + },{ + .driver =3D "VGA", + .property =3D "mmio", + .value =3D "off", + }, +}; =20 static void pc_i440fx_1_2_machine_options(MachineClass *m) { pc_i440fx_1_3_machine_options(m); m->hw_version =3D "1.2.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_2); + compat_props_add(m->compat_props, + pc_compatp_1_2, G_N_ELEMENTS(pc_compatp_1_2)); } =20 DEFINE_I440FX_MACHINE(v1_2, "pc-1.2", pc_compat_1_2, pc_i440fx_1_2_machine_options); =20 =20 -#define PC_COMPAT_1_1 \ - PC_CPU_MODEL_IDS("1.1.0") \ - {\ - .driver =3D "virtio-scsi-pci",\ - .property =3D "hotplug",\ - .value =3D "off",\ - },{\ - .driver =3D "virtio-scsi-pci",\ - .property =3D "param_change",\ - .value =3D "off",\ - },{\ - .driver =3D "VGA",\ - .property =3D "vgamem_mb",\ - .value =3D stringify(8),\ - },{\ - .driver =3D "vmware-svga",\ - .property =3D "vgamem_mb",\ - .value =3D stringify(8),\ - },{\ - .driver =3D "qxl-vga",\ - .property =3D "vgamem_mb",\ - .value =3D stringify(8),\ - },{\ - .driver =3D "qxl",\ - .property =3D "vgamem_mb",\ - .value =3D stringify(8),\ - },{\ - .driver =3D "virtio-blk-pci",\ - .property =3D "config-wce",\ - .value =3D "off",\ - }, +static GlobalProperty pc_compatp_1_1[] =3D { + PC_CPU_MODEL_IDS("1.1.0") + { + .driver =3D "virtio-scsi-pci", + .property =3D "hotplug", + .value =3D "off", + },{ + .driver =3D "virtio-scsi-pci", + .property =3D "param_change", + .value =3D "off", + },{ + .driver =3D "VGA", + .property =3D "vgamem_mb", + .value =3D stringify(8), + },{ + .driver =3D "vmware-svga", + .property =3D "vgamem_mb", + .value =3D stringify(8), + },{ + .driver =3D "qxl-vga", + .property =3D "vgamem_mb", + .value =3D stringify(8), + },{ + .driver =3D "qxl", + .property =3D "vgamem_mb", + .value =3D stringify(8), + },{ + .driver =3D "virtio-blk-pci", + .property =3D "config-wce", + .value =3D "off", + }, +}; =20 static void pc_i440fx_1_1_machine_options(MachineClass *m) { pc_i440fx_1_2_machine_options(m); m->hw_version =3D "1.1.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_1); + compat_props_add(m->compat_props, + pc_compatp_1_1, G_N_ELEMENTS(pc_compatp_1_1)); } =20 DEFINE_I440FX_MACHINE(v1_1, "pc-1.1", pc_compat_1_2, pc_i440fx_1_1_machine_options); =20 - -#define PC_COMPAT_1_0 \ - PC_CPU_MODEL_IDS("1.0") \ - {\ - .driver =3D TYPE_ISA_FDC,\ - .property =3D "check_media_rate",\ - .value =3D "off",\ - }, {\ - .driver =3D "virtio-balloon-pci",\ - .property =3D "class",\ - .value =3D stringify(PCI_CLASS_MEMORY_RAM),\ - },{\ - .driver =3D "apic-common",\ - .property =3D "vapic",\ - .value =3D "off",\ - },{\ - .driver =3D TYPE_USB_DEVICE,\ - .property =3D "full-path",\ - .value =3D "no",\ - }, +static GlobalProperty pc_compatp_1_0[] =3D { + PC_CPU_MODEL_IDS("1.0") + { + .driver =3D TYPE_ISA_FDC, + .property =3D "check_media_rate", + .value =3D "off", + },{ + .driver =3D "virtio-balloon-pci", + .property =3D "class", + .value =3D stringify(PCI_CLASS_MEMORY_RAM), + },{ + .driver =3D "apic-common", + .property =3D "vapic", + .value =3D "off", + },{ + .driver =3D TYPE_USB_DEVICE, + .property =3D "full-path", + .value =3D "no", + }, +}; =20 static void pc_i440fx_1_0_machine_options(MachineClass *m) { pc_i440fx_1_1_machine_options(m); m->hw_version =3D "1.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_0); + compat_props_add(m->compat_props, + pc_compatp_1_0, G_N_ELEMENTS(pc_compatp_1_0)); } =20 DEFINE_I440FX_MACHINE(v1_0, "pc-1.0", pc_compat_1_2, pc_i440fx_1_0_machine_options); =20 =20 -#define PC_COMPAT_0_15 \ - PC_CPU_MODEL_IDS("0.15") +static GlobalProperty pc_compatp_0_15[] =3D { + PC_CPU_MODEL_IDS("0.15") +}; =20 static void pc_i440fx_0_15_machine_options(MachineClass *m) { pc_i440fx_1_0_machine_options(m); m->hw_version =3D "0.15"; - SET_MACHINE_COMPAT(m, PC_COMPAT_0_15); + compat_props_add(m->compat_props, + pc_compatp_0_15, G_N_ELEMENTS(pc_compatp_0_15)); } =20 DEFINE_I440FX_MACHINE(v0_15, "pc-0.15", pc_compat_1_2, pc_i440fx_0_15_machine_options); =20 =20 -#define PC_COMPAT_0_14 \ - PC_CPU_MODEL_IDS("0.14") \ - {\ - .driver =3D "virtio-blk-pci",\ - .property =3D "event_idx",\ - .value =3D "off",\ - },{\ - .driver =3D "virtio-serial-pci",\ - .property =3D "event_idx",\ - .value =3D "off",\ - },{\ - .driver =3D "virtio-net-pci",\ - .property =3D "event_idx",\ - .value =3D "off",\ - },{\ - .driver =3D "virtio-balloon-pci",\ - .property =3D "event_idx",\ - .value =3D "off",\ - },{\ - .driver =3D "qxl",\ - .property =3D "revision",\ - .value =3D stringify(2),\ - },{\ - .driver =3D "qxl-vga",\ - .property =3D "revision",\ - .value =3D stringify(2),\ - }, +static GlobalProperty pc_compatp_0_14[] =3D { + PC_CPU_MODEL_IDS("0.14") + { + .driver =3D "virtio-blk-pci", + .property =3D "event_idx", + .value =3D "off", + },{ + .driver =3D "virtio-serial-pci", + .property =3D "event_idx", + .value =3D "off", + },{ + .driver =3D "virtio-net-pci", + .property =3D "event_idx", + .value =3D "off", + },{ + .driver =3D "virtio-balloon-pci", + .property =3D "event_idx", + .value =3D "off", + },{ + .driver =3D "qxl", + .property =3D "revision", + .value =3D stringify(2), + },{ + .driver =3D "qxl-vga", + .property =3D "revision", + .value =3D stringify(2), + }, +}; =20 static void pc_i440fx_0_14_machine_options(MachineClass *m) { pc_i440fx_0_15_machine_options(m); m->hw_version =3D "0.14"; - SET_MACHINE_COMPAT(m, PC_COMPAT_0_14); + compat_props_add(m->compat_props, + pc_compatp_0_14, G_N_ELEMENTS(pc_compatp_0_14)); } =20 DEFINE_I440FX_MACHINE(v0_14, "pc-0.14", pc_compat_1_2, pc_i440fx_0_14_machine_options); =20 - -#define PC_COMPAT_0_13 \ - PC_CPU_MODEL_IDS("0.13") \ - {\ - .driver =3D TYPE_PCI_DEVICE,\ - .property =3D "command_serr_enable",\ - .value =3D "off",\ - },{\ - .driver =3D "AC97",\ - .property =3D "use_broken_id",\ - .value =3D stringify(1),\ - },{\ - .driver =3D "virtio-9p-pci",\ - .property =3D "vectors",\ - .value =3D stringify(0),\ - },{\ - .driver =3D "VGA",\ - .property =3D "rombar",\ - .value =3D stringify(0),\ - },{\ - .driver =3D "vmware-svga",\ - .property =3D "rombar",\ - .value =3D stringify(0),\ - }, +static GlobalProperty pc_compatp_0_13[] =3D { + PC_CPU_MODEL_IDS("0.13") + { + .driver =3D TYPE_PCI_DEVICE, + .property =3D "command_serr_enable", + .value =3D "off", + },{ + .driver =3D "AC97", + .property =3D "use_broken_id", + .value =3D stringify(1), + },{ + .driver =3D "virtio-9p-pci", + .property =3D "vectors", + .value =3D stringify(0), + },{ + .driver =3D "VGA", + .property =3D "rombar", + .value =3D stringify(0), + },{ + .driver =3D "vmware-svga", + .property =3D "rombar", + .value =3D stringify(0), + }, +}; =20 static void pc_i440fx_0_13_machine_options(MachineClass *m) { PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); pc_i440fx_0_14_machine_options(m); m->hw_version =3D "0.13"; - SET_MACHINE_COMPAT(m, PC_COMPAT_0_13); + compat_props_add(m->compat_props, + pc_compatp_0_13, G_N_ELEMENTS(pc_compatp_0_13)); pcmc->kvmclock_enabled =3D false; } =20 DEFINE_I440FX_MACHINE(v0_13, "pc-0.13", pc_compat_0_13, pc_i440fx_0_13_machine_options); =20 - -#define PC_COMPAT_0_12 \ - PC_CPU_MODEL_IDS("0.12") \ - {\ - .driver =3D "virtio-serial-pci",\ - .property =3D "max_ports",\ - .value =3D stringify(1),\ - },{\ - .driver =3D "virtio-serial-pci",\ - .property =3D "vectors",\ - .value =3D stringify(0),\ - },{\ - .driver =3D "usb-mouse",\ - .property =3D "serial",\ - .value =3D "1",\ - },{\ - .driver =3D "usb-tablet",\ - .property =3D "serial",\ - .value =3D "1",\ - },{\ - .driver =3D "usb-kbd",\ - .property =3D "serial",\ - .value =3D "1",\ - }, +static GlobalProperty pc_compat_0_12[] =3D { + PC_CPU_MODEL_IDS("0.12") + { + .driver =3D "virtio-serial-pci", + .property =3D "max_ports", + .value =3D stringify(1), + },{ + .driver =3D "virtio-serial-pci", + .property =3D "vectors", + .value =3D stringify(0), + },{ + .driver =3D "usb-mouse", + .property =3D "serial", + .value =3D "1", + },{ + .driver =3D "usb-tablet", + .property =3D "serial", + .value =3D "1", + },{ + .driver =3D "usb-kbd", + .property =3D "serial", + .value =3D "1", + }, +}; =20 static void pc_i440fx_0_12_machine_options(MachineClass *m) { pc_i440fx_0_13_machine_options(m); m->hw_version =3D "0.12"; - SET_MACHINE_COMPAT(m, PC_COMPAT_0_12); + compat_props_add(m->compat_props, + pc_compat_0_12, G_N_ELEMENTS(pc_compat_0_12)); } =20 DEFINE_I440FX_MACHINE(v0_12, "pc-0.12", pc_compat_0_13, pc_i440fx_0_12_machine_options); =20 =20 -#define PC_COMPAT_0_11 \ - PC_CPU_MODEL_IDS("0.11") \ - {\ - .driver =3D "virtio-blk-pci",\ - .property =3D "vectors",\ - .value =3D stringify(0),\ - },{\ - .driver =3D TYPE_PCI_DEVICE,\ - .property =3D "rombar",\ - .value =3D stringify(0),\ - },{\ - .driver =3D "ide-drive",\ - .property =3D "ver",\ - .value =3D "0.11",\ - },{\ - .driver =3D "scsi-disk",\ - .property =3D "ver",\ - .value =3D "0.11",\ - }, +static GlobalProperty pc_compat_0_11[] =3D { + PC_CPU_MODEL_IDS("0.11") + { + .driver =3D "virtio-blk-pci", + .property =3D "vectors", + .value =3D stringify(0), + },{ + .driver =3D TYPE_PCI_DEVICE, + .property =3D "rombar", + .value =3D stringify(0), + },{ + .driver =3D "ide-drive", + .property =3D "ver", + .value =3D "0.11", + },{ + .driver =3D "scsi-disk", + .property =3D "ver", + .value =3D "0.11", + }, +}; =20 static void pc_i440fx_0_11_machine_options(MachineClass *m) { pc_i440fx_0_12_machine_options(m); m->hw_version =3D "0.11"; m->deprecation_reason =3D "use a newer machine type instead"; - SET_MACHINE_COMPAT(m, PC_COMPAT_0_11); + compat_props_add(m->compat_props, + pc_compat_0_11, G_N_ELEMENTS(pc_compat_0_11)); } =20 DEFINE_I440FX_MACHINE(v0_11, "pc-0.11", pc_compat_0_13, pc_i440fx_0_11_machine_options); =20 - -#define PC_COMPAT_0_10 \ - PC_CPU_MODEL_IDS("0.10") \ - {\ - .driver =3D "virtio-blk-pci",\ - .property =3D "class",\ - .value =3D stringify(PCI_CLASS_STORAGE_OTHER),\ - },{\ - .driver =3D "virtio-serial-pci",\ - .property =3D "class",\ - .value =3D stringify(PCI_CLASS_DISPLAY_OTHER),\ - },{\ - .driver =3D "virtio-net-pci",\ - .property =3D "vectors",\ - .value =3D stringify(0),\ - },{\ - .driver =3D "ide-drive",\ - .property =3D "ver",\ - .value =3D "0.10",\ - },{\ - .driver =3D "scsi-disk",\ - .property =3D "ver",\ - .value =3D "0.10",\ +static GlobalProperty pc_compat_0_10[] =3D { + PC_CPU_MODEL_IDS("0.10") + { + .driver =3D "virtio-blk-pci", + .property =3D "class", + .value =3D stringify(PCI_CLASS_STORAGE_OTHER), + },{ + .driver =3D "virtio-serial-pci", + .property =3D "class", + .value =3D stringify(PCI_CLASS_DISPLAY_OTHER), + },{ + .driver =3D "virtio-net-pci", + .property =3D "vectors", + .value =3D stringify(0), + },{ + .driver =3D "ide-drive", + .property =3D "ver", + .value =3D "0.10", + },{ + .driver =3D "scsi-disk", + .property =3D "ver", + .value =3D "0.10", }, +}; =20 static void pc_i440fx_0_10_machine_options(MachineClass *m) { pc_i440fx_0_11_machine_options(m); m->hw_version =3D "0.10"; - SET_MACHINE_COMPAT(m, PC_COMPAT_0_10); + compat_props_add(m->compat_props, + pc_compat_0_10, G_N_ELEMENTS(pc_compat_0_10)); } =20 DEFINE_I440FX_MACHINE(v0_10, "pc-0.10", pc_compat_0_13, diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 4702bb13c4..701c09b43e 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -320,41 +320,61 @@ static void pc_q35_3_1_machine_options(MachineClass *= m) DEFINE_Q35_MACHINE(v3_1, "pc-q35-3.1", NULL, pc_q35_3_1_machine_options); =20 +static GlobalProperty pc_compat_3_0[] =3D { + PC_COMPAT_3_0 +}; + static void pc_q35_3_0_machine_options(MachineClass *m) { pc_q35_3_1_machine_options(m); m->alias =3D NULL; - SET_MACHINE_COMPAT(m, PC_COMPAT_3_0); + compat_props_add(m->compat_props, + pc_compat_3_0, G_N_ELEMENTS(pc_compat_3_0)); } =20 DEFINE_Q35_MACHINE(v3_0, "pc-q35-3.0", NULL, pc_q35_3_0_machine_options); =20 +static GlobalProperty pc_compat_2_12[] =3D { + PC_COMPAT_2_12 +}; + static void pc_q35_2_12_machine_options(MachineClass *m) { pc_q35_3_0_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_12); + compat_props_add(m->compat_props, + pc_compat_2_12, G_N_ELEMENTS(pc_compat_2_12)); } =20 DEFINE_Q35_MACHINE(v2_12, "pc-q35-2.12", NULL, pc_q35_2_12_machine_options); =20 +static GlobalProperty pc_compat_2_11[] =3D { + PC_COMPAT_2_11 +}; + static void pc_q35_2_11_machine_options(MachineClass *m) { PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); =20 pc_q35_2_12_machine_options(m); pcmc->default_nic_model =3D "e1000"; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_11); + compat_props_add(m->compat_props, + pc_compat_2_11, G_N_ELEMENTS(pc_compat_2_11)); } =20 DEFINE_Q35_MACHINE(v2_11, "pc-q35-2.11", NULL, pc_q35_2_11_machine_options); =20 +static GlobalProperty pc_compat_2_10[] =3D { + PC_COMPAT_2_10 +}; + static void pc_q35_2_10_machine_options(MachineClass *m) { pc_q35_2_11_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_10); + compat_props_add(m->compat_props, + pc_compat_2_10, G_N_ELEMENTS(pc_compat_2_10)); m->numa_auto_assign_ram =3D numa_legacy_auto_assign_ram; m->auto_enable_numa_with_memhp =3D false; } @@ -362,65 +382,95 @@ static void pc_q35_2_10_machine_options(MachineClass = *m) DEFINE_Q35_MACHINE(v2_10, "pc-q35-2.10", NULL, pc_q35_2_10_machine_options); =20 +static GlobalProperty pc_compat_2_9[] =3D { + PC_COMPAT_2_9 +}; + static void pc_q35_2_9_machine_options(MachineClass *m) { pc_q35_2_10_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_9); + compat_props_add(m->compat_props, + pc_compat_2_9, G_N_ELEMENTS(pc_compat_2_9)); } =20 DEFINE_Q35_MACHINE(v2_9, "pc-q35-2.9", NULL, pc_q35_2_9_machine_options); =20 +static GlobalProperty pc_compat_2_8[] =3D { + PC_COMPAT_2_8 +}; + static void pc_q35_2_8_machine_options(MachineClass *m) { pc_q35_2_9_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_8); + compat_props_add(m->compat_props, + pc_compat_2_8, G_N_ELEMENTS(pc_compat_2_8)); } =20 DEFINE_Q35_MACHINE(v2_8, "pc-q35-2.8", NULL, pc_q35_2_8_machine_options); =20 +static GlobalProperty pc_compat_2_7[] =3D { + PC_COMPAT_2_7 +}; + static void pc_q35_2_7_machine_options(MachineClass *m) { pc_q35_2_8_machine_options(m); m->max_cpus =3D 255; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_7); + compat_props_add(m->compat_props, + pc_compat_2_7, G_N_ELEMENTS(pc_compat_2_7)); } =20 DEFINE_Q35_MACHINE(v2_7, "pc-q35-2.7", NULL, pc_q35_2_7_machine_options); =20 +static GlobalProperty pc_compat_2_6[] =3D { + PC_COMPAT_2_6 +}; + static void pc_q35_2_6_machine_options(MachineClass *m) { PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); pc_q35_2_7_machine_options(m); pcmc->legacy_cpu_hotplug =3D true; pcmc->linuxboot_dma_enabled =3D false; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_6); + compat_props_add(m->compat_props, + pc_compat_2_6, G_N_ELEMENTS(pc_compat_2_6)); } =20 DEFINE_Q35_MACHINE(v2_6, "pc-q35-2.6", NULL, pc_q35_2_6_machine_options); =20 +static GlobalProperty pc_compat_2_5[] =3D { + PC_COMPAT_2_5 +}; + static void pc_q35_2_5_machine_options(MachineClass *m) { PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); pc_q35_2_6_machine_options(m); pcmc->save_tsc_khz =3D false; m->legacy_fw_cfg_order =3D 1; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_5); + compat_props_add(m->compat_props, + pc_compat_2_5, G_N_ELEMENTS(pc_compat_2_5)); } =20 DEFINE_Q35_MACHINE(v2_5, "pc-q35-2.5", NULL, pc_q35_2_5_machine_options); =20 +static GlobalProperty pc_compat_2_4[] =3D { + PC_COMPAT_2_4 +}; + static void pc_q35_2_4_machine_options(MachineClass *m) { PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); pc_q35_2_5_machine_options(m); m->hw_version =3D "2.4.0"; pcmc->broken_reserved_end =3D true; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_4); + compat_props_add(m->compat_props, + pc_compat_2_4, G_N_ELEMENTS(pc_compat_2_4)); } =20 DEFINE_Q35_MACHINE(v2_4, "pc-q35-2.4", NULL, diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 7afd1a175b..d801ba71eb 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3973,8 +3973,9 @@ DEFINE_SPAPR_MACHINE(3_1, "3.1", true); /* * pseries-3.0 */ -#define SPAPR_COMPAT_3_0 \ +static GlobalProperty spapr_compat_3_0[] =3D { HW_COMPAT_3_0 +}; =20 static void spapr_machine_3_0_instance_options(MachineState *machine) { @@ -3986,7 +3987,8 @@ static void spapr_machine_3_0_class_options(MachineCl= ass *mc) sPAPRMachineClass *smc =3D SPAPR_MACHINE_CLASS(mc); =20 spapr_machine_3_1_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_3_0); + compat_props_add(mc->compat_props, + spapr_compat_3_0, G_N_ELEMENTS(spapr_compat_3_0)); =20 smc->legacy_irq_allocation =3D true; smc->irq =3D &spapr_irq_xics_legacy; @@ -3997,18 +3999,19 @@ DEFINE_SPAPR_MACHINE(3_0, "3.0", false); /* * pseries-2.12 */ -#define SPAPR_COMPAT_2_12 \ - HW_COMPAT_2_12 \ - { \ - .driver =3D TYPE_POWERPC_CPU, \ - .property =3D "pre-3.0-migration", \ - .value =3D "on", \ - }, \ - { \ - .driver =3D TYPE_SPAPR_CPU_CORE, \ - .property =3D "pre-3.0-migration", \ - .value =3D "on", \ +static GlobalProperty spapr_compat_2_12[] =3D { + HW_COMPAT_2_12 + { + .driver =3D TYPE_POWERPC_CPU, + .property =3D "pre-3.0-migration", + .value =3D "on", + }, + { + .driver =3D TYPE_SPAPR_CPU_CORE, + .property =3D "pre-3.0-migration", + .value =3D "on", }, +}; =20 static void spapr_machine_2_12_instance_options(MachineState *machine) { @@ -4020,7 +4023,8 @@ static void spapr_machine_2_12_class_options(MachineC= lass *mc) sPAPRMachineClass *smc =3D SPAPR_MACHINE_CLASS(mc); =20 spapr_machine_3_0_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_12); + compat_props_add(mc->compat_props, + spapr_compat_2_12, G_N_ELEMENTS(spapr_compat_2_12)); =20 /* We depend on kvm_enabled() to choose a default value for the * hpt-max-page-size capability. Of course we can't do it here @@ -4052,8 +4056,9 @@ DEFINE_SPAPR_MACHINE(2_12_sxxm, "2.12-sxxm", false); /* * pseries-2.11 */ -#define SPAPR_COMPAT_2_11 \ +static GlobalProperty spapr_compat_2_11[] =3D { HW_COMPAT_2_11 +}; =20 static void spapr_machine_2_11_instance_options(MachineState *machine) { @@ -4066,7 +4071,8 @@ static void spapr_machine_2_11_class_options(MachineC= lass *mc) =20 spapr_machine_2_12_class_options(mc); smc->default_caps.caps[SPAPR_CAP_HTM] =3D SPAPR_CAP_ON; - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_11); + compat_props_add(mc->compat_props, + spapr_compat_2_11, G_N_ELEMENTS(spapr_compat_2_11)); } =20 DEFINE_SPAPR_MACHINE(2_11, "2.11", false); @@ -4074,8 +4080,9 @@ DEFINE_SPAPR_MACHINE(2_11, "2.11", false); /* * pseries-2.10 */ -#define SPAPR_COMPAT_2_10 \ +static GlobalProperty spapr_compat_2_10[] =3D { HW_COMPAT_2_10 +}; =20 static void spapr_machine_2_10_instance_options(MachineState *machine) { @@ -4085,7 +4092,8 @@ static void spapr_machine_2_10_instance_options(Machi= neState *machine) static void spapr_machine_2_10_class_options(MachineClass *mc) { spapr_machine_2_11_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_10); + compat_props_add(mc->compat_props, + spapr_compat_2_10, G_N_ELEMENTS(spapr_compat_2_10)); } =20 DEFINE_SPAPR_MACHINE(2_10, "2.10", false); @@ -4093,13 +4101,14 @@ DEFINE_SPAPR_MACHINE(2_10, "2.10", false); /* * pseries-2.9 */ -#define SPAPR_COMPAT_2_9 \ - HW_COMPAT_2_9 \ - { \ - .driver =3D TYPE_POWERPC_CPU, \ - .property =3D "pre-2.10-migration", \ - .value =3D "on", \ - }, \ +static GlobalProperty spapr_compat_2_9[] =3D { + HW_COMPAT_2_9 + { + .driver =3D TYPE_POWERPC_CPU, + .property =3D "pre-2.10-migration", + .value =3D "on", + }, +}; =20 static void spapr_machine_2_9_instance_options(MachineState *machine) { @@ -4111,7 +4120,8 @@ static void spapr_machine_2_9_class_options(MachineCl= ass *mc) sPAPRMachineClass *smc =3D SPAPR_MACHINE_CLASS(mc); =20 spapr_machine_2_10_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_9); + compat_props_add(mc->compat_props, + spapr_compat_2_9, G_N_ELEMENTS(spapr_compat_2_9)); mc->numa_auto_assign_ram =3D numa_legacy_auto_assign_ram; smc->pre_2_10_has_unused_icps =3D true; smc->resize_hpt_default =3D SPAPR_RESIZE_HPT_DISABLED; @@ -4122,13 +4132,14 @@ DEFINE_SPAPR_MACHINE(2_9, "2.9", false); /* * pseries-2.8 */ -#define SPAPR_COMPAT_2_8 \ - HW_COMPAT_2_8 \ - { \ - .driver =3D TYPE_SPAPR_PCI_HOST_BRIDGE, \ - .property =3D "pcie-extended-configuration-space", \ - .value =3D "off", \ +static GlobalProperty spapr_compat_2_8[] =3D { + HW_COMPAT_2_8 + { + .driver =3D TYPE_SPAPR_PCI_HOST_BRIDGE, + .property =3D "pcie-extended-configuration-space", + .value =3D "off", }, +}; =20 static void spapr_machine_2_8_instance_options(MachineState *machine) { @@ -4138,7 +4149,8 @@ static void spapr_machine_2_8_instance_options(Machin= eState *machine) static void spapr_machine_2_8_class_options(MachineClass *mc) { spapr_machine_2_9_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_8); + compat_props_add(mc->compat_props, + spapr_compat_2_8, G_N_ELEMENTS(spapr_compat_2_8)); mc->numa_mem_align_shift =3D 23; } =20 @@ -4147,28 +4159,29 @@ DEFINE_SPAPR_MACHINE(2_8, "2.8", false); /* * pseries-2.7 */ -#define SPAPR_COMPAT_2_7 \ - HW_COMPAT_2_7 \ - { \ - .driver =3D TYPE_SPAPR_PCI_HOST_BRIDGE, \ - .property =3D "mem_win_size", \ - .value =3D stringify(SPAPR_PCI_2_7_MMIO_WIN_SIZE),\ - }, \ - { \ - .driver =3D TYPE_SPAPR_PCI_HOST_BRIDGE, \ - .property =3D "mem64_win_size", \ - .value =3D "0", \ - }, \ - { \ - .driver =3D TYPE_POWERPC_CPU, \ - .property =3D "pre-2.8-migration", \ - .value =3D "on", \ - }, \ - { \ - .driver =3D TYPE_SPAPR_PCI_HOST_BRIDGE, \ - .property =3D "pre-2.8-migration", \ - .value =3D "on", \ +static GlobalProperty spapr_compat_2_7[] =3D { + HW_COMPAT_2_7 + { + .driver =3D TYPE_SPAPR_PCI_HOST_BRIDGE, + .property =3D "mem_win_size", + .value =3D stringify(SPAPR_PCI_2_7_MMIO_WIN_SIZE), + }, + { + .driver =3D TYPE_SPAPR_PCI_HOST_BRIDGE, + .property =3D "mem64_win_size", + .value =3D "0", + }, + { + .driver =3D TYPE_POWERPC_CPU, + .property =3D "pre-2.8-migration", + .value =3D "on", + }, + { + .driver =3D TYPE_SPAPR_PCI_HOST_BRIDGE, + .property =3D "pre-2.8-migration", + .value =3D "on", }, +}; =20 static void phb_placement_2_7(sPAPRMachineState *spapr, uint32_t index, uint64_t *buid, hwaddr *pio, @@ -4233,7 +4246,8 @@ static void spapr_machine_2_7_class_options(MachineCl= ass *mc) =20 spapr_machine_2_8_class_options(mc); mc->default_cpu_type =3D POWERPC_CPU_TYPE_NAME("power7_v2.3"); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_7); + compat_props_add(mc->compat_props, + spapr_compat_2_7, G_N_ELEMENTS(spapr_compat_2_7)); smc->phb_placement =3D phb_placement_2_7; } =20 @@ -4242,13 +4256,14 @@ DEFINE_SPAPR_MACHINE(2_7, "2.7", false); /* * pseries-2.6 */ -#define SPAPR_COMPAT_2_6 \ - HW_COMPAT_2_6 \ - { \ - .driver =3D TYPE_SPAPR_PCI_HOST_BRIDGE,\ - .property =3D "ddw",\ - .value =3D stringify(off),\ +static GlobalProperty spapr_compat_2_6[] =3D { + HW_COMPAT_2_6 + { + .driver =3D TYPE_SPAPR_PCI_HOST_BRIDGE, + .property =3D "ddw", + .value =3D stringify(off), }, +}; =20 static void spapr_machine_2_6_instance_options(MachineState *machine) { @@ -4259,7 +4274,8 @@ static void spapr_machine_2_6_class_options(MachineCl= ass *mc) { spapr_machine_2_7_class_options(mc); mc->has_hotpluggable_cpus =3D false; - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_6); + compat_props_add(mc->compat_props, + spapr_compat_2_6, G_N_ELEMENTS(spapr_compat_2_6)); } =20 DEFINE_SPAPR_MACHINE(2_6, "2.6", false); @@ -4267,13 +4283,14 @@ DEFINE_SPAPR_MACHINE(2_6, "2.6", false); /* * pseries-2.5 */ -#define SPAPR_COMPAT_2_5 \ - HW_COMPAT_2_5 \ - { \ - .driver =3D "spapr-vlan", \ - .property =3D "use-rx-buffer-pools", \ - .value =3D "off", \ +static GlobalProperty spapr_compat_2_5[] =3D { + HW_COMPAT_2_5 + { + .driver =3D "spapr-vlan", + .property =3D "use-rx-buffer-pools", + .value =3D "off", }, +}; =20 static void spapr_machine_2_5_instance_options(MachineState *machine) { @@ -4286,7 +4303,8 @@ static void spapr_machine_2_5_class_options(MachineCl= ass *mc) =20 spapr_machine_2_6_class_options(mc); smc->use_ohci_by_default =3D true; - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_5); + compat_props_add(mc->compat_props, + spapr_compat_2_5, G_N_ELEMENTS(spapr_compat_2_5)); } =20 DEFINE_SPAPR_MACHINE(2_5, "2.5", false); @@ -4294,8 +4312,9 @@ DEFINE_SPAPR_MACHINE(2_5, "2.5", false); /* * pseries-2.4 */ -#define SPAPR_COMPAT_2_4 \ - HW_COMPAT_2_4 +static GlobalProperty spapr_compat_2_4[] =3D { + HW_COMPAT_2_4 +}; =20 static void spapr_machine_2_4_instance_options(MachineState *machine) { @@ -4308,7 +4327,8 @@ static void spapr_machine_2_4_class_options(MachineCl= ass *mc) =20 spapr_machine_2_5_class_options(mc); smc->dr_lmb_enabled =3D false; - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_4); + compat_props_add(mc->compat_props, + spapr_compat_2_4, G_N_ELEMENTS(spapr_compat_2_4)); } =20 DEFINE_SPAPR_MACHINE(2_4, "2.4", false); @@ -4316,13 +4336,14 @@ DEFINE_SPAPR_MACHINE(2_4, "2.4", false); /* * pseries-2.3 */ -#define SPAPR_COMPAT_2_3 \ - HW_COMPAT_2_3 \ - {\ - .driver =3D "spapr-pci-host-bridge",\ - .property =3D "dynamic-reconfiguration",\ - .value =3D "off",\ - }, +static GlobalProperty spapr_compat_2_3[] =3D { + HW_COMPAT_2_3 + { + .driver =3D "spapr-pci-host-bridge", + .property =3D "dynamic-reconfiguration", + .value =3D "off", + }, +}; =20 static void spapr_machine_2_3_instance_options(MachineState *machine) { @@ -4332,21 +4353,22 @@ static void spapr_machine_2_3_instance_options(Mach= ineState *machine) static void spapr_machine_2_3_class_options(MachineClass *mc) { spapr_machine_2_4_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_3); + compat_props_add(mc->compat_props, + spapr_compat_2_3, G_N_ELEMENTS(spapr_compat_2_3)); } DEFINE_SPAPR_MACHINE(2_3, "2.3", false); =20 /* * pseries-2.2 */ - -#define SPAPR_COMPAT_2_2 \ - HW_COMPAT_2_2 \ - {\ - .driver =3D TYPE_SPAPR_PCI_HOST_BRIDGE,\ - .property =3D "mem_win_size",\ - .value =3D "0x20000000",\ - }, +static GlobalProperty spapr_compat_2_2[] =3D { + HW_COMPAT_2_2 + { + .driver =3D TYPE_SPAPR_PCI_HOST_BRIDGE, + .property =3D "mem_win_size", + .value =3D "0x20000000", + }, +}; =20 static void spapr_machine_2_2_instance_options(MachineState *machine) { @@ -4357,15 +4379,17 @@ static void spapr_machine_2_2_instance_options(Mach= ineState *machine) static void spapr_machine_2_2_class_options(MachineClass *mc) { spapr_machine_2_3_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_2); + compat_props_add(mc->compat_props, + spapr_compat_2_2, G_N_ELEMENTS(spapr_compat_2_2)); } DEFINE_SPAPR_MACHINE(2_2, "2.2", false); =20 /* * pseries-2.1 */ -#define SPAPR_COMPAT_2_1 \ - HW_COMPAT_2_1 +static GlobalProperty spapr_compat_2_1[] =3D { + HW_COMPAT_2_1 +}; =20 static void spapr_machine_2_1_instance_options(MachineState *machine) { @@ -4375,7 +4399,8 @@ static void spapr_machine_2_1_instance_options(Machin= eState *machine) static void spapr_machine_2_1_class_options(MachineClass *mc) { spapr_machine_2_2_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_1); + compat_props_add(mc->compat_props, + spapr_compat_2_1, G_N_ELEMENTS(spapr_compat_2_1)); } DEFINE_SPAPR_MACHINE(2_1, "2.1", false); =20 diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index a0615a8b35..275cbe5da4 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -651,96 +651,106 @@ bool css_migration_enabled(void) } = \ type_init(ccw_machine_register_##suffix) =20 -#define CCW_COMPAT_3_0 \ - HW_COMPAT_3_0 - -#define CCW_COMPAT_2_12 \ - HW_COMPAT_2_12 - -#define CCW_COMPAT_2_11 \ - HW_COMPAT_2_11 \ - {\ - .driver =3D TYPE_SCLP_EVENT_FACILITY,\ - .property =3D "allow_all_mask_sizes",\ - .value =3D "off",\ - }, - -#define CCW_COMPAT_2_10 \ - HW_COMPAT_2_10 - -#define CCW_COMPAT_2_9 \ - HW_COMPAT_2_9 \ - {\ - .driver =3D TYPE_S390_STATTRIB,\ - .property =3D "migration-enabled",\ - .value =3D "off",\ - }, - -#define CCW_COMPAT_2_8 \ - HW_COMPAT_2_8 \ - {\ - .driver =3D TYPE_S390_FLIC_COMMON,\ - .property =3D "adapter_routes_max_batch",\ - .value =3D "64",\ - }, - -#define CCW_COMPAT_2_7 \ - HW_COMPAT_2_7 - -#define CCW_COMPAT_2_6 \ - HW_COMPAT_2_6 \ - {\ - .driver =3D TYPE_S390_IPL,\ - .property =3D "iplbext_migration",\ - .value =3D "off",\ - }, {\ - .driver =3D TYPE_VIRTUAL_CSS_BRIDGE,\ - .property =3D "css_dev_path",\ - .value =3D "off",\ - }, - -#define CCW_COMPAT_2_5 \ - HW_COMPAT_2_5 - -#define CCW_COMPAT_2_4 \ - HW_COMPAT_2_4 \ - {\ - .driver =3D TYPE_S390_SKEYS,\ - .property =3D "migration-enabled",\ - .value =3D "off",\ - },{\ - .driver =3D "virtio-blk-ccw",\ - .property =3D "max_revision",\ - .value =3D "0",\ - },{\ - .driver =3D "virtio-balloon-ccw",\ - .property =3D "max_revision",\ - .value =3D "0",\ - },{\ - .driver =3D "virtio-serial-ccw",\ - .property =3D "max_revision",\ - .value =3D "0",\ - },{\ - .driver =3D "virtio-9p-ccw",\ - .property =3D "max_revision",\ - .value =3D "0",\ - },{\ - .driver =3D "virtio-rng-ccw",\ - .property =3D "max_revision",\ - .value =3D "0",\ - },{\ - .driver =3D "virtio-net-ccw",\ - .property =3D "max_revision",\ - .value =3D "0",\ - },{\ - .driver =3D "virtio-scsi-ccw",\ - .property =3D "max_revision",\ - .value =3D "0",\ - },{\ - .driver =3D "vhost-scsi-ccw",\ - .property =3D "max_revision",\ - .value =3D "0",\ - }, +static GlobalProperty ccw_compat_3_0[] =3D { + HW_COMPAT_3_0 +}; + +static GlobalProperty ccw_compat_2_12[] =3D { + HW_COMPAT_2_12 +}; + +static GlobalProperty ccw_compat_2_11[] =3D { + HW_COMPAT_2_11 + { + .driver =3D TYPE_SCLP_EVENT_FACILITY, + .property =3D "allow_all_mask_sizes", + .value =3D "off", + }, +}; + +static GlobalProperty ccw_compat_2_10[] =3D { + HW_COMPAT_2_10 +}; + +static GlobalProperty ccw_compat_2_9[] =3D { + HW_COMPAT_2_9 + { + .driver =3D TYPE_S390_STATTRIB, + .property =3D "migration-enabled", + .value =3D "off", + }, +}; + +static GlobalProperty ccw_compat_2_8[] =3D { + HW_COMPAT_2_8 + { + .driver =3D TYPE_S390_FLIC_COMMON, + .property =3D "adapter_routes_max_batch", + .value =3D "64", + }, +}; + +static GlobalProperty ccw_compat_2_7[] =3D { + HW_COMPAT_2_7 +}; + +static GlobalProperty ccw_compat_2_6[] =3D { + HW_COMPAT_2_6 + { + .driver =3D TYPE_S390_IPL, + .property =3D "iplbext_migration", + .value =3D "off", + }, { + .driver =3D TYPE_VIRTUAL_CSS_BRIDGE, + .property =3D "css_dev_path", + .value =3D "off", + }, +}; + +static GlobalProperty ccw_compat_2_5[] =3D { + HW_COMPAT_2_5 +}; + +static GlobalProperty ccw_compat_2_4[] =3D { + HW_COMPAT_2_4 + { + .driver =3D TYPE_S390_SKEYS, + .property =3D "migration-enabled", + .value =3D "off", + },{ + .driver =3D "virtio-blk-ccw", + .property =3D "max_revision", + .value =3D "0", + },{ + .driver =3D "virtio-balloon-ccw", + .property =3D "max_revision", + .value =3D "0", + },{ + .driver =3D "virtio-serial-ccw", + .property =3D "max_revision", + .value =3D "0", + },{ + .driver =3D "virtio-9p-ccw", + .property =3D "max_revision", + .value =3D "0", + },{ + .driver =3D "virtio-rng-ccw", + .property =3D "max_revision", + .value =3D "0", + },{ + .driver =3D "virtio-net-ccw", + .property =3D "max_revision", + .value =3D "0", + },{ + .driver =3D "virtio-scsi-ccw", + .property =3D "max_revision", + .value =3D "0", + },{ + .driver =3D "vhost-scsi-ccw", + .property =3D "max_revision", + .value =3D "0", + }, +}; =20 static void ccw_machine_3_1_instance_options(MachineState *machine) { @@ -762,7 +772,8 @@ static void ccw_machine_3_0_class_options(MachineClass = *mc) =20 s390mc->hpage_1m_allowed =3D false; ccw_machine_3_1_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_3_0); + compat_props_add(mc->compat_props, + ccw_compat_3_0, G_N_ELEMENTS(ccw_compat_3_0)); } DEFINE_CCW_MACHINE(3_0, "3.0", false); =20 @@ -776,7 +787,8 @@ static void ccw_machine_2_12_instance_options(MachineSt= ate *machine) static void ccw_machine_2_12_class_options(MachineClass *mc) { ccw_machine_3_0_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_12); + compat_props_add(mc->compat_props, + ccw_compat_2_12, G_N_ELEMENTS(ccw_compat_2_12)); } DEFINE_CCW_MACHINE(2_12, "2.12", false); =20 @@ -792,7 +804,8 @@ static void ccw_machine_2_11_instance_options(MachineSt= ate *machine) static void ccw_machine_2_11_class_options(MachineClass *mc) { ccw_machine_2_12_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_11); + compat_props_add(mc->compat_props, + ccw_compat_2_11, G_N_ELEMENTS(ccw_compat_2_11)); } DEFINE_CCW_MACHINE(2_11, "2.11", false); =20 @@ -804,7 +817,8 @@ static void ccw_machine_2_10_instance_options(MachineSt= ate *machine) static void ccw_machine_2_10_class_options(MachineClass *mc) { ccw_machine_2_11_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_10); + compat_props_add(mc->compat_props, + ccw_compat_2_10, G_N_ELEMENTS(ccw_compat_2_10)); } DEFINE_CCW_MACHINE(2_10, "2.10", false); =20 @@ -823,7 +837,8 @@ static void ccw_machine_2_9_class_options(MachineClass = *mc) S390CcwMachineClass *s390mc =3D S390_MACHINE_CLASS(mc); =20 ccw_machine_2_10_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_9); + compat_props_add(mc->compat_props, + ccw_compat_2_9, G_N_ELEMENTS(ccw_compat_2_9)); s390mc->css_migration_enabled =3D false; } DEFINE_CCW_MACHINE(2_9, "2.9", false); @@ -836,7 +851,8 @@ static void ccw_machine_2_8_instance_options(MachineSta= te *machine) static void ccw_machine_2_8_class_options(MachineClass *mc) { ccw_machine_2_9_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_8); + compat_props_add(mc->compat_props, + ccw_compat_2_8, G_N_ELEMENTS(ccw_compat_2_8)); } DEFINE_CCW_MACHINE(2_8, "2.8", false); =20 @@ -851,7 +867,8 @@ static void ccw_machine_2_7_class_options(MachineClass = *mc) =20 s390mc->cpu_model_allowed =3D false; ccw_machine_2_8_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_7); + compat_props_add(mc->compat_props, + ccw_compat_2_7, G_N_ELEMENTS(ccw_compat_2_7)); } DEFINE_CCW_MACHINE(2_7, "2.7", false); =20 @@ -866,7 +883,8 @@ static void ccw_machine_2_6_class_options(MachineClass = *mc) =20 s390mc->ri_allowed =3D false; ccw_machine_2_7_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_6); + compat_props_add(mc->compat_props, + ccw_compat_2_6, G_N_ELEMENTS(ccw_compat_2_6)); } DEFINE_CCW_MACHINE(2_6, "2.6", false); =20 @@ -878,7 +896,8 @@ static void ccw_machine_2_5_instance_options(MachineSta= te *machine) static void ccw_machine_2_5_class_options(MachineClass *mc) { ccw_machine_2_6_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_5); + compat_props_add(mc->compat_props, + ccw_compat_2_5, G_N_ELEMENTS(ccw_compat_2_5)); } DEFINE_CCW_MACHINE(2_5, "2.5", false); =20 @@ -890,7 +909,8 @@ static void ccw_machine_2_4_instance_options(MachineSta= te *machine) static void ccw_machine_2_4_class_options(MachineClass *mc) { ccw_machine_2_5_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_4); + compat_props_add(mc->compat_props, + ccw_compat_2_4, G_N_ELEMENTS(ccw_compat_2_4)); } DEFINE_CCW_MACHINE(2_4, "2.4", false); =20 diff --git a/vl.c b/vl.c index 88ba658572..65f0dddb74 100644 --- a/vl.c +++ b/vl.c @@ -2968,7 +2968,6 @@ static void user_register_global_props(void) */ static void register_global_properties(MachineState *ms) { - machine_register_compat_props(ms); user_register_global_props(); } =20 --=20 2.20.0.rc1 From nobody Tue Oct 7 11:03:58 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543934122640823.4324665966955; Tue, 4 Dec 2018 06:35:22 -0800 (PST) Received: from localhost ([::1]:57130 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBnF-00036D-1k for importer@patchew.org; Tue, 04 Dec 2018 09:35:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47836) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBa0-0004sz-EU for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUBZx-00078F-46 for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55490) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUBZw-00077s-UW for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:37 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2CB41C04958C; Tue, 4 Dec 2018 14:21:36 +0000 (UTC) Received: from localhost (ovpn-112-31.ams2.redhat.com [10.36.112.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 448D21001944; Tue, 4 Dec 2018 14:21:34 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 4 Dec 2018 18:20:13 +0400 Message-Id: <20181204142023.15982-10-marcandre.lureau@redhat.com> In-Reply-To: <20181204142023.15982-1-marcandre.lureau@redhat.com> References: <20181204142023.15982-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 04 Dec 2018 14:21:36 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v5 09/19] hw: remove SET_MACHINE_COMPAT X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: imammedo@redhat.com, ehabkost@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" No longer needed. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/hw/boards.h | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index 28c2b0af41..f743d9d4a4 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -287,20 +287,4 @@ struct MachineState { } \ type_init(machine_initfn##_register_types) =20 -#define SET_MACHINE_COMPAT(m, COMPAT) \ - do { \ - int i; \ - static GlobalProperty props[] =3D { \ - COMPAT \ - { /* end of list */ } \ - }; \ - if (!m->compat_props) { \ - m->compat_props =3D g_array_new(false, false, sizeof(void *));= \ - } \ - for (i =3D 0; props[i].driver !=3D NULL; i++) { \ - GlobalProperty *prop =3D &props[i]; \ - g_array_append_val(m->compat_props, prop); \ - } \ - } while (0) - #endif --=20 2.20.0.rc1 From nobody Tue Oct 7 11:03:58 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543933436201155.84314538854176; Tue, 4 Dec 2018 06:23:56 -0800 (PST) Received: from localhost ([::1]:57062 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBcA-00068j-9j for importer@patchew.org; Tue, 04 Dec 2018 09:23:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47858) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBa3-0004xw-RR for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUBa3-0007AL-7g for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40706) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUBa3-0007A7-2P for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:43 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7090C2F3D for ; Tue, 4 Dec 2018 14:21:42 +0000 (UTC) Received: from localhost (ovpn-112-31.ams2.redhat.com [10.36.112.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F49219C7D; Tue, 4 Dec 2018 14:21:39 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 4 Dec 2018 18:20:14 +0400 Message-Id: <20181204142023.15982-11-marcandre.lureau@redhat.com> In-Reply-To: <20181204142023.15982-1-marcandre.lureau@redhat.com> References: <20181204142023.15982-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 04 Dec 2018 14:21:42 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v5 10/19] qdev: make a separate helper function to apply compat properties X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: imammedo@redhat.com, ehabkost@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This will allow to apply compat properties on other objects than QDev easil= y. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/hw/qdev-core.h | 2 ++ hw/core/qdev.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index aeaa6dbbb8..4f9276f3e2 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -422,6 +422,8 @@ const char *qdev_fw_name(DeviceState *dev); =20 Object *qdev_get_machine(void); =20 +void object_apply_compat_props(Object *obj); + /* FIXME: make this a link<> */ void qdev_set_parent_bus(DeviceState *dev, BusState *bus); =20 diff --git a/hw/core/qdev.c b/hw/core/qdev.c index d510340bac..3769a2bccb 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -970,7 +970,7 @@ static void device_initfn(Object *obj) QLIST_INIT(&dev->gpios); } =20 -static void device_post_init(Object *obj) +void object_apply_compat_props(Object *obj) { if (object_dynamic_cast(qdev_get_machine(), TYPE_MACHINE)) { MachineState *m =3D MACHINE(qdev_get_machine()); @@ -982,7 +982,11 @@ static void device_post_init(Object *obj) } object_apply_global_props(obj, mc->compat_props, &error_abort); } +} =20 +static void device_post_init(Object *obj) +{ + object_apply_compat_props(obj); qdev_prop_set_globals(DEVICE(obj)); } =20 --=20 2.20.0.rc1 From nobody Tue Oct 7 11:03:58 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 154393397781951.61655756283096; Tue, 4 Dec 2018 06:32:57 -0800 (PST) Received: from localhost ([::1]:57117 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBku-00084R-E0 for importer@patchew.org; Tue, 04 Dec 2018 09:32:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47921) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBaD-000544-Tv for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUBaA-0007J6-Ui for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55032) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUBaA-0007Gl-KE for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:50 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C824B3081D04 for ; Tue, 4 Dec 2018 14:21:49 +0000 (UTC) Received: from localhost (ovpn-112-31.ams2.redhat.com [10.36.112.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 553195D786; Tue, 4 Dec 2018 14:21:45 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 4 Dec 2018 18:20:15 +0400 Message-Id: <20181204142023.15982-12-marcandre.lureau@redhat.com> In-Reply-To: <20181204142023.15982-1-marcandre.lureau@redhat.com> References: <20181204142023.15982-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Tue, 04 Dec 2018 14:21:49 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v5 11/19] qdev: all globals are now user-provided X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: imammedo@redhat.com, Paolo Bonzini , ehabkost@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" All globals are now either provided via -global or through -cpu features (CPU features are implemented by registering globals). If the global isn't being used, it should warn in either case. We can thus consider that all global_props are "user-provided" globals. No need to track this per-globals anymore. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Igor Mammedov --- include/hw/qdev-core.h | 3 -- hw/core/qdev-properties.c | 4 --- tests/test-qdev-global-props.c | 57 ++++------------------------------ vl.c | 1 - 4 files changed, 6 insertions(+), 59 deletions(-) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 4f9276f3e2..7d25c99a77 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -249,8 +249,6 @@ struct PropertyInfo { =20 /** * GlobalProperty: - * @user_provided: Set to true if property comes from user-provided config - * (command-line or config file). * @used: Set to true if property was used when initializing a device. * @errp: Error destination, used like first argument of error_setg() * in case property setting fails later. If @errp is NULL, we @@ -262,7 +260,6 @@ typedef struct GlobalProperty { const char *driver; const char *property; const char *value; - bool user_provided; bool used; Error **errp; } GlobalProperty; diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index bd84c4ea4c..43c30a57f4 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -1192,9 +1192,6 @@ int qdev_prop_check_globals(void) if (prop->used) { continue; } - if (!prop->user_provided) { - continue; - } oc =3D object_class_by_name(prop->driver); oc =3D object_class_dynamic_cast(oc, TYPE_DEVICE); if (!oc) { @@ -1233,7 +1230,6 @@ void qdev_prop_set_globals(DeviceState *dev) if (!dev->hotplugged && prop->errp) { error_propagate(prop->errp, err); } else { - assert(prop->user_provided); warn_report_err(err); } } diff --git a/tests/test-qdev-global-props.c b/tests/test-qdev-global-props.c index b1eb505442..60231b1372 100644 --- a/tests/test-qdev-global-props.c +++ b/tests/test-qdev-global-props.c @@ -216,12 +216,12 @@ static void test_dynamic_globalprop_subprocess(void) { MyType *mt; static GlobalProperty props[] =3D { - { TYPE_DYNAMIC_PROPS, "prop1", "101", true }, - { TYPE_DYNAMIC_PROPS, "prop2", "102", true }, - { TYPE_DYNAMIC_PROPS"-bad", "prop3", "103", true }, - { TYPE_UNUSED_HOTPLUG, "prop4", "104", true }, - { TYPE_UNUSED_NOHOTPLUG, "prop5", "105", true }, - { TYPE_NONDEVICE, "prop6", "106", true }, + { TYPE_DYNAMIC_PROPS, "prop1", "101", }, + { TYPE_DYNAMIC_PROPS, "prop2", "102", }, + { TYPE_DYNAMIC_PROPS"-bad", "prop3", "103", }, + { TYPE_UNUSED_HOTPLUG, "prop4", "104", }, + { TYPE_UNUSED_NOHOTPLUG, "prop5", "105", }, + { TYPE_NONDEVICE, "prop6", "106", }, {} }; int global_error; @@ -256,46 +256,6 @@ static void test_dynamic_globalprop(void) g_test_trap_assert_stdout(""); } =20 -/* Test setting of dynamic properties using user_provided=3Dfalse properti= es */ -static void test_dynamic_globalprop_nouser_subprocess(void) -{ - MyType *mt; - static GlobalProperty props[] =3D { - { TYPE_DYNAMIC_PROPS, "prop1", "101" }, - { TYPE_DYNAMIC_PROPS, "prop2", "102" }, - { TYPE_DYNAMIC_PROPS"-bad", "prop3", "103" }, - { TYPE_UNUSED_HOTPLUG, "prop4", "104" }, - { TYPE_UNUSED_NOHOTPLUG, "prop5", "105" }, - { TYPE_NONDEVICE, "prop6", "106" }, - {} - }; - int global_error; - - register_global_properties(props); - - mt =3D DYNAMIC_TYPE(object_new(TYPE_DYNAMIC_PROPS)); - qdev_init_nofail(DEVICE(mt)); - - g_assert_cmpuint(mt->prop1, =3D=3D, 101); - g_assert_cmpuint(mt->prop2, =3D=3D, 102); - global_error =3D qdev_prop_check_globals(); - g_assert_cmpuint(global_error, =3D=3D, 0); - g_assert(props[0].used); - g_assert(props[1].used); - g_assert(!props[2].used); - g_assert(!props[3].used); - g_assert(!props[4].used); - g_assert(!props[5].used); -} - -static void test_dynamic_globalprop_nouser(void) -{ - g_test_trap_subprocess("/qdev/properties/dynamic/global/nouser/subproc= ess", 0, 0); - g_test_trap_assert_passed(); - g_test_trap_assert_stderr(""); - g_test_trap_assert_stdout(""); -} - /* Test if global props affecting subclasses are applied in the right orde= r */ static void test_subclass_global_props(void) { @@ -345,11 +305,6 @@ int main(int argc, char **argv) g_test_add_func("/qdev/properties/dynamic/global", test_dynamic_globalprop); =20 - g_test_add_func("/qdev/properties/dynamic/global/nouser/subprocess", - test_dynamic_globalprop_nouser_subprocess); - g_test_add_func("/qdev/properties/dynamic/global/nouser", - test_dynamic_globalprop_nouser); - g_test_add_func("/qdev/properties/global/subclass", test_subclass_global_props); =20 diff --git a/vl.c b/vl.c index 65f0dddb74..dfc100f51a 100644 --- a/vl.c +++ b/vl.c @@ -2936,7 +2936,6 @@ static int global_init_func(void *opaque, QemuOpts *o= pts, Error **errp) g->driver =3D qemu_opt_get(opts, "driver"); g->property =3D qemu_opt_get(opts, "property"); g->value =3D qemu_opt_get(opts, "value"); - g->user_provided =3D true; g->errp =3D &error_fatal; qdev_prop_register_global(g); return 0; --=20 2.20.0.rc1 From nobody Tue Oct 7 11:03:58 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543933538808325.7158469814723; Tue, 4 Dec 2018 06:25:38 -0800 (PST) Received: from localhost ([::1]:57075 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBdp-0007Tx-Fo for importer@patchew.org; Tue, 04 Dec 2018 09:25:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47940) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBaF-00055v-Se for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUBaF-0007Ls-4k for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47782) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUBaE-0007Lf-VA for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:21:55 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 36AB930832E8 for ; Tue, 4 Dec 2018 14:21:54 +0000 (UTC) Received: from localhost (ovpn-112-31.ams2.redhat.com [10.36.112.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3EDCB1077D4C; Tue, 4 Dec 2018 14:21:52 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 4 Dec 2018 18:20:16 +0400 Message-Id: <20181204142023.15982-13-marcandre.lureau@redhat.com> In-Reply-To: <20181204142023.15982-1-marcandre.lureau@redhat.com> References: <20181204142023.15982-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 04 Dec 2018 14:21:54 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v5 12/19] qdev-props: convert global_props to GPtrArray X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: imammedo@redhat.com, ehabkost@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" A step towards being able to call a common function, object_apply_global_props(). Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Igor Mammedov --- hw/core/qdev-properties.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 43c30a57f4..3467e0485c 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -1173,22 +1173,32 @@ void qdev_prop_set_ptr(DeviceState *dev, const char= *name, void *value) *ptr =3D value; } =20 -static GList *global_props; +static GPtrArray *global_props(void) +{ + static GPtrArray *gp; + + if (!gp) { + gp =3D g_ptr_array_new(); + } + + return gp; +} =20 void qdev_prop_register_global(GlobalProperty *prop) { - global_props =3D g_list_append(global_props, prop); + g_ptr_array_add(global_props(), prop); } =20 int qdev_prop_check_globals(void) { - GList *l; - int ret =3D 0; + int i, ret =3D 0; =20 - for (l =3D global_props; l; l =3D l->next) { - GlobalProperty *prop =3D l->data; + for (i =3D 0; i < global_props()->len; i++) { + GlobalProperty *prop; ObjectClass *oc; DeviceClass *dc; + + prop =3D g_ptr_array_index(global_props(), i); if (prop->used) { continue; } @@ -1213,12 +1223,13 @@ int qdev_prop_check_globals(void) =20 void qdev_prop_set_globals(DeviceState *dev) { - GList *l; + int i; =20 - for (l =3D global_props; l; l =3D l->next) { - GlobalProperty *prop =3D l->data; + for (i =3D 0; i < global_props()->len; i++) { + GlobalProperty *prop; Error *err =3D NULL; =20 + prop =3D g_ptr_array_index(global_props(), i); if (object_dynamic_cast(OBJECT(dev), prop->driver) =3D=3D NULL) { continue; } --=20 2.20.0.rc1 From nobody Tue Oct 7 11:03:58 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543933722144652.345731595972; Tue, 4 Dec 2018 06:28:42 -0800 (PST) Received: from localhost ([::1]:57097 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBgm-0004HT-Dm for importer@patchew.org; Tue, 04 Dec 2018 09:28:40 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48008) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBaQ-0005Dh-0h for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:22:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUBaN-0007PU-Bw for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:22:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47848) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUBaN-0007OQ-07 for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:22:03 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4FDF7317FC21; Tue, 4 Dec 2018 14:22:01 +0000 (UTC) Received: from localhost (ovpn-112-31.ams2.redhat.com [10.36.112.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8ADED6F9CC; Tue, 4 Dec 2018 14:21:57 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 4 Dec 2018 18:20:17 +0400 Message-Id: <20181204142023.15982-14-marcandre.lureau@redhat.com> In-Reply-To: <20181204142023.15982-1-marcandre.lureau@redhat.com> References: <20181204142023.15982-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Tue, 04 Dec 2018 14:22:01 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v5 13/19] qdev-props: remove errp from GlobalProperty X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ehabkost@redhat.com, Mark Cave-Ayland , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , imammedo@redhat.com, Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" All qdev_prop_register_global() set &error_fatal for errp, except '-rtc driftfix=3Dslew', which arguably should also use &error_fatal, as otherwise failing to apply the property would only report a warning. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Igor Mammedov --- include/hw/qdev-core.h | 6 ------ hw/core/qdev-properties.c | 4 ++-- qom/cpu.c | 1 - target/i386/cpu.c | 1 - target/sparc/cpu.c | 1 - vl.c | 1 - 6 files changed, 2 insertions(+), 12 deletions(-) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 7d25c99a77..1d4f4aa1f5 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -250,18 +250,12 @@ struct PropertyInfo { /** * GlobalProperty: * @used: Set to true if property was used when initializing a device. - * @errp: Error destination, used like first argument of error_setg() - * in case property setting fails later. If @errp is NULL, we - * print warnings instead of ignoring errors silently. For - * hotplugged devices, errp is always ignored and warnings are - * printed instead. */ typedef struct GlobalProperty { const char *driver; const char *property; const char *value; bool used; - Error **errp; } GlobalProperty; =20 static inline void diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 3467e0485c..a2d25d3d37 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -1238,8 +1238,8 @@ void qdev_prop_set_globals(DeviceState *dev) if (err !=3D NULL) { error_prepend(&err, "can't apply global %s.%s=3D%s: ", prop->driver, prop->property, prop->value); - if (!dev->hotplugged && prop->errp) { - error_propagate(prop->errp, err); + if (!dev->hotplugged) { + error_propagate(&error_fatal, err); } else { warn_report_err(err); } diff --git a/qom/cpu.c b/qom/cpu.c index 9ad1372d57..5442a7323b 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -312,7 +312,6 @@ static void cpu_common_parse_features(const char *typen= ame, char *features, prop->driver =3D typename; prop->property =3D g_strdup(featurestr); prop->value =3D g_strdup(val); - prop->errp =3D &error_fatal; qdev_prop_register_global(prop); } else { error_setg(errp, "Expected key=3Dvalue format, found %s.", diff --git a/target/i386/cpu.c b/target/i386/cpu.c index f81d35e1f9..c687a9b694 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -3568,7 +3568,6 @@ static void x86_cpu_parse_featurestr(const char *type= name, char *features, prop->driver =3D typename; prop->property =3D g_strdup(name); prop->value =3D g_strdup(val); - prop->errp =3D &error_fatal; qdev_prop_register_global(prop); } =20 diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 0f090ece54..4a4445bdf5 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -111,7 +111,6 @@ cpu_add_feat_as_prop(const char *typename, const char *= name, const char *val) prop->driver =3D typename; prop->property =3D g_strdup(name); prop->value =3D g_strdup(val); - prop->errp =3D &error_fatal; qdev_prop_register_global(prop); } =20 diff --git a/vl.c b/vl.c index dfc100f51a..1b25cb3da2 100644 --- a/vl.c +++ b/vl.c @@ -2936,7 +2936,6 @@ static int global_init_func(void *opaque, QemuOpts *o= pts, Error **errp) g->driver =3D qemu_opt_get(opts, "driver"); g->property =3D qemu_opt_get(opts, "property"); g->value =3D qemu_opt_get(opts, "value"); - g->errp =3D &error_fatal; qdev_prop_register_global(g); return 0; } --=20 2.20.0.rc1 From nobody Tue Oct 7 11:03:58 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543934303369627.7246891884483; Tue, 4 Dec 2018 06:38:23 -0800 (PST) Received: from localhost ([::1]:57154 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBq5-0005IS-5v for importer@patchew.org; Tue, 04 Dec 2018 09:38:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48199) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBas-0005ZX-Me for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:22:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUBaq-0007hx-SX for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:22:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49704) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUBao-0007gX-Sr for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:22:31 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 671553082B45; Tue, 4 Dec 2018 14:22:28 +0000 (UTC) Received: from localhost (ovpn-112-31.ams2.redhat.com [10.36.112.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id A656D86BB4; Tue, 4 Dec 2018 14:22:06 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 4 Dec 2018 18:20:18 +0400 Message-Id: <20181204142023.15982-15-marcandre.lureau@redhat.com> In-Reply-To: <20181204142023.15982-1-marcandre.lureau@redhat.com> References: <20181204142023.15982-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Tue, 04 Dec 2018 14:22:28 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v5 14/19] qdev-props: call object_apply_global_props() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: imammedo@redhat.com, ehabkost@redhat.com, =?UTF-8?q?Andreas=20F=C3=A4rber?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" It's now possible to use the common function. Teach object_apply_global_props() to warn if Error argument is NULL. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Igor Mammedov --- hw/core/qdev-properties.c | 24 ++---------------------- qom/object.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index a2d25d3d37..6061090dc2 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -1223,28 +1223,8 @@ int qdev_prop_check_globals(void) =20 void qdev_prop_set_globals(DeviceState *dev) { - int i; - - for (i =3D 0; i < global_props()->len; i++) { - GlobalProperty *prop; - Error *err =3D NULL; - - prop =3D g_ptr_array_index(global_props(), i); - if (object_dynamic_cast(OBJECT(dev), prop->driver) =3D=3D NULL) { - continue; - } - prop->used =3D true; - object_property_parse(OBJECT(dev), prop->value, prop->property, &e= rr); - if (err !=3D NULL) { - error_prepend(&err, "can't apply global %s.%s=3D%s: ", - prop->driver, prop->property, prop->value); - if (!dev->hotplugged) { - error_propagate(&error_fatal, err); - } else { - warn_report_err(err); - } - } - } + object_apply_global_props(OBJECT(dev), global_props(), + dev->hotplugged ? NULL : &error_fatal); } =20 /* --- 64bit unsigned int 'size' type --- */ diff --git a/qom/object.c b/qom/object.c index dbdab0aead..aa6f3a2a71 100644 --- a/qom/object.c +++ b/qom/object.c @@ -390,7 +390,17 @@ void object_apply_global_props(Object *obj, const GPtr= Array *props, Error **errp if (err !=3D NULL) { error_prepend(&err, "can't apply global %s.%s=3D%s: ", p->driver, p->property, p->value); - error_propagate(errp, err); + /* + * If errp !=3D NULL, propagate error and return. + * If errp =3D=3D NULL, report a warning, but keep going + * with the remaining globals. + */ + if (errp) { + error_propagate(errp, err); + return; + } else { + warn_report_err(err); + } } } } --=20 2.20.0.rc1 From nobody Tue Oct 7 11:03:58 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543934434333728.5703628412996; Tue, 4 Dec 2018 06:40:34 -0800 (PST) Received: from localhost ([::1]:57168 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBsH-0006mY-D7 for importer@patchew.org; Tue, 04 Dec 2018 09:40:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48454) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBbJ-0005wf-8s for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:23:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUBbI-00085v-HT for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:23:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45594) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUBbI-00084g-B7 for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:23:00 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A36A0811D7; Tue, 4 Dec 2018 14:22:59 +0000 (UTC) Received: from localhost (ovpn-112-31.ams2.redhat.com [10.36.112.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0BA1B747AD; Tue, 4 Dec 2018 14:22:31 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 4 Dec 2018 18:20:19 +0400 Message-Id: <20181204142023.15982-16-marcandre.lureau@redhat.com> In-Reply-To: <20181204142023.15982-1-marcandre.lureau@redhat.com> References: <20181204142023.15982-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 04 Dec 2018 14:22:59 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v5 15/19] qom: add object_class_get_class_data() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: imammedo@redhat.com, ehabkost@redhat.com, =?UTF-8?q?Andreas=20F=C3=A4rber?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Add a simple function to retrieve the associated class data. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/qom/object.h | 9 +++++++++ qom/object.c | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/include/qom/object.h b/include/qom/object.h index 5183c587f3..d5266405da 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -916,6 +916,15 @@ ObjectClass *object_class_dynamic_cast(ObjectClass *kl= ass, */ ObjectClass *object_class_get_parent(ObjectClass *klass); =20 + +/** + * object_class_get_class_data: + * @klass: The class to obtain associated data. + * + * Returns: the class_data given when registering the type. + */ +void *object_class_get_class_data(ObjectClass *klass); + /** * object_class_get_name: * @klass: The class to obtain the QOM typename for. diff --git a/qom/object.c b/qom/object.c index aa6f3a2a71..bbc6fbbc01 100644 --- a/qom/object.c +++ b/qom/object.c @@ -867,6 +867,11 @@ const char *object_class_get_name(ObjectClass *klass) return klass->type->name; } =20 +void *object_class_get_class_data(ObjectClass *klass) +{ + return klass->type->class_data; +} + ObjectClass *object_class_by_name(const char *typename) { TypeImpl *type =3D type_get_by_name(typename); --=20 2.20.0.rc1 From nobody Tue Oct 7 11:03:58 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543934522509615.5748724215841; Tue, 4 Dec 2018 06:42:02 -0800 (PST) Received: from localhost ([::1]:57190 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBtd-0007oC-T0 for importer@patchew.org; Tue, 04 Dec 2018 09:41:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48561) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBbZ-00068v-QK for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:23:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUBbY-0008MK-Ir for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:23:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48462) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUBbR-0008I0-TX; Tue, 04 Dec 2018 09:23:10 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EAEA6308424D; Tue, 4 Dec 2018 14:23:08 +0000 (UTC) Received: from localhost (ovpn-112-31.ams2.redhat.com [10.36.112.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 125FA27C35; Tue, 4 Dec 2018 14:23:02 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 4 Dec 2018 18:20:20 +0400 Message-Id: <20181204142023.15982-17-marcandre.lureau@redhat.com> In-Reply-To: <20181204142023.15982-1-marcandre.lureau@redhat.com> References: <20181204142023.15982-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Tue, 04 Dec 2018 14:23:09 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v5 16/19] RFC: arm: replace instance_post_init() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , imammedo@redhat.com, "open list:ARM" , ehabkost@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Replace arm_cpu_post_init() instance callback by calling it from leaf classes, to avoid potential ordering issue with other post_init callbacks. Note: this patch is no longer needed in this series, since the compat-props interface approach was abandoned. Signed-off-by: Marc-Andr=C3=A9 Lureau Suggested-by: Igor Mammedov Reviewed-by: Igor Mammedov --- target/arm/cpu.h | 2 ++ target/arm/cpu.c | 15 ++++++++++++--- target/arm/cpu64.c | 11 ++++++++++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 2a73fed9a0..84fba2b24b 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -884,6 +884,8 @@ static inline ARMCPU *arm_env_get_cpu(CPUARMState *env) return container_of(env, ARMCPU, env); } =20 +void arm_cpu_post_init(Object *obj); + uint64_t arm_cpu_mp_affinity(int idx, uint8_t clustersz); =20 #define ENV_GET_CPU(e) CPU(arm_env_get_cpu(e)) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 60411f6bfe..8a4aae7438 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -734,7 +734,7 @@ static Property arm_cpu_pmsav7_dregion_property =3D static Property arm_cpu_initsvtor_property =3D DEFINE_PROP_UINT32("init-svtor", ARMCPU, init_svtor, 0); =20 -static void arm_cpu_post_init(Object *obj) +void arm_cpu_post_init(Object *obj) { ARMCPU *cpu =3D ARM_CPU(obj); =20 @@ -2094,6 +2094,7 @@ static void arm_host_initfn(Object *obj) ARMCPU *cpu =3D ARM_CPU(obj); =20 kvm_arm_set_cpu_features_from_host(cpu); + arm_cpu_post_init(ARM_CPU(obj)); } =20 static const TypeInfo host_arm_cpu_type_info =3D { @@ -2108,14 +2109,23 @@ static const TypeInfo host_arm_cpu_type_info =3D { =20 #endif =20 +static void arm_cpu_instance_init(Object *obj) +{ + const ARMCPUInfo *info =3D object_class_get_class_data(object_get_clas= s(obj)); + + info->initfn(obj); + arm_cpu_post_init(obj); +} + static void cpu_register(const ARMCPUInfo *info) { TypeInfo type_info =3D { .parent =3D TYPE_ARM_CPU, .instance_size =3D sizeof(ARMCPU), - .instance_init =3D info->initfn, + .instance_init =3D arm_cpu_instance_init, .class_size =3D sizeof(ARMCPUClass), .class_init =3D info->class_init, + .class_data =3D (void *)info, }; =20 type_info.name =3D g_strdup_printf("%s-" TYPE_ARM_CPU, info->name); @@ -2128,7 +2138,6 @@ static const TypeInfo arm_cpu_type_info =3D { .parent =3D TYPE_CPU, .instance_size =3D sizeof(ARMCPU), .instance_init =3D arm_cpu_initfn, - .instance_post_init =3D arm_cpu_post_init, .instance_finalize =3D arm_cpu_finalizefn, .abstract =3D true, .class_size =3D sizeof(ARMCPUClass), diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 873f059bf2..dbfc3ee490 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -447,14 +447,23 @@ static void aarch64_cpu_class_init(ObjectClass *oc, v= oid *data) cc->gdb_arch_name =3D aarch64_gdb_arch_name; } =20 +static void aarch64_cpu_instance_init(Object *obj) +{ + const ARMCPUInfo *info =3D object_class_get_class_data(object_get_clas= s(obj)); + + info->initfn(obj); + arm_cpu_post_init(obj); +} + static void aarch64_cpu_register(const ARMCPUInfo *info) { TypeInfo type_info =3D { .parent =3D TYPE_AARCH64_CPU, .instance_size =3D sizeof(ARMCPU), - .instance_init =3D info->initfn, + .instance_init =3D aarch64_cpu_instance_init, .class_size =3D sizeof(ARMCPUClass), .class_init =3D info->class_init, + .class_data =3D (void *)info, }; =20 type_info.name =3D g_strdup_printf("%s-" TYPE_ARM_CPU, info->name); --=20 2.20.0.rc1 From nobody Tue Oct 7 11:03:58 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543934394214962.2365590163362; Tue, 4 Dec 2018 06:39:54 -0800 (PST) Received: from localhost ([::1]:57165 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBrU-0006L2-Rj for importer@patchew.org; Tue, 04 Dec 2018 09:39:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBbZ-00068I-3T for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:23:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUBbX-0008M3-Qw for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:23:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55166) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUBbX-0008La-Gg for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:23:15 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 89E0D30BB7CF; Tue, 4 Dec 2018 14:23:14 +0000 (UTC) Received: from localhost (ovpn-112-31.ams2.redhat.com [10.36.112.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id E7EDE842CD; Tue, 4 Dec 2018 14:23:12 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 4 Dec 2018 18:20:21 +0400 Message-Id: <20181204142023.15982-18-marcandre.lureau@redhat.com> In-Reply-To: <20181204142023.15982-1-marcandre.lureau@redhat.com> References: <20181204142023.15982-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Tue, 04 Dec 2018 14:23:14 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v5 17/19] hw/i386: add pc-i440fx-4.0 & pc-q35-4.0 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ehabkost@redhat.com, "Michael S. Tsirkin" , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , imammedo@redhat.com, Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The following patch is going to add compatiblity parameters for qemu <=3D 3.1. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/hw/compat.h | 3 +++ include/hw/i386/pc.h | 3 +++ hw/i386/pc_piix.c | 21 +++++++++++++++++---- hw/i386/pc_q35.c | 18 ++++++++++++++++-- 4 files changed, 39 insertions(+), 6 deletions(-) diff --git a/include/hw/compat.h b/include/hw/compat.h index 6f4d5fc647..70958328fe 100644 --- a/include/hw/compat.h +++ b/include/hw/compat.h @@ -1,6 +1,9 @@ #ifndef HW_COMPAT_H #define HW_COMPAT_H =20 +#define HW_COMPAT_3_1 \ + /* empty */ + #define HW_COMPAT_3_0 \ /* empty */ =20 diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 136fe497b6..c37d4333a0 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -294,6 +294,9 @@ int e820_add_entry(uint64_t, uint64_t, uint32_t); int e820_get_num_entries(void); bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); =20 +#define PC_COMPAT_3_1 \ + HW_COMPAT_3_1 + #define PC_COMPAT_3_0 \ HW_COMPAT_3_0 \ {\ diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 575566e466..34b3e924d6 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -428,13 +428,29 @@ static void pc_i440fx_machine_options(MachineClass *m) machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE); } =20 -static void pc_i440fx_3_1_machine_options(MachineClass *m) +static void pc_i440fx_4_0_machine_options(MachineClass *m) { pc_i440fx_machine_options(m); m->alias =3D "pc"; m->is_default =3D 1; } =20 +DEFINE_I440FX_MACHINE(v4_0, "pc-i440fx-4.0", NULL, + pc_i440fx_4_0_machine_options); + +static GlobalProperty pc_compat_3_1[] =3D { + PC_COMPAT_3_1 +}; + +static void pc_i440fx_3_1_machine_options(MachineClass *m) +{ + pc_i440fx_4_0_machine_options(m); + m->is_default =3D 0; + m->alias =3D NULL; + compat_props_add(m->compat_props, + pc_compat_3_1, G_N_ELEMENTS(pc_compat_3_1)); +} + DEFINE_I440FX_MACHINE(v3_1, "pc-i440fx-3.1", NULL, pc_i440fx_3_1_machine_options); =20 @@ -445,9 +461,6 @@ static GlobalProperty pc_compat_3_0[] =3D { static void pc_i440fx_3_0_machine_options(MachineClass *m) { pc_i440fx_3_1_machine_options(m); - m->is_default =3D 0; - m->alias =3D NULL; - compat_props_add(m->compat_props, pc_compat_3_0, G_N_ELEMENTS(pc_compat_3_0)); } diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 701c09b43e..f0874c42d8 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -311,12 +311,27 @@ static void pc_q35_machine_options(MachineClass *m) m->max_cpus =3D 288; } =20 -static void pc_q35_3_1_machine_options(MachineClass *m) +static void pc_q35_4_0_machine_options(MachineClass *m) { pc_q35_machine_options(m); m->alias =3D "q35"; } =20 +DEFINE_Q35_MACHINE(v4_0, "pc-q35-4.0", NULL, + pc_q35_4_0_machine_options); + +static GlobalProperty pc_compat_3_1[] =3D { + PC_COMPAT_3_1 +}; + +static void pc_q35_3_1_machine_options(MachineClass *m) +{ + pc_q35_4_0_machine_options(m); + m->alias =3D NULL; + compat_props_add(m->compat_props, + pc_compat_3_1, G_N_ELEMENTS(pc_compat_3_1)); +} + DEFINE_Q35_MACHINE(v3_1, "pc-q35-3.1", NULL, pc_q35_3_1_machine_options); =20 @@ -327,7 +342,6 @@ static GlobalProperty pc_compat_3_0[] =3D { static void pc_q35_3_0_machine_options(MachineClass *m) { pc_q35_3_1_machine_options(m); - m->alias =3D NULL; compat_props_add(m->compat_props, pc_compat_3_0, G_N_ELEMENTS(pc_compat_3_0)); } --=20 2.20.0.rc1 From nobody Tue Oct 7 11:03:58 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15439339090716.470935276479054; Tue, 4 Dec 2018 06:31:49 -0800 (PST) Received: from localhost ([::1]:57115 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBjn-0007Jc-OD for importer@patchew.org; Tue, 04 Dec 2018 09:31:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBbt-0006NH-Gz for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:23:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUBbs-0000Aw-N6 for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:23:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40462) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUBbo-0008Sq-9n; Tue, 04 Dec 2018 09:23:32 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8E83DC0528BD; Tue, 4 Dec 2018 14:23:31 +0000 (UTC) Received: from localhost (ovpn-112-31.ams2.redhat.com [10.36.112.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id C68EA7F1BC; Tue, 4 Dec 2018 14:23:17 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 4 Dec 2018 18:20:22 +0400 Message-Id: <20181204142023.15982-19-marcandre.lureau@redhat.com> In-Reply-To: <20181204142023.15982-1-marcandre.lureau@redhat.com> References: <20181204142023.15982-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 04 Dec 2018 14:23:31 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v5 18/19] hw/arm/virt: add virt-4.0 machine type X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , imammedo@redhat.com, "open list:Virt" , ehabkost@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/arm/virt.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 530c8ca89d..433374f0d0 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1797,7 +1797,7 @@ static void machvirt_machine_init(void) } type_init(machvirt_machine_init); =20 -static void virt_3_1_instance_init(Object *obj) +static void virt_4_0_instance_init(Object *obj) { VirtMachineState *vms =3D VIRT_MACHINE(obj); VirtMachineClass *vmc =3D VIRT_MACHINE_GET_CLASS(vms); @@ -1867,10 +1867,28 @@ static void virt_3_1_instance_init(Object *obj) vms->irqmap =3D a15irqmap; } =20 +static void virt_machine_4_0_options(MachineClass *mc) +{ +} +DEFINE_VIRT_MACHINE_AS_LATEST(4, 0) + +static GlobalProperty virt_compat_3_1[] =3D { + HW_COMPAT_3_1 +}; + +static void virt_3_1_instance_init(Object *obj) +{ + virt_4_0_instance_init(obj); +} + static void virt_machine_3_1_options(MachineClass *mc) { + virt_machine_4_0_options(mc); + compat_props_add(mc->compat_props, + virt_compat_3_1, G_N_ELEMENTS(virt_compat_3_1)); } -DEFINE_VIRT_MACHINE_AS_LATEST(3, 1) + +DEFINE_VIRT_MACHINE(3, 1) =20 static GlobalProperty virt_compat_3_0[] =3D { HW_COMPAT_3_0 --=20 2.20.0.rc1 From nobody Tue Oct 7 11:03:58 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 154393459694977.08278454503102; Tue, 4 Dec 2018 06:43:16 -0800 (PST) Received: from localhost ([::1]:57204 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBup-0008Qd-KJ for importer@patchew.org; Tue, 04 Dec 2018 09:43:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48737) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUBbx-0006R9-C6 for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:23:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUBbw-0000Fv-AR for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:23:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51362) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUBbw-0000FZ-3H for qemu-devel@nongnu.org; Tue, 04 Dec 2018 09:23:40 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7A66F3082AFD for ; Tue, 4 Dec 2018 14:23:39 +0000 (UTC) Received: from localhost (ovpn-112-31.ams2.redhat.com [10.36.112.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 100F369117; Tue, 4 Dec 2018 14:23:34 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 4 Dec 2018 18:20:23 +0400 Message-Id: <20181204142023.15982-20-marcandre.lureau@redhat.com> In-Reply-To: <20181204142023.15982-1-marcandre.lureau@redhat.com> References: <20181204142023.15982-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Tue, 04 Dec 2018 14:23:39 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v5 19/19] hostmem: use object id for memory region name with >= 4.0 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: imammedo@redhat.com, ehabkost@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" hostmem-file and hostmem-memfd use the whole object path for the memory region name, and hostname-ram uses only the path component (the object id, or canonical path basename): qemu -m 1024 -object memory-backend-file,id=3Dmem,size=3D1G,mem-path=3D/tmp= /foo -numa node,memdev=3Dmem -monitor stdio (qemu) info ramblock Block Name PSize Offset Used = Total /objects/mem 4 KiB 0x0000000000000000 0x0000000040000000 0x= 0000000040000000 qemu -m 1024 -object memory-backend-memfd,id=3Dmem,size=3D1G -numa node,mem= dev=3Dmem -monitor stdio (qemu) info ramblock Block Name PSize Offset Used = Total /objects/mem 4 KiB 0x0000000000000000 0x0000000040000000 0x= 0000000040000000 qemu -m 1024 -object memory-backend-ram,id=3Dmem,size=3D1G -numa node,memde= v=3Dmem -monitor stdio (qemu) info ramblock Block Name PSize Offset Used = Total mem 4 KiB 0x0000000000000000 0x0000000040000000 0x= 0000000040000000 For consistency, change to use object id for -file and -memfd as well with >=3D 4.0. Having a consistent naming allows to migrate to different hostmem backends. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/hw/compat.h | 10 +++++++++- include/sysemu/hostmem.h | 3 ++- backends/hostmem-file.c | 8 ++++---- backends/hostmem-memfd.c | 2 +- backends/hostmem-ram.c | 9 ++++----- backends/hostmem.c | 36 ++++++++++++++++++++++++++++++++++++ 6 files changed, 56 insertions(+), 12 deletions(-) diff --git a/include/hw/compat.h b/include/hw/compat.h index 70958328fe..99cf6b1e03 100644 --- a/include/hw/compat.h +++ b/include/hw/compat.h @@ -2,7 +2,15 @@ #define HW_COMPAT_H =20 #define HW_COMPAT_3_1 \ - /* empty */ + {\ + .driver =3D "memory-backend-file",\ + .property =3D "x-use-canonical-path-for-ramblock-id",\ + .value =3D "true",\ + },{\ + .driver =3D "memory-backend-memfd",\ + .property =3D "x-use-canonical-path-for-ramblock-id",\ + .value =3D "true",\ + }, =20 #define HW_COMPAT_3_0 \ /* empty */ diff --git a/include/sysemu/hostmem.h b/include/sysemu/hostmem.h index 6e6bd2c1cb..a023b372a4 100644 --- a/include/sysemu/hostmem.h +++ b/include/sysemu/hostmem.h @@ -53,7 +53,7 @@ struct HostMemoryBackend { =20 /* protected */ uint64_t size; - bool merge, dump; + bool merge, dump, use_canonical_path; bool prealloc, force_prealloc, is_mapped, share; DECLARE_BITMAP(host_nodes, MAX_NODES + 1); HostMemPolicy policy; @@ -67,5 +67,6 @@ MemoryRegion *host_memory_backend_get_memory(HostMemoryBa= ckend *backend); void host_memory_backend_set_mapped(HostMemoryBackend *backend, bool mappe= d); bool host_memory_backend_is_mapped(HostMemoryBackend *backend); size_t host_memory_backend_pagesize(HostMemoryBackend *memdev); +char *host_memory_backend_get_name(HostMemoryBackend *backend); =20 #endif diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c index 6630021226..5b87e154f3 100644 --- a/backends/hostmem-file.c +++ b/backends/hostmem-file.c @@ -43,7 +43,7 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Err= or **errp) { HostMemoryBackendFile *fb =3D MEMORY_BACKEND_FILE(backend); #ifdef CONFIG_POSIX - gchar *path; + gchar *name; #endif =20 if (!backend->size) { @@ -58,14 +58,14 @@ file_backend_memory_alloc(HostMemoryBackend *backend, E= rror **errp) error_setg(errp, "-mem-path not supported on this host"); #else backend->force_prealloc =3D mem_prealloc; - path =3D object_get_canonical_path(OBJECT(backend)); + name =3D host_memory_backend_get_name(backend); memory_region_init_ram_from_file(&backend->mr, OBJECT(backend), - path, + name, backend->size, fb->align, (backend->share ? RAM_SHARED : 0) | (fb->is_pmem ? RAM_PMEM : 0), fb->mem_path, errp); - g_free(path); + g_free(name); #endif } =20 diff --git a/backends/hostmem-memfd.c b/backends/hostmem-memfd.c index 2eb9c827a5..98c9bf3240 100644 --- a/backends/hostmem-memfd.c +++ b/backends/hostmem-memfd.c @@ -53,7 +53,7 @@ memfd_backend_memory_alloc(HostMemoryBackend *backend, Er= ror **errp) return; } =20 - name =3D object_get_canonical_path(OBJECT(backend)); + name =3D host_memory_backend_get_name(backend); memory_region_init_ram_from_fd(&backend->mr, OBJECT(backend), name, backend->size, backend->share, fd, errp); diff --git a/backends/hostmem-ram.c b/backends/hostmem-ram.c index 7ddd08d370..24b65d9ae3 100644 --- a/backends/hostmem-ram.c +++ b/backends/hostmem-ram.c @@ -16,21 +16,20 @@ =20 #define TYPE_MEMORY_BACKEND_RAM "memory-backend-ram" =20 - static void ram_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) { - char *path; + char *name; =20 if (!backend->size) { error_setg(errp, "can't create backend with size 0"); return; } =20 - path =3D object_get_canonical_path_component(OBJECT(backend)); - memory_region_init_ram_shared_nomigrate(&backend->mr, OBJECT(backend),= path, + name =3D host_memory_backend_get_name(backend); + memory_region_init_ram_shared_nomigrate(&backend->mr, OBJECT(backend),= name, backend->size, backend->share, errp); - g_free(path); + g_free(name); } =20 static void diff --git a/backends/hostmem.c b/backends/hostmem.c index 1a89342039..c7a7020fed 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -28,6 +28,16 @@ QEMU_BUILD_BUG_ON(HOST_MEM_POLICY_BIND !=3D MPOL_BIND); QEMU_BUILD_BUG_ON(HOST_MEM_POLICY_INTERLEAVE !=3D MPOL_INTERLEAVE); #endif =20 +char * +host_memory_backend_get_name(HostMemoryBackend *self) +{ + if (!self->use_canonical_path) { + return object_get_canonical_path_component(OBJECT(self)); + } + + return object_get_canonical_path(OBJECT(self)); +} + static void host_memory_backend_get_size(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) @@ -238,6 +248,11 @@ static void host_memory_backend_init(Object *obj) backend->prealloc =3D mem_prealloc; } =20 +static void host_memory_backend_post_init(Object *obj) +{ + object_apply_compat_props(obj); +} + bool host_memory_backend_mr_inited(HostMemoryBackend *backend) { /* @@ -386,6 +401,23 @@ static void host_memory_backend_set_share(Object *o, b= ool value, Error **errp) backend->share =3D value; } =20 +static bool +host_memory_backend_get_use_canonical_path(Object *obj, Error **errp) +{ + HostMemoryBackend *self =3D MEMORY_BACKEND(obj); + + return self->use_canonical_path; +} + +static void +host_memory_backend_set_use_canonical_path(Object *obj, bool value, + Error **errp) +{ + HostMemoryBackend *self =3D MEMORY_BACKEND(obj); + + self->use_canonical_path =3D value; +} + static void host_memory_backend_class_init(ObjectClass *oc, void *data) { @@ -432,6 +464,9 @@ host_memory_backend_class_init(ObjectClass *oc, void *d= ata) &error_abort); object_class_property_set_description(oc, "share", "Mark the memory as private to QEMU or shared", &error_abort); + object_class_property_add_bool(oc, "x-use-canonical-path-for-ramblock-= id", + host_memory_backend_get_use_canonical_path, + host_memory_backend_set_use_canonical_path, &error_abort); } =20 static const TypeInfo host_memory_backend_info =3D { @@ -442,6 +477,7 @@ static const TypeInfo host_memory_backend_info =3D { .class_init =3D host_memory_backend_class_init, .instance_size =3D sizeof(HostMemoryBackend), .instance_init =3D host_memory_backend_init, + .instance_post_init =3D host_memory_backend_post_init, .interfaces =3D (InterfaceInfo[]) { { TYPE_USER_CREATABLE }, { } --=20 2.20.0.rc1