qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/21] hw: More QDev cleanups
@ 2024-02-16 11:02 Philippe Mathieu-Daudé
  2024-02-16 11:02 ` [PATCH 01/21] hw/i386/pc: Do not use C99 mixed-declarations style Philippe Mathieu-Daudé
                   ` (21 more replies)
  0 siblings, 22 replies; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-16 11:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Philippe Mathieu-Daudé

Various QDev cleanups extracted to my "enforce QDev API" branch.
- When available, instead of plain QOM, use QDev API equivalent
- Add missing QOM parentship for some obj created with qdev_*new()
- Prefer object_initialize_child() over object_initialize()

Philippe Mathieu-Daudé (21):
  hw/i386/pc: Do not use C99 mixed-declarations style
  hw/i386/pc_sysfw: Use qdev_is_realized() instead of QOM API
  hw/ppc/spapr_cpu: Use qdev_is_realized() instead of QOM API
  hw/tricore/testboard: Use qdev_new() instead of QOM basic API
  hw/ppc/pnv_bmc: Use qdev_new() instead of QOM API
  hw: Replace DEVICE(object_new) -> qdev_new()
  target: Replace DEVICE(object_new) -> qdev_new()
  hw/isa: Inline isa_try_new()
  hw/usb: Inline usb_try_new()
  hw/usb: Inline usb_new()
  hw/usb: Add QOM parentship relation with hub devices
  hw/pci-host/q35: Update q35_host_props[] comment
  hw/pci-host/raven: Embedded OrIRQ in PRePPCIState
  hw/pci-host/raven: Prefer object_initialize_child over
    object_initialize
  hw/core/register: Prefer object_initialize_child over
    object_initialize
  hw/net/can/versal: Prefer object_initialize_child over
    object_initialize
  hw/i386/iommu: Prefer object_initialize_child over object_initialize
  hw/pci-host/versatile: Replace object_initialize() -> _child()
  hw/s390x/zpci-bus: Add QOM parentship relation with zPCI devices
  hw/arm/mps2: Add QOM parentship relation with OR IRQ gates
  hw: Add QOM parentship relation with CPUs

 include/hw/isa/isa.h                     |  1 -
 include/hw/net/ne2000-isa.h              |  2 +-
 include/hw/tricore/tricore_testdevice.h  |  3 ---
 include/hw/usb.h                         |  1 -
 hw/arm/mps2.c                            |  5 +++++
 hw/arm/musicpal.c                        |  2 +-
 hw/core/qdev.c                           |  2 +-
 hw/core/register.c                       |  2 +-
 hw/i386/amd_iommu.c                      |  6 +++---
 hw/i386/pc.c                             |  6 +++---
 hw/i386/pc_sysfw.c                       |  6 ++----
 hw/i386/x86.c                            |  1 +
 hw/isa/isa-bus.c                         |  5 -----
 hw/microblaze/petalogix_ml605_mmu.c      |  1 +
 hw/microblaze/petalogix_s3adsp1800_mmu.c |  1 +
 hw/mips/cps.c                            |  1 +
 hw/net/can/xlnx-versal-canfd.c           |  2 +-
 hw/nios2/10m50_devboard.c                |  1 +
 hw/pci-host/q35.c                        |  6 +++---
 hw/pci-host/raven.c                      | 18 ++++++++----------
 hw/pci-host/versatile.c                  |  3 ++-
 hw/ppc/e500.c                            |  1 +
 hw/ppc/pnv_bmc.c                         | 10 +++++-----
 hw/ppc/spapr.c                           |  1 +
 hw/ppc/spapr_cpu_core.c                  |  3 +--
 hw/s390x/s390-pci-bus.c                  |  1 +
 hw/sparc/sun4m.c                         |  4 ++--
 hw/tricore/tricore_testboard.c           |  4 +---
 hw/usb/bus.c                             | 17 ++++-------------
 hw/usb/dev-serial.c                      |  2 +-
 target/mips/cpu.c                        |  2 +-
 target/xtensa/cpu.c                      |  2 +-
 32 files changed, 55 insertions(+), 67 deletions(-)

-- 
2.41.0



^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 01/21] hw/i386/pc: Do not use C99 mixed-declarations style
  2024-02-16 11:02 [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé
@ 2024-02-16 11:02 ` Philippe Mathieu-Daudé
  2024-02-22  9:12   ` Zhao Liu
  2024-02-16 11:02 ` [PATCH 02/21] hw/i386/pc_sysfw: Use qdev_is_realized() instead of QOM API Philippe Mathieu-Daudé
                   ` (20 subsequent siblings)
  21 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-16 11:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Philippe Mathieu-Daudé, Michael S. Tsirkin, Marcel Apfelbaum,
	Paolo Bonzini, Richard Henderson, Eduardo Habkost

QEMU's coding style generally forbids C99 mixed declarations.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/i386/pc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 196827531a..3c00a87317 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1227,6 +1227,7 @@ void pc_basic_device_init(struct PCMachineState *pcms,
      */
     if (pcms->hpet_enabled) {
         qemu_irq rtc_irq;
+        uint8_t compat;
 
         hpet = qdev_try_new(TYPE_HPET);
         if (!hpet) {
@@ -1238,8 +1239,7 @@ void pc_basic_device_init(struct PCMachineState *pcms,
          * use IRQ16~23, IRQ8 and IRQ2.  If the user has already set
          * the property, use whatever mask they specified.
          */
-        uint8_t compat = object_property_get_uint(OBJECT(hpet),
-                HPET_INTCAP, NULL);
+        compat = object_property_get_uint(OBJECT(hpet), HPET_INTCAP, NULL);
         if (!compat) {
             qdev_prop_set_uint32(hpet, HPET_INTCAP, hpet_irqs);
         }
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 02/21] hw/i386/pc_sysfw: Use qdev_is_realized() instead of QOM API
  2024-02-16 11:02 [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé
  2024-02-16 11:02 ` [PATCH 01/21] hw/i386/pc: Do not use C99 mixed-declarations style Philippe Mathieu-Daudé
@ 2024-02-16 11:02 ` Philippe Mathieu-Daudé
  2024-02-22  9:16   ` Zhao Liu
  2024-02-16 11:02 ` [PATCH 03/21] hw/ppc/spapr_cpu: " Philippe Mathieu-Daudé
                   ` (19 subsequent siblings)
  21 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-16 11:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Philippe Mathieu-Daudé, Michael S. Tsirkin, Marcel Apfelbaum,
	Paolo Bonzini, Richard Henderson, Eduardo Habkost

Prefer QDev API for QDev objects, avoid the underlying QOM layer.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/i386/pc_sysfw.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c
index c8d9e71b88..3efabbbab2 100644
--- a/hw/i386/pc_sysfw.c
+++ b/hw/i386/pc_sysfw.c
@@ -107,17 +107,15 @@ void pc_system_flash_cleanup_unused(PCMachineState *pcms)
 {
     char *prop_name;
     int i;
-    Object *dev_obj;
 
     assert(PC_MACHINE_GET_CLASS(pcms)->pci_enabled);
 
     for (i = 0; i < ARRAY_SIZE(pcms->flash); i++) {
-        dev_obj = OBJECT(pcms->flash[i]);
-        if (!object_property_get_bool(dev_obj, "realized", &error_abort)) {
+        if (!qdev_is_realized(DEVICE(pcms->flash[i]))) {
             prop_name = g_strdup_printf("pflash%d", i);
             object_property_del(OBJECT(pcms), prop_name);
             g_free(prop_name);
-            object_unparent(dev_obj);
+            object_unparent(OBJECT(pcms->flash[i]));
             pcms->flash[i] = NULL;
         }
     }
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 03/21] hw/ppc/spapr_cpu: Use qdev_is_realized() instead of QOM API
  2024-02-16 11:02 [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé
  2024-02-16 11:02 ` [PATCH 01/21] hw/i386/pc: Do not use C99 mixed-declarations style Philippe Mathieu-Daudé
  2024-02-16 11:02 ` [PATCH 02/21] hw/i386/pc_sysfw: Use qdev_is_realized() instead of QOM API Philippe Mathieu-Daudé
@ 2024-02-16 11:02 ` Philippe Mathieu-Daudé
  2024-02-22  9:56   ` Zhao Liu
  2024-02-16 11:02 ` [PATCH 04/21] hw/tricore/testboard: Use qdev_new() instead of QOM basic API Philippe Mathieu-Daudé
                   ` (18 subsequent siblings)
  21 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-16 11:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Philippe Mathieu-Daudé, Nicholas Piggin,
	Daniel Henrique Barboza, Cédric Le Goater, David Gibson,
	Harsh Prateek Bora

Prefer QDev API for QDev objects, avoid the underlying QOM layer.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/ppc/spapr_cpu_core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index 0c0fb3f1b0..40b7c52f7f 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -245,8 +245,7 @@ static void spapr_cpu_core_unrealize(DeviceState *dev)
              * spapr_cpu_core_realize(), make sure we only unrealize
              * vCPUs that have already been realized.
              */
-            if (object_property_get_bool(OBJECT(sc->threads[i]), "realized",
-                                         &error_abort)) {
+            if (qdev_is_realized(DEVICE(sc->threads[i]))) {
                 spapr_unrealize_vcpu(sc->threads[i], sc);
             }
             spapr_delete_vcpu(sc->threads[i]);
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 04/21] hw/tricore/testboard: Use qdev_new() instead of QOM basic API
  2024-02-16 11:02 [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2024-02-16 11:02 ` [PATCH 03/21] hw/ppc/spapr_cpu: " Philippe Mathieu-Daudé
@ 2024-02-16 11:02 ` Philippe Mathieu-Daudé
  2024-02-19 11:59   ` Bastian Koppelmann
  2024-02-16 11:02 ` [PATCH 05/21] hw/ppc/pnv_bmc: Use qdev_new() instead of QOM API Philippe Mathieu-Daudé
                   ` (17 subsequent siblings)
  21 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-16 11:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Philippe Mathieu-Daudé, Bastian Koppelmann

Prefer QDev API for QDev objects, avoid the underlying QOM layer.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/tricore/tricore_testdevice.h | 3 ---
 hw/tricore/tricore_testboard.c          | 4 +---
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/include/hw/tricore/tricore_testdevice.h b/include/hw/tricore/tricore_testdevice.h
index 8b4fe15f24..2c57b62f22 100644
--- a/include/hw/tricore/tricore_testdevice.h
+++ b/include/hw/tricore/tricore_testdevice.h
@@ -25,12 +25,9 @@
     OBJECT_CHECK(TriCoreTestDeviceState, (obj), TYPE_TRICORE_TESTDEVICE)
 
 typedef struct {
-    /* <private> */
     SysBusDevice parent_obj;
 
-    /* <public> */
     MemoryRegion iomem;
-
 } TriCoreTestDeviceState;
 
 #endif
diff --git a/hw/tricore/tricore_testboard.c b/hw/tricore/tricore_testboard.c
index b6810e3be0..c29db8b451 100644
--- a/hw/tricore/tricore_testboard.c
+++ b/hw/tricore/tricore_testboard.c
@@ -89,9 +89,7 @@ static void tricore_testboard_init(MachineState *machine, int board_id)
     memory_region_add_subregion(sysmem, 0xf0050000, pcp_data);
     memory_region_add_subregion(sysmem, 0xf0060000, pcp_text);
 
-    test_dev = g_new(TriCoreTestDeviceState, 1);
-    object_initialize(test_dev, sizeof(TriCoreTestDeviceState),
-                      TYPE_TRICORE_TESTDEVICE);
+    test_dev = TRICORE_TESTDEVICE(qdev_new(TYPE_TRICORE_TESTDEVICE));
     memory_region_add_subregion(sysmem, 0xf0000000, &test_dev->iomem);
 
 
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 05/21] hw/ppc/pnv_bmc: Use qdev_new() instead of QOM API
  2024-02-16 11:02 [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé
                   ` (3 preceding siblings ...)
  2024-02-16 11:02 ` [PATCH 04/21] hw/tricore/testboard: Use qdev_new() instead of QOM basic API Philippe Mathieu-Daudé
@ 2024-02-16 11:02 ` Philippe Mathieu-Daudé
  2024-02-16 11:08   ` Cédric Le Goater
  2024-02-16 11:02 ` [PATCH 06/21] hw: Replace DEVICE(object_new) -> qdev_new() Philippe Mathieu-Daudé
                   ` (16 subsequent siblings)
  21 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-16 11:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Philippe Mathieu-Daudé, Cédric Le Goater,
	Nicholas Piggin, Frédéric Barrat

Prefer QDev API for QDev objects, avoid the underlying QOM layer.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/ppc/pnv_bmc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/hw/ppc/pnv_bmc.c b/hw/ppc/pnv_bmc.c
index 99f1e8d7f9..0c1274df21 100644
--- a/hw/ppc/pnv_bmc.c
+++ b/hw/ppc/pnv_bmc.c
@@ -269,13 +269,13 @@ void pnv_bmc_set_pnor(IPMIBmc *bmc, PnvPnor *pnor)
  */
 IPMIBmc *pnv_bmc_create(PnvPnor *pnor)
 {
-    Object *obj;
+    DeviceState *dev;
 
-    obj = object_new(TYPE_IPMI_BMC_SIMULATOR);
-    qdev_realize(DEVICE(obj), NULL, &error_fatal);
-    pnv_bmc_set_pnor(IPMI_BMC(obj), pnor);
+    dev = qdev_new(TYPE_IPMI_BMC_SIMULATOR);
+    qdev_realize(dev, NULL, &error_fatal);
+    pnv_bmc_set_pnor(IPMI_BMC(dev), pnor);
 
-    return IPMI_BMC(obj);
+    return IPMI_BMC(dev);
 }
 
 typedef struct ForeachArgs {
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 06/21] hw: Replace DEVICE(object_new) -> qdev_new()
  2024-02-16 11:02 [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé
                   ` (4 preceding siblings ...)
  2024-02-16 11:02 ` [PATCH 05/21] hw/ppc/pnv_bmc: Use qdev_new() instead of QOM API Philippe Mathieu-Daudé
@ 2024-02-16 11:02 ` Philippe Mathieu-Daudé
  2024-02-22  9:50   ` Zhao Liu
  2024-02-16 11:02 ` [PATCH 07/21] target: " Philippe Mathieu-Daudé
                   ` (15 subsequent siblings)
  21 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-16 11:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Philippe Mathieu-Daudé, Jan Kiszka, Peter Maydell,
	Paolo Bonzini, Daniel P. Berrangé, Eduardo Habkost,
	Mark Cave-Ayland, Artyom Tarasenko

Prefer QDev API for QDev objects, avoid the underlying QOM layer.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/arm/musicpal.c | 2 +-
 hw/core/qdev.c    | 2 +-
 hw/sparc/sun4m.c  | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
index 2020f73a57..74e4d24aab 100644
--- a/hw/arm/musicpal.c
+++ b/hw/arm/musicpal.c
@@ -1238,7 +1238,7 @@ static void musicpal_init(MachineState *machine)
                           qdev_get_gpio_in(pic, MP_TIMER4_IRQ), NULL);
 
     /* Logically OR both UART IRQs together */
-    uart_orgate = DEVICE(object_new(TYPE_OR_IRQ));
+    uart_orgate = qdev_new(TYPE_OR_IRQ);
     object_property_set_int(OBJECT(uart_orgate), "num-lines", 2, &error_fatal);
     qdev_realize_and_unref(uart_orgate, NULL, &error_fatal);
     qdev_connect_gpio_out(uart_orgate, 0,
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index c68d0f7c51..a271380d20 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -171,7 +171,7 @@ DeviceState *qdev_try_new(const char *name)
     if (!module_object_class_by_name(name)) {
         return NULL;
     }
-    return DEVICE(object_new(name));
+    return qdev_new(name);
 }
 
 static QTAILQ_HEAD(, DeviceListener) device_listeners
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index d52e6a7213..fedc4b8b3f 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -979,7 +979,7 @@ static void sun4m_hw_init(MachineState *machine)
     sysbus_mmio_map(s, 0, hwdef->ms_kb_base);
 
     /* Logically OR both its IRQs together */
-    ms_kb_orgate = DEVICE(object_new(TYPE_OR_IRQ));
+    ms_kb_orgate = qdev_new(TYPE_OR_IRQ);
     object_property_set_int(OBJECT(ms_kb_orgate), "num-lines", 2, &error_fatal);
     qdev_realize_and_unref(ms_kb_orgate, NULL, &error_fatal);
     sysbus_connect_irq(s, 0, qdev_get_gpio_in(ms_kb_orgate, 0));
@@ -1000,7 +1000,7 @@ static void sun4m_hw_init(MachineState *machine)
     sysbus_mmio_map(s, 0, hwdef->serial_base);
 
     /* Logically OR both its IRQs together */
-    serial_orgate = DEVICE(object_new(TYPE_OR_IRQ));
+    serial_orgate = qdev_new(TYPE_OR_IRQ);
     object_property_set_int(OBJECT(serial_orgate), "num-lines", 2,
                             &error_fatal);
     qdev_realize_and_unref(serial_orgate, NULL, &error_fatal);
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 07/21] target: Replace DEVICE(object_new) -> qdev_new()
  2024-02-16 11:02 [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé
                   ` (5 preceding siblings ...)
  2024-02-16 11:02 ` [PATCH 06/21] hw: Replace DEVICE(object_new) -> qdev_new() Philippe Mathieu-Daudé
@ 2024-02-16 11:02 ` Philippe Mathieu-Daudé
  2024-02-22  9:54   ` Zhao Liu
  2024-02-16 11:02 ` [PATCH 08/21] hw/isa: Inline isa_try_new() Philippe Mathieu-Daudé
                   ` (14 subsequent siblings)
  21 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-16 11:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Philippe Mathieu-Daudé, Aurelien Jarno, Jiaxun Yang,
	Aleksandar Rikalo, Max Filippov

Prefer QDev API for QDev objects, avoid the underlying QOM layer.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/mips/cpu.c   | 2 +-
 target/xtensa/cpu.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/mips/cpu.c b/target/mips/cpu.c
index d644adbc77..6b3909ee08 100644
--- a/target/mips/cpu.c
+++ b/target/mips/cpu.c
@@ -649,7 +649,7 @@ MIPSCPU *mips_cpu_create_with_clock(const char *cpu_type, Clock *cpu_refclk)
 {
     DeviceState *cpu;
 
-    cpu = DEVICE(object_new(cpu_type));
+    cpu = qdev_new(cpu_type);
     qdev_connect_clock_in(cpu, "clk-in", cpu_refclk);
     qdev_realize(cpu, NULL, &error_abort);
 
diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c
index 79f91819df..4f9408e1a0 100644
--- a/target/xtensa/cpu.c
+++ b/target/xtensa/cpu.c
@@ -205,7 +205,7 @@ XtensaCPU *xtensa_cpu_create_with_clock(const char *cpu_type, Clock *cpu_refclk)
 {
     DeviceState *cpu;
 
-    cpu = DEVICE(object_new(cpu_type));
+    cpu = qdev_new(cpu_type);
     qdev_connect_clock_in(cpu, "clk-in", cpu_refclk);
     qdev_realize(cpu, NULL, &error_abort);
 
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 08/21] hw/isa: Inline isa_try_new()
  2024-02-16 11:02 [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé
                   ` (6 preceding siblings ...)
  2024-02-16 11:02 ` [PATCH 07/21] target: " Philippe Mathieu-Daudé
@ 2024-02-16 11:02 ` Philippe Mathieu-Daudé
  2024-02-16 11:03 ` [PATCH 09/21] hw/usb: Inline usb_try_new() Philippe Mathieu-Daudé
                   ` (13 subsequent siblings)
  21 siblings, 0 replies; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-16 11:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Philippe Mathieu-Daudé, Paolo Bonzini, Richard Henderson,
	Eduardo Habkost, Michael S. Tsirkin, Marcel Apfelbaum, Jason Wang

Inline the 2 single uses of isa_try_new().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/isa/isa.h        | 1 -
 include/hw/net/ne2000-isa.h | 2 +-
 hw/i386/pc.c                | 2 +-
 hw/isa/isa-bus.c            | 5 -----
 4 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h
index 40d6224a4e..8475120849 100644
--- a/include/hw/isa/isa.h
+++ b/include/hw/isa/isa.h
@@ -81,7 +81,6 @@ IsaDma *isa_bus_get_dma(ISABus *bus, int nchan);
  */
 qemu_irq isa_bus_get_irq(ISABus *bus, unsigned irqnum);
 ISADevice *isa_new(const char *name);
-ISADevice *isa_try_new(const char *name);
 bool isa_realize_and_unref(ISADevice *dev, ISABus *bus, Error **errp);
 ISADevice *isa_create_simple(ISABus *bus, const char *name);
 
diff --git a/include/hw/net/ne2000-isa.h b/include/hw/net/ne2000-isa.h
index 73bae10ad1..2440ac8621 100644
--- a/include/hw/net/ne2000-isa.h
+++ b/include/hw/net/ne2000-isa.h
@@ -22,7 +22,7 @@ static inline ISADevice *isa_ne2000_init(ISABus *bus, int base, int irq,
 {
     ISADevice *d;
 
-    d = isa_try_new(TYPE_ISA_NE2000);
+    d = ISA_DEVICE(qdev_try_new(TYPE_ISA_NE2000));
     if (d) {
         DeviceState *dev = DEVICE(d);
 
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 3c00a87317..e8130774ad 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1183,7 +1183,7 @@ static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl,
     i8042 = isa_create_simple(isa_bus, TYPE_I8042);
     if (!no_vmport) {
         isa_create_simple(isa_bus, TYPE_VMPORT);
-        vmmouse = isa_try_new("vmmouse");
+        vmmouse = ISA_DEVICE(qdev_try_new("vmmouse"));
     } else {
         vmmouse = NULL;
     }
diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c
index f1e0f14007..8aaf44a3ef 100644
--- a/hw/isa/isa-bus.c
+++ b/hw/isa/isa-bus.c
@@ -158,11 +158,6 @@ ISADevice *isa_new(const char *name)
     return ISA_DEVICE(qdev_new(name));
 }
 
-ISADevice *isa_try_new(const char *name)
-{
-    return ISA_DEVICE(qdev_try_new(name));
-}
-
 ISADevice *isa_create_simple(ISABus *bus, const char *name)
 {
     ISADevice *dev;
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 09/21] hw/usb: Inline usb_try_new()
  2024-02-16 11:02 [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé
                   ` (7 preceding siblings ...)
  2024-02-16 11:02 ` [PATCH 08/21] hw/isa: Inline isa_try_new() Philippe Mathieu-Daudé
@ 2024-02-16 11:03 ` Philippe Mathieu-Daudé
  2024-02-22  9:53   ` Zhao Liu
  2024-02-16 11:03 ` [PATCH 10/21] hw/usb: Inline usb_new() Philippe Mathieu-Daudé
                   ` (12 subsequent siblings)
  21 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-16 11:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Philippe Mathieu-Daudé, Gerd Hoffmann

Inline the single use of usb_try_new().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/usb/bus.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index 59c39945dd..148224f06a 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -334,11 +334,6 @@ USBDevice *usb_new(const char *name)
     return USB_DEVICE(qdev_new(name));
 }
 
-static USBDevice *usb_try_new(const char *name)
-{
-    return USB_DEVICE(qdev_try_new(name));
-}
-
 bool usb_realize_and_unref(USBDevice *dev, USBBus *bus, Error **errp)
 {
     return qdev_realize_and_unref(&dev->qdev, &bus->qbus, errp);
@@ -447,7 +442,7 @@ void usb_claim_port(USBDevice *dev, Error **errp)
     } else {
         if (bus->nfree == 1 && strcmp(object_get_typename(OBJECT(dev)), "usb-hub") != 0) {
             /* Create a new hub and chain it on */
-            hub = usb_try_new("usb-hub");
+            hub = USB_DEVICE(qdev_try_new("usb-hub"));
             if (hub) {
                 usb_realize_and_unref(hub, bus, NULL);
             }
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 10/21] hw/usb: Inline usb_new()
  2024-02-16 11:02 [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé
                   ` (8 preceding siblings ...)
  2024-02-16 11:03 ` [PATCH 09/21] hw/usb: Inline usb_try_new() Philippe Mathieu-Daudé
@ 2024-02-16 11:03 ` Philippe Mathieu-Daudé
  2024-02-22  9:55   ` Zhao Liu
  2024-02-16 11:03 ` [PATCH 11/21] hw/usb: Add QOM parentship relation with hub devices Philippe Mathieu-Daudé
                   ` (11 subsequent siblings)
  21 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-16 11:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Philippe Mathieu-Daudé, Gerd Hoffmann, Samuel Thibault

Inline the 2 uses of usb_new().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/usb.h    | 1 -
 hw/usb/bus.c        | 9 ++-------
 hw/usb/dev-serial.c | 2 +-
 3 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/include/hw/usb.h b/include/hw/usb.h
index 32c23a5ca2..2d820685cc 100644
--- a/include/hw/usb.h
+++ b/include/hw/usb.h
@@ -500,7 +500,6 @@ void usb_bus_release(USBBus *bus);
 USBBus *usb_bus_find(int busnr);
 void usb_legacy_register(const char *typename, const char *usbdevice_name,
                          USBDevice *(*usbdevice_init)(void));
-USBDevice *usb_new(const char *name);
 bool usb_realize_and_unref(USBDevice *dev, USBBus *bus, Error **errp);
 USBDevice *usb_create_simple(USBBus *bus, const char *name);
 USBDevice *usbdevice_create(const char *cmdline);
diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index 148224f06a..a599e2552b 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -329,11 +329,6 @@ void usb_legacy_register(const char *typename, const char *usbdevice_name,
     }
 }
 
-USBDevice *usb_new(const char *name)
-{
-    return USB_DEVICE(qdev_new(name));
-}
-
 bool usb_realize_and_unref(USBDevice *dev, USBBus *bus, Error **errp)
 {
     return qdev_realize_and_unref(&dev->qdev, &bus->qbus, errp);
@@ -341,7 +336,7 @@ bool usb_realize_and_unref(USBDevice *dev, USBBus *bus, Error **errp)
 
 USBDevice *usb_create_simple(USBBus *bus, const char *name)
 {
-    USBDevice *dev = usb_new(name);
+    USBDevice *dev = USB_DEVICE(qdev_new(name));
 
     usb_realize_and_unref(dev, bus, &error_abort);
     return dev;
@@ -693,7 +688,7 @@ USBDevice *usbdevice_create(const char *driver)
         return NULL;
     }
 
-    dev = f->usbdevice_init ? f->usbdevice_init() : usb_new(f->name);
+    dev = f->usbdevice_init ? f->usbdevice_init() : USB_DEVICE(qdev_new(f->name));
     if (!dev) {
         error_report("Failed to create USB device '%s'", f->name);
         return NULL;
diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c
index 63047d79cf..6e79c46d53 100644
--- a/hw/usb/dev-serial.c
+++ b/hw/usb/dev-serial.c
@@ -624,7 +624,7 @@ static USBDevice *usb_braille_init(void)
         return NULL;
     }
 
-    dev = usb_new("usb-braille");
+    dev = USB_DEVICE(qdev_new("usb-braille"));
     qdev_prop_set_chr(&dev->qdev, "chardev", cdrv);
     return dev;
 }
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 11/21] hw/usb: Add QOM parentship relation with hub devices
  2024-02-16 11:02 [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé
                   ` (9 preceding siblings ...)
  2024-02-16 11:03 ` [PATCH 10/21] hw/usb: Inline usb_new() Philippe Mathieu-Daudé
@ 2024-02-16 11:03 ` Philippe Mathieu-Daudé
  2024-02-22  9:49   ` Zhao Liu
  2024-02-16 11:03 ` [PATCH 12/21] hw/pci-host/q35: Update q35_host_props[] comment Philippe Mathieu-Daudé
                   ` (10 subsequent siblings)
  21 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-16 11:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Philippe Mathieu-Daudé, Gerd Hoffmann

QDev objects created with qdev_*new() need to manually add
their parent relationship with object_property_add_child().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/usb/bus.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index a599e2552b..baad04f466 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -439,6 +439,7 @@ void usb_claim_port(USBDevice *dev, Error **errp)
             /* Create a new hub and chain it on */
             hub = USB_DEVICE(qdev_try_new("usb-hub"));
             if (hub) {
+                object_property_add_child(OBJECT(dev), "hub", OBJECT(hub));
                 usb_realize_and_unref(hub, bus, NULL);
             }
         }
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 12/21] hw/pci-host/q35: Update q35_host_props[] comment
  2024-02-16 11:02 [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé
                   ` (10 preceding siblings ...)
  2024-02-16 11:03 ` [PATCH 11/21] hw/usb: Add QOM parentship relation with hub devices Philippe Mathieu-Daudé
@ 2024-02-16 11:03 ` Philippe Mathieu-Daudé
  2024-02-16 11:03 ` [PATCH 13/21] hw/pci-host/raven: Embedded OrIRQ in PRePPCIState Philippe Mathieu-Daudé
                   ` (9 subsequent siblings)
  21 siblings, 0 replies; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-16 11:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Philippe Mathieu-Daudé, Michael S. Tsirkin, Marcel Apfelbaum

Commit aff39be0ed ("hw/pci-host: Use object_initialize_child for
correct reference counting") replaced object_initialize() by
object_initialize_child(), update the comment.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/pci-host/q35.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
index 0d7d4e3f08..0eb1c7034d 100644
--- a/hw/pci-host/q35.c
+++ b/hw/pci-host/q35.c
@@ -165,10 +165,10 @@ static void q35_host_get_pci_hole64_end(Object *obj, Visitor *v,
 /*
  * NOTE: setting defaults for the mch.* fields in this table
  * doesn't work, because mch is a separate QOM object that is
- * zeroed by the object_initialize(&s->mch, ...) call inside
+ * zeroed by the object_initialize_child(..., &s->mch, ...) call inside
  * q35_host_initfn().  The default values for those
  * properties need to be initialized manually by
- * q35_host_initfn() after the object_initialize() call.
+ * q35_host_initfn() after the object_initialize_child() call.
  */
 static Property q35_host_props[] = {
     DEFINE_PROP_UINT64(PCIE_HOST_MCFG_BASE, Q35PCIHost, parent_obj.base_addr,
@@ -211,7 +211,7 @@ static void q35_host_initfn(Object *obj)
     object_initialize_child(OBJECT(s), "mch", &s->mch, TYPE_MCH_PCI_DEVICE);
     qdev_prop_set_int32(DEVICE(&s->mch), "addr", PCI_DEVFN(0, 0));
     qdev_prop_set_bit(DEVICE(&s->mch), "multifunction", false);
-    /* mch's object_initialize resets the default value, set it again */
+    /* mch's object_initialize_child resets the default value, set it again */
     qdev_prop_set_uint64(DEVICE(s), PCI_HOST_PROP_PCI_HOLE64_SIZE,
                          Q35_PCI_HOST_HOLE64_SIZE_DEFAULT);
     object_property_add(obj, PCI_HOST_PROP_PCI_HOLE_START, "uint32",
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 13/21] hw/pci-host/raven: Embedded OrIRQ in PRePPCIState
  2024-02-16 11:02 [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé
                   ` (11 preceding siblings ...)
  2024-02-16 11:03 ` [PATCH 12/21] hw/pci-host/q35: Update q35_host_props[] comment Philippe Mathieu-Daudé
@ 2024-02-16 11:03 ` Philippe Mathieu-Daudé
  2024-02-16 11:03 ` [PATCH 14/21] hw/pci-host/raven: Prefer object_initialize_child over object_initialize Philippe Mathieu-Daudé
                   ` (8 subsequent siblings)
  21 siblings, 0 replies; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-16 11:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Philippe Mathieu-Daudé, Hervé Poussineau

Since we know the size of the OrIRQ object, we can initialize
it directly in place with object_initialize_child(). Doing so
we also set the QOM parent <-> child relationship.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/pci-host/raven.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c
index c7a0a2878a..9e47caebc5 100644
--- a/hw/pci-host/raven.c
+++ b/hw/pci-host/raven.c
@@ -60,7 +60,7 @@ DECLARE_INSTANCE_CHECKER(PREPPCIState, RAVEN_PCI_HOST_BRIDGE,
 struct PRePPCIState {
     PCIHostState parent_obj;
 
-    OrIRQState *or_irq;
+    OrIRQState or_irq;
     qemu_irq pci_irqs[PCI_NUM_PINS];
     PCIBus pci_bus;
     AddressSpace pci_io_as;
@@ -249,14 +249,14 @@ static void raven_pcihost_realizefn(DeviceState *d, Error **errp)
     } else {
         /* According to PReP specification section 6.1.6 "System Interrupt
          * Assignments", all PCI interrupts are routed via IRQ 15 */
-        s->or_irq = OR_IRQ(object_new(TYPE_OR_IRQ));
-        object_property_set_int(OBJECT(s->or_irq), "num-lines", PCI_NUM_PINS,
+        object_initialize_child(OBJECT(dev), "or-irq", &s->or_irq, TYPE_OR_IRQ);
+        object_property_set_int(OBJECT(&s->or_irq), "num-lines", PCI_NUM_PINS,
                                 &error_fatal);
-        qdev_realize(DEVICE(s->or_irq), NULL, &error_fatal);
-        sysbus_init_irq(dev, &s->or_irq->out_irq);
+        qdev_realize(DEVICE(&s->or_irq), NULL, &error_fatal);
+        sysbus_init_irq(dev, &s->or_irq.out_irq);
 
         for (i = 0; i < PCI_NUM_PINS; i++) {
-            s->pci_irqs[i] = qdev_get_gpio_in(DEVICE(s->or_irq), i);
+            s->pci_irqs[i] = qdev_get_gpio_in(DEVICE(&s->or_irq), i);
         }
     }
 
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 14/21] hw/pci-host/raven: Prefer object_initialize_child over object_initialize
  2024-02-16 11:02 [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé
                   ` (12 preceding siblings ...)
  2024-02-16 11:03 ` [PATCH 13/21] hw/pci-host/raven: Embedded OrIRQ in PRePPCIState Philippe Mathieu-Daudé
@ 2024-02-16 11:03 ` Philippe Mathieu-Daudé
  2024-02-16 11:03 ` [PATCH 15/21] hw/core/register: " Philippe Mathieu-Daudé
                   ` (7 subsequent siblings)
  21 siblings, 0 replies; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-16 11:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Philippe Mathieu-Daudé, Hervé Poussineau

When the QOM parent is available, prefer object_initialize_child()
over object_initialize(), since it create the parent relationship.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/pci-host/raven.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c
index 9e47caebc5..5ef25edba6 100644
--- a/hw/pci-host/raven.c
+++ b/hw/pci-host/raven.c
@@ -290,7 +290,6 @@ static void raven_pcihost_initfn(Object *obj)
     PCIHostState *h = PCI_HOST_BRIDGE(obj);
     PREPPCIState *s = RAVEN_PCI_HOST_BRIDGE(obj);
     MemoryRegion *address_space_mem = get_system_memory();
-    DeviceState *pci_dev;
 
     memory_region_init(&s->pci_io, obj, "pci-io", 0x3f800000);
     memory_region_init_io(&s->pci_io_non_contiguous, obj, &raven_io_ops, s,
@@ -328,11 +327,10 @@ static void raven_pcihost_initfn(Object *obj)
 
     h->bus = &s->pci_bus;
 
-    object_initialize(&s->pci_dev, sizeof(s->pci_dev), TYPE_RAVEN_PCI_DEVICE);
-    pci_dev = DEVICE(&s->pci_dev);
+    object_initialize_child(obj, "bridge", &s->pci_dev, TYPE_RAVEN_PCI_DEVICE);
     object_property_set_int(OBJECT(&s->pci_dev), "addr", PCI_DEVFN(0, 0),
                             NULL);
-    qdev_prop_set_bit(pci_dev, "multifunction", false);
+    qdev_prop_set_bit(DEVICE(&s->pci_dev), "multifunction", false);
 }
 
 static void raven_realize(PCIDevice *d, Error **errp)
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 15/21] hw/core/register: Prefer object_initialize_child over object_initialize
  2024-02-16 11:02 [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé
                   ` (13 preceding siblings ...)
  2024-02-16 11:03 ` [PATCH 14/21] hw/pci-host/raven: Prefer object_initialize_child over object_initialize Philippe Mathieu-Daudé
@ 2024-02-16 11:03 ` Philippe Mathieu-Daudé
  2024-02-16 11:03 ` [PATCH 16/21] hw/net/can/versal: " Philippe Mathieu-Daudé
                   ` (6 subsequent siblings)
  21 siblings, 0 replies; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-16 11:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Philippe Mathieu-Daudé, Alistair Francis

When the QOM parent is available, prefer object_initialize_child()
over object_initialize(), since it create the parent relationship.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/core/register.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/core/register.c b/hw/core/register.c
index 95b0150c0a..b6beca0e02 100644
--- a/hw/core/register.c
+++ b/hw/core/register.c
@@ -259,7 +259,7 @@ static RegisterInfoArray *register_init_block(DeviceState *owner,
         RegisterInfo *r = &ri[index];
 
         /* Init the register, this will zero it. */
-        object_initialize((void *)r, sizeof(*r), TYPE_REGISTER);
+        object_initialize_child(OBJECT(owner), "reg[*]", r, TYPE_REGISTER);
 
         /* Set the properties of the register */
         r->data = data + data_size * index;
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 16/21] hw/net/can/versal: Prefer object_initialize_child over object_initialize
  2024-02-16 11:02 [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé
                   ` (14 preceding siblings ...)
  2024-02-16 11:03 ` [PATCH 15/21] hw/core/register: " Philippe Mathieu-Daudé
@ 2024-02-16 11:03 ` Philippe Mathieu-Daudé
  2024-02-23 11:06   ` Francisco Iglesias
  2025-08-21 13:33   ` Peter Maydell
  2024-02-16 11:03 ` [PATCH 17/21] hw/i386/iommu: " Philippe Mathieu-Daudé
                   ` (5 subsequent siblings)
  21 siblings, 2 replies; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-16 11:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Philippe Mathieu-Daudé, Pavel Pisa, Vikram Garhwal,
	Francisco Iglesias, Jason Wang

When the QOM parent is available, prefer object_initialize_child()
over object_initialize(), since it create the parent relationship.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/net/can/xlnx-versal-canfd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/net/can/xlnx-versal-canfd.c b/hw/net/can/xlnx-versal-canfd.c
index 47a14cfe63..f8e4bd75e4 100644
--- a/hw/net/can/xlnx-versal-canfd.c
+++ b/hw/net/can/xlnx-versal-canfd.c
@@ -1900,7 +1900,7 @@ static int canfd_populate_regarray(XlnxVersalCANFDState *s,
         int index = rae[i].addr / 4;
         RegisterInfo *r = &s->reg_info[index];
 
-        object_initialize(r, sizeof(*r), TYPE_REGISTER);
+        object_initialize_child(OBJECT(s), "reg[*]", r, TYPE_REGISTER);
 
         *r = (RegisterInfo) {
             .data = &s->regs[index],
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 17/21] hw/i386/iommu: Prefer object_initialize_child over object_initialize
  2024-02-16 11:02 [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé
                   ` (15 preceding siblings ...)
  2024-02-16 11:03 ` [PATCH 16/21] hw/net/can/versal: " Philippe Mathieu-Daudé
@ 2024-02-16 11:03 ` Philippe Mathieu-Daudé
  2024-02-22  9:24   ` Zhao Liu
  2024-02-16 11:03 ` [PATCH 18/21] hw/pci-host/versatile: Replace object_initialize() -> _child() Philippe Mathieu-Daudé
                   ` (4 subsequent siblings)
  21 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-16 11:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Philippe Mathieu-Daudé, Michael S. Tsirkin, Marcel Apfelbaum,
	Paolo Bonzini, Richard Henderson, Eduardo Habkost

When the QOM parent is available, prefer object_initialize_child()
over object_initialize(), since it create the parent relationship.

Rename the 'klass' variable as 'obj' since the argument holds a
reference to an instance object and not a class one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/i386/amd_iommu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
index 7329553ad3..c3afbc4130 100644
--- a/hw/i386/amd_iommu.c
+++ b/hw/i386/amd_iommu.c
@@ -1616,11 +1616,11 @@ static const VMStateDescription vmstate_amdvi_sysbus = {
     .unmigratable = 1
 };
 
-static void amdvi_sysbus_instance_init(Object *klass)
+static void amdvi_sysbus_instance_init(Object *obj)
 {
-    AMDVIState *s = AMD_IOMMU_DEVICE(klass);
+    AMDVIState *s = AMD_IOMMU_DEVICE(obj);
 
-    object_initialize(&s->pci, sizeof(s->pci), TYPE_AMD_IOMMU_PCI);
+    object_initialize_child(obj, "iommu", &s->pci, TYPE_AMD_IOMMU_PCI);
 }
 
 static void amdvi_sysbus_class_init(ObjectClass *klass, void *data)
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 18/21] hw/pci-host/versatile: Replace object_initialize() -> _child()
  2024-02-16 11:02 [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé
                   ` (16 preceding siblings ...)
  2024-02-16 11:03 ` [PATCH 17/21] hw/i386/iommu: " Philippe Mathieu-Daudé
@ 2024-02-16 11:03 ` Philippe Mathieu-Daudé
  2024-02-16 11:03 ` [PATCH 19/21] hw/s390x/zpci-bus: Add QOM parentship relation with zPCI devices Philippe Mathieu-Daudé
                   ` (3 subsequent siblings)
  21 siblings, 0 replies; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-16 11:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Philippe Mathieu-Daudé, Peter Maydell

When the QOM parent is available, prefer object_initialize_child()
over object_initialize(), since it create the parent relationship.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/pci-host/versatile.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/pci-host/versatile.c b/hw/pci-host/versatile.c
index 0e65deb3f9..5d1f9cc96d 100644
--- a/hw/pci-host/versatile.c
+++ b/hw/pci-host/versatile.c
@@ -410,7 +410,8 @@ static void pci_vpb_realize(DeviceState *dev, Error **errp)
                       PCI_DEVFN(11, 0), TYPE_PCI_BUS);
     h->bus = &s->pci_bus;
 
-    object_initialize(&s->pci_dev, sizeof(s->pci_dev), TYPE_VERSATILE_PCI_HOST);
+    object_initialize_child(OBJECT(dev), "pci-func0",
+                            &s->pci_dev, TYPE_VERSATILE_PCI_HOST);
 
     for (i = 0; i < 4; i++) {
         sysbus_init_irq(sbd, &s->irq[i]);
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 19/21] hw/s390x/zpci-bus: Add QOM parentship relation with zPCI devices
  2024-02-16 11:02 [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé
                   ` (17 preceding siblings ...)
  2024-02-16 11:03 ` [PATCH 18/21] hw/pci-host/versatile: Replace object_initialize() -> _child() Philippe Mathieu-Daudé
@ 2024-02-16 11:03 ` Philippe Mathieu-Daudé
  2024-02-19 13:38   ` Thomas Huth
  2024-02-16 11:03 ` [PATCH 20/21] hw/arm/mps2: Add QOM parentship relation with OR IRQ gates Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  21 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-16 11:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Philippe Mathieu-Daudé, Matthew Rosato, Eric Farman,
	Richard Henderson, David Hildenbrand, Ilya Leoshkevich,
	Thomas Huth, Halil Pasic, Christian Borntraeger

QDev objects created with qdev_*new() need to manually add
their parent relationship with object_property_add_child().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/s390x/s390-pci-bus.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index 3e57d5faca..6d07a7b530 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -934,6 +934,7 @@ static S390PCIBusDevice *s390_pci_device_new(S390pciState *s,
                                 "zPCI device could not be created: ");
         return NULL;
     }
+    object_property_add_child(OBJECT(s), "zpci[*]", OBJECT(dev));
     if (!qdev_realize_and_unref(dev, BUS(s->bus), &local_err)) {
         object_unparent(OBJECT(dev));
         error_propagate_prepend(errp, local_err,
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 20/21] hw/arm/mps2: Add QOM parentship relation with OR IRQ gates
  2024-02-16 11:02 [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé
                   ` (18 preceding siblings ...)
  2024-02-16 11:03 ` [PATCH 19/21] hw/s390x/zpci-bus: Add QOM parentship relation with zPCI devices Philippe Mathieu-Daudé
@ 2024-02-16 11:03 ` Philippe Mathieu-Daudé
  2024-02-16 11:03 ` [PATCH 21/21] hw: Add QOM parentship relation with CPUs Philippe Mathieu-Daudé
  2025-01-12 17:23 ` [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé
  21 siblings, 0 replies; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-16 11:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Philippe Mathieu-Daudé, Peter Maydell

QDev objects created with object_new() need to manually add
their parent relationship with object_property_add_child().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
Better would be to embedded an call object_initialize_child()...
---
 hw/arm/mps2.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c
index 50919ee46d..780f2adf0f 100644
--- a/hw/arm/mps2.c
+++ b/hw/arm/mps2.c
@@ -274,6 +274,7 @@ static void mps2_common_init(MachineState *machine)
 
         orgate = object_new(TYPE_OR_IRQ);
         object_property_set_int(orgate, "num-lines", 6, &error_fatal);
+        object_property_add_child(OBJECT(machine), "orgate12", orgate);
         qdev_realize(DEVICE(orgate), NULL, &error_fatal);
         orgate_dev = DEVICE(orgate);
         qdev_connect_gpio_out(orgate_dev, 0, qdev_get_gpio_in(armv7m, 12));
@@ -317,6 +318,7 @@ static void mps2_common_init(MachineState *machine)
 
         orgate = object_new(TYPE_OR_IRQ);
         object_property_set_int(orgate, "num-lines", 10, &error_fatal);
+        object_property_add_child(OBJECT(machine), "orgate-12", orgate);
         qdev_realize(DEVICE(orgate), NULL, &error_fatal);
         orgate_dev = DEVICE(orgate);
         qdev_connect_gpio_out(orgate_dev, 0, qdev_get_gpio_in(armv7m, 12));
@@ -333,6 +335,8 @@ static void mps2_common_init(MachineState *machine)
 
             txrx_orgate = object_new(TYPE_OR_IRQ);
             object_property_set_int(txrx_orgate, "num-lines", 2, &error_fatal);
+            object_property_add_child(OBJECT(machine),
+                                      "orgate-uart[*]", txrx_orgate);
             qdev_realize(DEVICE(txrx_orgate), NULL, &error_fatal);
             txrx_orgate_dev = DEVICE(txrx_orgate);
             qdev_connect_gpio_out(txrx_orgate_dev, 0,
@@ -425,6 +429,7 @@ static void mps2_common_init(MachineState *machine)
 
         orgate = object_new(TYPE_OR_IRQ);
         object_property_set_int(orgate, "num-lines", 2, &error_fatal);
+        object_property_add_child(OBJECT(machine), "orgate-ssi[*]", orgate);
         orgate_dev = DEVICE(orgate);
         qdev_realize(orgate_dev, NULL, &error_fatal);
         qdev_connect_gpio_out(orgate_dev, 0,
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 21/21] hw: Add QOM parentship relation with CPUs
  2024-02-16 11:02 [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé
                   ` (19 preceding siblings ...)
  2024-02-16 11:03 ` [PATCH 20/21] hw/arm/mps2: Add QOM parentship relation with OR IRQ gates Philippe Mathieu-Daudé
@ 2024-02-16 11:03 ` Philippe Mathieu-Daudé
  2024-02-22  9:59   ` Zhao Liu
  2025-01-12 17:23 ` [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé
  21 siblings, 1 reply; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-16 11:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Philippe Mathieu-Daudé, Michael S. Tsirkin, Marcel Apfelbaum,
	Paolo Bonzini, Richard Henderson, Eduardo Habkost,
	Edgar E. Iglesias, Chris Wulff, Marek Vasut, Nicholas Piggin,
	Daniel Henrique Barboza, Cédric Le Goater, David Gibson,
	Harsh Prateek Bora

QDev objects created with object_new() need to manually add
their parent relationship with object_property_add_child().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/i386/x86.c                            | 1 +
 hw/microblaze/petalogix_ml605_mmu.c      | 1 +
 hw/microblaze/petalogix_s3adsp1800_mmu.c | 1 +
 hw/mips/cps.c                            | 1 +
 hw/nios2/10m50_devboard.c                | 1 +
 hw/ppc/e500.c                            | 1 +
 hw/ppc/spapr.c                           | 1 +
 7 files changed, 7 insertions(+)

diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index 684dce90e9..7021419d91 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -102,6 +102,7 @@ void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id, Error **errp)
     if (!object_property_set_uint(cpu, "apic-id", apic_id, errp)) {
         goto out;
     }
+    object_property_add_child(OBJECT(x86ms), "cpu[*]", OBJECT(cpu));
     qdev_realize(DEVICE(cpu), NULL, errp);
 
 out:
diff --git a/hw/microblaze/petalogix_ml605_mmu.c b/hw/microblaze/petalogix_ml605_mmu.c
index 0f5fabc32e..dfd881322d 100644
--- a/hw/microblaze/petalogix_ml605_mmu.c
+++ b/hw/microblaze/petalogix_ml605_mmu.c
@@ -83,6 +83,7 @@ petalogix_ml605_init(MachineState *machine)
 
     /* init CPUs */
     cpu = MICROBLAZE_CPU(object_new(TYPE_MICROBLAZE_CPU));
+    object_property_add_child(OBJECT(machine), "cpu", OBJECT(cpu));
     object_property_set_str(OBJECT(cpu), "version", "8.10.a", &error_abort);
     /* Use FPU but don't use floating point conversion and square
      * root instructions
diff --git a/hw/microblaze/petalogix_s3adsp1800_mmu.c b/hw/microblaze/petalogix_s3adsp1800_mmu.c
index dad46bd7f9..255d8d4d47 100644
--- a/hw/microblaze/petalogix_s3adsp1800_mmu.c
+++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c
@@ -70,6 +70,7 @@ petalogix_s3adsp1800_init(MachineState *machine)
     MemoryRegion *sysmem = get_system_memory();
 
     cpu = MICROBLAZE_CPU(object_new(TYPE_MICROBLAZE_CPU));
+    object_property_add_child(OBJECT(machine), "cpu", OBJECT(cpu));
     object_property_set_str(OBJECT(cpu), "version", "7.10.d", &error_abort);
     qdev_realize(DEVICE(cpu), NULL, &error_abort);
 
diff --git a/hw/mips/cps.c b/hw/mips/cps.c
index 07b73b0a1f..6b4e918807 100644
--- a/hw/mips/cps.c
+++ b/hw/mips/cps.c
@@ -84,6 +84,7 @@ static void mips_cps_realize(DeviceState *dev, Error **errp)
         /* All cores use the same clock tree */
         qdev_connect_clock_in(DEVICE(cpu), "clk-in", s->clock);
 
+        object_property_add_child(OBJECT(dev), "cpu[*]", OBJECT(cpu));
         if (!qdev_realize_and_unref(DEVICE(cpu), NULL, errp)) {
             return;
         }
diff --git a/hw/nios2/10m50_devboard.c b/hw/nios2/10m50_devboard.c
index 6cb32f777b..f6a691d340 100644
--- a/hw/nios2/10m50_devboard.c
+++ b/hw/nios2/10m50_devboard.c
@@ -95,6 +95,7 @@ static void nios2_10m50_ghrd_init(MachineState *machine)
     cpu->exception_addr = 0xc8000120;
     cpu->fast_tlb_miss_addr = 0xc0000100;
 
+    object_property_add_child(OBJECT(machine), "cpu", OBJECT(cpu));
     qdev_realize_and_unref(DEVICE(cpu), NULL, &error_fatal);
 
     if (nms->vic) {
diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index 3bd12b54ab..77b7d2858c 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -956,6 +956,7 @@ void ppce500_init(MachineState *machine)
          */
         object_property_set_bool(OBJECT(cs), "start-powered-off", i != 0,
                                  &error_abort);
+        object_property_add_child(OBJECT(machine), "cpu[*]", OBJECT(cpu));
         qdev_realize_and_unref(DEVICE(cs), NULL, &error_fatal);
 
         if (!firstenv) {
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 0d72d286d8..b6e5caa0d2 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2715,6 +2715,7 @@ static void spapr_init_cpus(SpaprMachineState *spapr)
                                     &error_fatal);
             object_property_set_int(core, CPU_CORE_PROP_CORE_ID, core_id,
                                     &error_fatal);
+            object_property_add_child(OBJECT(spapr), "cpu[*]", OBJECT(core));
             qdev_realize(DEVICE(core), NULL, &error_fatal);
 
             object_unref(core);
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 41+ messages in thread

* Re: [PATCH 05/21] hw/ppc/pnv_bmc: Use qdev_new() instead of QOM API
  2024-02-16 11:02 ` [PATCH 05/21] hw/ppc/pnv_bmc: Use qdev_new() instead of QOM API Philippe Mathieu-Daudé
@ 2024-02-16 11:08   ` Cédric Le Goater
  0 siblings, 0 replies; 41+ messages in thread
From: Cédric Le Goater @ 2024-02-16 11:08 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-arm, qemu-s390x, qemu-ppc, qemu-block, Nicholas Piggin,
	Frédéric Barrat

On 2/16/24 12:02, Philippe Mathieu-Daudé wrote:
> Prefer QDev API for QDev objects, avoid the underlying QOM layer.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>


Reviewed-by: Cédric Le Goater <clg@kaod.org>

Thanks,

C.


> ---
>   hw/ppc/pnv_bmc.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/ppc/pnv_bmc.c b/hw/ppc/pnv_bmc.c
> index 99f1e8d7f9..0c1274df21 100644
> --- a/hw/ppc/pnv_bmc.c
> +++ b/hw/ppc/pnv_bmc.c
> @@ -269,13 +269,13 @@ void pnv_bmc_set_pnor(IPMIBmc *bmc, PnvPnor *pnor)
>    */
>   IPMIBmc *pnv_bmc_create(PnvPnor *pnor)
>   {
> -    Object *obj;
> +    DeviceState *dev;
>   
> -    obj = object_new(TYPE_IPMI_BMC_SIMULATOR);
> -    qdev_realize(DEVICE(obj), NULL, &error_fatal);
> -    pnv_bmc_set_pnor(IPMI_BMC(obj), pnor);
> +    dev = qdev_new(TYPE_IPMI_BMC_SIMULATOR);
> +    qdev_realize(dev, NULL, &error_fatal);
> +    pnv_bmc_set_pnor(IPMI_BMC(dev), pnor);
>   
> -    return IPMI_BMC(obj);
> +    return IPMI_BMC(dev);
>   }
>   
>   typedef struct ForeachArgs {



^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 04/21] hw/tricore/testboard: Use qdev_new() instead of QOM basic API
  2024-02-16 11:02 ` [PATCH 04/21] hw/tricore/testboard: Use qdev_new() instead of QOM basic API Philippe Mathieu-Daudé
@ 2024-02-19 11:59   ` Bastian Koppelmann
  0 siblings, 0 replies; 41+ messages in thread
From: Bastian Koppelmann @ 2024-02-19 11:59 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, qemu-arm, qemu-s390x, qemu-ppc, qemu-block

On Fri, Feb 16, 2024 at 12:02:55PM +0100, Philippe Mathieu-Daudé wrote:
> Prefer QDev API for QDev objects, avoid the underlying QOM layer.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  include/hw/tricore/tricore_testdevice.h | 3 ---
>  hw/tricore/tricore_testboard.c          | 4 +---
>  2 files changed, 1 insertion(+), 6 deletions(-)

Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>

Cheers,
Bastian


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 19/21] hw/s390x/zpci-bus: Add QOM parentship relation with zPCI devices
  2024-02-16 11:03 ` [PATCH 19/21] hw/s390x/zpci-bus: Add QOM parentship relation with zPCI devices Philippe Mathieu-Daudé
@ 2024-02-19 13:38   ` Thomas Huth
  2024-02-19 14:37     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 41+ messages in thread
From: Thomas Huth @ 2024-02-19 13:38 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-arm, qemu-s390x, qemu-ppc, qemu-block, Matthew Rosato,
	Eric Farman, Richard Henderson, David Hildenbrand,
	Ilya Leoshkevich, Halil Pasic, Christian Borntraeger

On 16/02/2024 12.03, Philippe Mathieu-Daudé wrote:
> QDev objects created with qdev_*new() need to manually add
> their parent relationship with object_property_add_child().
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/s390x/s390-pci-bus.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
> index 3e57d5faca..6d07a7b530 100644
> --- a/hw/s390x/s390-pci-bus.c
> +++ b/hw/s390x/s390-pci-bus.c
> @@ -934,6 +934,7 @@ static S390PCIBusDevice *s390_pci_device_new(S390pciState *s,
>                                   "zPCI device could not be created: ");
>           return NULL;
>       }
> +    object_property_add_child(OBJECT(s), "zpci[*]", OBJECT(dev));

I think there can only be one zpci device per PCI device, so do we need the 
"[*]" here?

  Thomas

>       if (!qdev_realize_and_unref(dev, BUS(s->bus), &local_err)) {
>           object_unparent(OBJECT(dev));
>           error_propagate_prepend(errp, local_err,



^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 19/21] hw/s390x/zpci-bus: Add QOM parentship relation with zPCI devices
  2024-02-19 13:38   ` Thomas Huth
@ 2024-02-19 14:37     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-19 14:37 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel
  Cc: qemu-arm, qemu-s390x, qemu-ppc, qemu-block, Matthew Rosato,
	Eric Farman, Richard Henderson, David Hildenbrand,
	Ilya Leoshkevich, Halil Pasic, Christian Borntraeger

On 19/2/24 14:38, Thomas Huth wrote:
> On 16/02/2024 12.03, Philippe Mathieu-Daudé wrote:
>> QDev objects created with qdev_*new() need to manually add
>> their parent relationship with object_property_add_child().
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>>   hw/s390x/s390-pci-bus.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
>> index 3e57d5faca..6d07a7b530 100644
>> --- a/hw/s390x/s390-pci-bus.c
>> +++ b/hw/s390x/s390-pci-bus.c
>> @@ -934,6 +934,7 @@ static S390PCIBusDevice 
>> *s390_pci_device_new(S390pciState *s,
>>                                   "zPCI device could not be created: ");
>>           return NULL;
>>       }
>> +    object_property_add_child(OBJECT(s), "zpci[*]", OBJECT(dev));
> 
> I think there can only be one zpci device per PCI device, so do we need 
> the "[*]" here?

Oh I missed that, I'll change, thanks.



^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 01/21] hw/i386/pc: Do not use C99 mixed-declarations style
  2024-02-16 11:02 ` [PATCH 01/21] hw/i386/pc: Do not use C99 mixed-declarations style Philippe Mathieu-Daudé
@ 2024-02-22  9:12   ` Zhao Liu
  2024-02-22 10:10     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 41+ messages in thread
From: Zhao Liu @ 2024-02-22  9:12 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Michael S. Tsirkin, Marcel Apfelbaum, Paolo Bonzini,
	Richard Henderson, Eduardo Habkost

Hi Philippe,

On Fri, Feb 16, 2024 at 12:02:52PM +0100, Philippe Mathieu-Daudé wrote:
> Date: Fri, 16 Feb 2024 12:02:52 +0100
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
> Subject: [PATCH 01/21] hw/i386/pc: Do not use C99 mixed-declarations style
> X-Mailer: git-send-email 2.41.0
> 
> QEMU's coding style generally forbids C99 mixed declarations.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  hw/i386/pc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 196827531a..3c00a87317 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1227,6 +1227,7 @@ void pc_basic_device_init(struct PCMachineState *pcms,
>       */
>      if (pcms->hpet_enabled) {
>          qemu_irq rtc_irq;
> +        uint8_t compat;
>  
>          hpet = qdev_try_new(TYPE_HPET);
>          if (!hpet) {
> @@ -1238,8 +1239,7 @@ void pc_basic_device_init(struct PCMachineState *pcms,
>           * use IRQ16~23, IRQ8 and IRQ2.  If the user has already set
>           * the property, use whatever mask they specified.
>           */
> -        uint8_t compat = object_property_get_uint(OBJECT(hpet),
> -                HPET_INTCAP, NULL);
> +        compat = object_property_get_uint(OBJECT(hpet), HPET_INTCAP, NULL);
>          if (!compat) {
>              qdev_prop_set_uint32(hpet, HPET_INTCAP, hpet_irqs);
>          }

"compat" is only used here to check. So, what about getting rid of this
variable?

if (!object_property_get_uint(OBJECT(hpet), HPET_INTCAP, NULL)) {
    qdev_prop_set_uint32(hpet, HPET_INTCAP, hpet_irqs);
}



^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 02/21] hw/i386/pc_sysfw: Use qdev_is_realized() instead of QOM API
  2024-02-16 11:02 ` [PATCH 02/21] hw/i386/pc_sysfw: Use qdev_is_realized() instead of QOM API Philippe Mathieu-Daudé
@ 2024-02-22  9:16   ` Zhao Liu
  0 siblings, 0 replies; 41+ messages in thread
From: Zhao Liu @ 2024-02-22  9:16 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Michael S. Tsirkin, Marcel Apfelbaum, Paolo Bonzini,
	Richard Henderson, Eduardo Habkost

On Fri, Feb 16, 2024 at 12:02:53PM +0100, Philippe Mathieu-Daudé wrote:
> Date: Fri, 16 Feb 2024 12:02:53 +0100
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
> Subject: [PATCH 02/21] hw/i386/pc_sysfw: Use qdev_is_realized() instead of
>  QOM API
> X-Mailer: git-send-email 2.41.0
> 
> Prefer QDev API for QDev objects, avoid the underlying QOM layer.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  hw/i386/pc_sysfw.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>

> 
> diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c
> index c8d9e71b88..3efabbbab2 100644
> --- a/hw/i386/pc_sysfw.c
> +++ b/hw/i386/pc_sysfw.c
> @@ -107,17 +107,15 @@ void pc_system_flash_cleanup_unused(PCMachineState *pcms)
>  {
>      char *prop_name;
>      int i;
> -    Object *dev_obj;
>  
>      assert(PC_MACHINE_GET_CLASS(pcms)->pci_enabled);
>  
>      for (i = 0; i < ARRAY_SIZE(pcms->flash); i++) {
> -        dev_obj = OBJECT(pcms->flash[i]);
> -        if (!object_property_get_bool(dev_obj, "realized", &error_abort)) {
> +        if (!qdev_is_realized(DEVICE(pcms->flash[i]))) {
>              prop_name = g_strdup_printf("pflash%d", i);
>              object_property_del(OBJECT(pcms), prop_name);
>              g_free(prop_name);
> -            object_unparent(dev_obj);
> +            object_unparent(OBJECT(pcms->flash[i]));
>              pcms->flash[i] = NULL;
>          }
>      }
> -- 
> 2.41.0
> 
> 


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 17/21] hw/i386/iommu: Prefer object_initialize_child over object_initialize
  2024-02-16 11:03 ` [PATCH 17/21] hw/i386/iommu: " Philippe Mathieu-Daudé
@ 2024-02-22  9:24   ` Zhao Liu
  0 siblings, 0 replies; 41+ messages in thread
From: Zhao Liu @ 2024-02-22  9:24 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Michael S. Tsirkin, Marcel Apfelbaum, Paolo Bonzini,
	Richard Henderson, Eduardo Habkost

Hi Philippe,

On Fri, Feb 16, 2024 at 12:03:08PM +0100, Philippe Mathieu-Daudé wrote:
> Date: Fri, 16 Feb 2024 12:03:08 +0100
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
> Subject: [PATCH 17/21] hw/i386/iommu: Prefer object_initialize_child over
>  object_initialize
> X-Mailer: git-send-email 2.41.0
> 
> When the QOM parent is available, prefer object_initialize_child()
> over object_initialize(), since it create the parent relationship.
> 
> Rename the 'klass' variable as 'obj' since the argument holds a
> reference to an instance object and not a class one.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  hw/i386/amd_iommu.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
> index 7329553ad3..c3afbc4130 100644
> --- a/hw/i386/amd_iommu.c
> +++ b/hw/i386/amd_iommu.c
> @@ -1616,11 +1616,11 @@ static const VMStateDescription vmstate_amdvi_sysbus = {
>      .unmigratable = 1
>  };
>  
> -static void amdvi_sysbus_instance_init(Object *klass)
> +static void amdvi_sysbus_instance_init(Object *obj)
>  {
> -    AMDVIState *s = AMD_IOMMU_DEVICE(klass);
> +    AMDVIState *s = AMD_IOMMU_DEVICE(obj);
>  
> -    object_initialize(&s->pci, sizeof(s->pci), TYPE_AMD_IOMMU_PCI);
> +    object_initialize_child(obj, "iommu", &s->pci, TYPE_AMD_IOMMU_PCI);

What about this name "amd-iommu"?

This is more accurate and differentiates it from the other intel-iommu
related implementations.

>  }
>  
>  static void amdvi_sysbus_class_init(ObjectClass *klass, void *data)
> -- 
> 2.41.0
> 
> 


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 11/21] hw/usb: Add QOM parentship relation with hub devices
  2024-02-16 11:03 ` [PATCH 11/21] hw/usb: Add QOM parentship relation with hub devices Philippe Mathieu-Daudé
@ 2024-02-22  9:49   ` Zhao Liu
  0 siblings, 0 replies; 41+ messages in thread
From: Zhao Liu @ 2024-02-22  9:49 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Gerd Hoffmann

Hi Philippe,

On Fri, Feb 16, 2024 at 12:03:02PM +0100, Philippe Mathieu-Daudé wrote:
> Date: Fri, 16 Feb 2024 12:03:02 +0100
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
> Subject: [PATCH 11/21] hw/usb: Add QOM parentship relation with hub devices
> X-Mailer: git-send-email 2.41.0
> 
> QDev objects created with qdev_*new() need to manually add
> their parent relationship with object_property_add_child().
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  hw/usb/bus.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/usb/bus.c b/hw/usb/bus.c
> index a599e2552b..baad04f466 100644
> --- a/hw/usb/bus.c
> +++ b/hw/usb/bus.c
> @@ -439,6 +439,7 @@ void usb_claim_port(USBDevice *dev, Error **errp)
>              /* Create a new hub and chain it on */
>              hub = USB_DEVICE(qdev_try_new("usb-hub"));

One additional question comes to mind, should we use the qdev_new()
here?

The difference between qdev_try_new() and qdev_new() is the latter
uses assert() to ensure the passed type exists.

So if we know that type parameter is correct, we should just use
qdev_new().

Only when the caller is not sure whether the type is valid,
qdev_try_new() should be preferred.

Am I understand correctly? ;-)

>              if (hub) {
> +                object_property_add_child(OBJECT(dev), "hub", OBJECT(hub));

From the comment above the code:

/* Create a new hub and chain it on */

this only creates a new usb-hub, should the new usb-hub become the child
object of the original usb-hub?

>                  usb_realize_and_unref(hub, bus, NULL);
>              }
>          }
> -- 
> 2.41.0
> 
> 


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 06/21] hw: Replace DEVICE(object_new) -> qdev_new()
  2024-02-16 11:02 ` [PATCH 06/21] hw: Replace DEVICE(object_new) -> qdev_new() Philippe Mathieu-Daudé
@ 2024-02-22  9:50   ` Zhao Liu
  0 siblings, 0 replies; 41+ messages in thread
From: Zhao Liu @ 2024-02-22  9:50 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Jan Kiszka, Peter Maydell, Paolo Bonzini, Daniel P. Berrangé,
	Eduardo Habkost, Mark Cave-Ayland, Artyom Tarasenko

On Fri, Feb 16, 2024 at 12:02:57PM +0100, Philippe Mathieu-Daudé wrote:
> Date: Fri, 16 Feb 2024 12:02:57 +0100
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
> Subject: [PATCH 06/21] hw: Replace DEVICE(object_new) -> qdev_new()
> X-Mailer: git-send-email 2.41.0
> 
> Prefer QDev API for QDev objects, avoid the underlying QOM layer.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  hw/arm/musicpal.c | 2 +-
>  hw/core/qdev.c    | 2 +-
>  hw/sparc/sun4m.c  | 4 ++--
>  3 files changed, 4 insertions(+), 4 deletions(-)

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>

> 
> diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
> index 2020f73a57..74e4d24aab 100644
> --- a/hw/arm/musicpal.c
> +++ b/hw/arm/musicpal.c
> @@ -1238,7 +1238,7 @@ static void musicpal_init(MachineState *machine)
>                            qdev_get_gpio_in(pic, MP_TIMER4_IRQ), NULL);
>  
>      /* Logically OR both UART IRQs together */
> -    uart_orgate = DEVICE(object_new(TYPE_OR_IRQ));
> +    uart_orgate = qdev_new(TYPE_OR_IRQ);
>      object_property_set_int(OBJECT(uart_orgate), "num-lines", 2, &error_fatal);
>      qdev_realize_and_unref(uart_orgate, NULL, &error_fatal);
>      qdev_connect_gpio_out(uart_orgate, 0,
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index c68d0f7c51..a271380d20 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -171,7 +171,7 @@ DeviceState *qdev_try_new(const char *name)
>      if (!module_object_class_by_name(name)) {
>          return NULL;
>      }
> -    return DEVICE(object_new(name));
> +    return qdev_new(name);
>  }
>  
>  static QTAILQ_HEAD(, DeviceListener) device_listeners
> diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
> index d52e6a7213..fedc4b8b3f 100644
> --- a/hw/sparc/sun4m.c
> +++ b/hw/sparc/sun4m.c
> @@ -979,7 +979,7 @@ static void sun4m_hw_init(MachineState *machine)
>      sysbus_mmio_map(s, 0, hwdef->ms_kb_base);
>  
>      /* Logically OR both its IRQs together */
> -    ms_kb_orgate = DEVICE(object_new(TYPE_OR_IRQ));
> +    ms_kb_orgate = qdev_new(TYPE_OR_IRQ);
>      object_property_set_int(OBJECT(ms_kb_orgate), "num-lines", 2, &error_fatal);
>      qdev_realize_and_unref(ms_kb_orgate, NULL, &error_fatal);
>      sysbus_connect_irq(s, 0, qdev_get_gpio_in(ms_kb_orgate, 0));
> @@ -1000,7 +1000,7 @@ static void sun4m_hw_init(MachineState *machine)
>      sysbus_mmio_map(s, 0, hwdef->serial_base);
>  
>      /* Logically OR both its IRQs together */
> -    serial_orgate = DEVICE(object_new(TYPE_OR_IRQ));
> +    serial_orgate = qdev_new(TYPE_OR_IRQ);
>      object_property_set_int(OBJECT(serial_orgate), "num-lines", 2,
>                              &error_fatal);
>      qdev_realize_and_unref(serial_orgate, NULL, &error_fatal);
> -- 
> 2.41.0
> 
> 


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 09/21] hw/usb: Inline usb_try_new()
  2024-02-16 11:03 ` [PATCH 09/21] hw/usb: Inline usb_try_new() Philippe Mathieu-Daudé
@ 2024-02-22  9:53   ` Zhao Liu
  0 siblings, 0 replies; 41+ messages in thread
From: Zhao Liu @ 2024-02-22  9:53 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Gerd Hoffmann

On Fri, Feb 16, 2024 at 12:03:00PM +0100, Philippe Mathieu-Daudé wrote:
> Date: Fri, 16 Feb 2024 12:03:00 +0100
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
> Subject: [PATCH 09/21] hw/usb: Inline usb_try_new()
> X-Mailer: git-send-email 2.41.0
> 
> Inline the single use of usb_try_new().
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  hw/usb/bus.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>

> 
> diff --git a/hw/usb/bus.c b/hw/usb/bus.c
> index 59c39945dd..148224f06a 100644
> --- a/hw/usb/bus.c
> +++ b/hw/usb/bus.c
> @@ -334,11 +334,6 @@ USBDevice *usb_new(const char *name)
>      return USB_DEVICE(qdev_new(name));
>  }
>  
> -static USBDevice *usb_try_new(const char *name)
> -{
> -    return USB_DEVICE(qdev_try_new(name));
> -}
> -
>  bool usb_realize_and_unref(USBDevice *dev, USBBus *bus, Error **errp)
>  {
>      return qdev_realize_and_unref(&dev->qdev, &bus->qbus, errp);
> @@ -447,7 +442,7 @@ void usb_claim_port(USBDevice *dev, Error **errp)
>      } else {
>          if (bus->nfree == 1 && strcmp(object_get_typename(OBJECT(dev)), "usb-hub") != 0) {
>              /* Create a new hub and chain it on */
> -            hub = usb_try_new("usb-hub");
> +            hub = USB_DEVICE(qdev_try_new("usb-hub"));
>              if (hub) {
>                  usb_realize_and_unref(hub, bus, NULL);
>              }
> -- 
> 2.41.0
> 
> 


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 07/21] target: Replace DEVICE(object_new) -> qdev_new()
  2024-02-16 11:02 ` [PATCH 07/21] target: " Philippe Mathieu-Daudé
@ 2024-02-22  9:54   ` Zhao Liu
  0 siblings, 0 replies; 41+ messages in thread
From: Zhao Liu @ 2024-02-22  9:54 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Aurelien Jarno, Jiaxun Yang, Aleksandar Rikalo, Max Filippov

On Fri, Feb 16, 2024 at 12:02:58PM +0100, Philippe Mathieu-Daudé wrote:
> Date: Fri, 16 Feb 2024 12:02:58 +0100
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
> Subject: [PATCH 07/21] target: Replace DEVICE(object_new) -> qdev_new()
> X-Mailer: git-send-email 2.41.0
> 
> Prefer QDev API for QDev objects, avoid the underlying QOM layer.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  target/mips/cpu.c   | 2 +-
>  target/xtensa/cpu.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>

> 
> diff --git a/target/mips/cpu.c b/target/mips/cpu.c
> index d644adbc77..6b3909ee08 100644
> --- a/target/mips/cpu.c
> +++ b/target/mips/cpu.c
> @@ -649,7 +649,7 @@ MIPSCPU *mips_cpu_create_with_clock(const char *cpu_type, Clock *cpu_refclk)
>  {
>      DeviceState *cpu;
>  
> -    cpu = DEVICE(object_new(cpu_type));
> +    cpu = qdev_new(cpu_type);
>      qdev_connect_clock_in(cpu, "clk-in", cpu_refclk);
>      qdev_realize(cpu, NULL, &error_abort);
>  
> diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c
> index 79f91819df..4f9408e1a0 100644
> --- a/target/xtensa/cpu.c
> +++ b/target/xtensa/cpu.c
> @@ -205,7 +205,7 @@ XtensaCPU *xtensa_cpu_create_with_clock(const char *cpu_type, Clock *cpu_refclk)
>  {
>      DeviceState *cpu;
>  
> -    cpu = DEVICE(object_new(cpu_type));
> +    cpu = qdev_new(cpu_type);
>      qdev_connect_clock_in(cpu, "clk-in", cpu_refclk);
>      qdev_realize(cpu, NULL, &error_abort);
>  
> -- 
> 2.41.0
> 
> 


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 10/21] hw/usb: Inline usb_new()
  2024-02-16 11:03 ` [PATCH 10/21] hw/usb: Inline usb_new() Philippe Mathieu-Daudé
@ 2024-02-22  9:55   ` Zhao Liu
  0 siblings, 0 replies; 41+ messages in thread
From: Zhao Liu @ 2024-02-22  9:55 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Gerd Hoffmann, Samuel Thibault

On Fri, Feb 16, 2024 at 12:03:01PM +0100, Philippe Mathieu-Daudé wrote:
> Date: Fri, 16 Feb 2024 12:03:01 +0100
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
> Subject: [PATCH 10/21] hw/usb: Inline usb_new()
> X-Mailer: git-send-email 2.41.0
> 
> Inline the 2 uses of usb_new().
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  include/hw/usb.h    | 1 -
>  hw/usb/bus.c        | 9 ++-------
>  hw/usb/dev-serial.c | 2 +-
>  3 files changed, 3 insertions(+), 9 deletions(-)

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>

> 
> diff --git a/include/hw/usb.h b/include/hw/usb.h
> index 32c23a5ca2..2d820685cc 100644
> --- a/include/hw/usb.h
> +++ b/include/hw/usb.h
> @@ -500,7 +500,6 @@ void usb_bus_release(USBBus *bus);
>  USBBus *usb_bus_find(int busnr);
>  void usb_legacy_register(const char *typename, const char *usbdevice_name,
>                           USBDevice *(*usbdevice_init)(void));
> -USBDevice *usb_new(const char *name);
>  bool usb_realize_and_unref(USBDevice *dev, USBBus *bus, Error **errp);
>  USBDevice *usb_create_simple(USBBus *bus, const char *name);
>  USBDevice *usbdevice_create(const char *cmdline);
> diff --git a/hw/usb/bus.c b/hw/usb/bus.c
> index 148224f06a..a599e2552b 100644
> --- a/hw/usb/bus.c
> +++ b/hw/usb/bus.c
> @@ -329,11 +329,6 @@ void usb_legacy_register(const char *typename, const char *usbdevice_name,
>      }
>  }
>  
> -USBDevice *usb_new(const char *name)
> -{
> -    return USB_DEVICE(qdev_new(name));
> -}
> -
>  bool usb_realize_and_unref(USBDevice *dev, USBBus *bus, Error **errp)
>  {
>      return qdev_realize_and_unref(&dev->qdev, &bus->qbus, errp);
> @@ -341,7 +336,7 @@ bool usb_realize_and_unref(USBDevice *dev, USBBus *bus, Error **errp)
>  
>  USBDevice *usb_create_simple(USBBus *bus, const char *name)
>  {
> -    USBDevice *dev = usb_new(name);
> +    USBDevice *dev = USB_DEVICE(qdev_new(name));
>  
>      usb_realize_and_unref(dev, bus, &error_abort);
>      return dev;
> @@ -693,7 +688,7 @@ USBDevice *usbdevice_create(const char *driver)
>          return NULL;
>      }
>  
> -    dev = f->usbdevice_init ? f->usbdevice_init() : usb_new(f->name);
> +    dev = f->usbdevice_init ? f->usbdevice_init() : USB_DEVICE(qdev_new(f->name));
>      if (!dev) {
>          error_report("Failed to create USB device '%s'", f->name);
>          return NULL;
> diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c
> index 63047d79cf..6e79c46d53 100644
> --- a/hw/usb/dev-serial.c
> +++ b/hw/usb/dev-serial.c
> @@ -624,7 +624,7 @@ static USBDevice *usb_braille_init(void)
>          return NULL;
>      }
>  
> -    dev = usb_new("usb-braille");
> +    dev = USB_DEVICE(qdev_new("usb-braille"));
>      qdev_prop_set_chr(&dev->qdev, "chardev", cdrv);
>      return dev;
>  }
> -- 
> 2.41.0
> 
> 


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 03/21] hw/ppc/spapr_cpu: Use qdev_is_realized() instead of QOM API
  2024-02-16 11:02 ` [PATCH 03/21] hw/ppc/spapr_cpu: " Philippe Mathieu-Daudé
@ 2024-02-22  9:56   ` Zhao Liu
  0 siblings, 0 replies; 41+ messages in thread
From: Zhao Liu @ 2024-02-22  9:56 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Nicholas Piggin, Daniel Henrique Barboza, Cédric Le Goater,
	David Gibson, Harsh Prateek Bora

On Fri, Feb 16, 2024 at 12:02:54PM +0100, Philippe Mathieu-Daudé wrote:
> Date: Fri, 16 Feb 2024 12:02:54 +0100
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
> Subject: [PATCH 03/21] hw/ppc/spapr_cpu: Use qdev_is_realized() instead of
>  QOM API
> X-Mailer: git-send-email 2.41.0
> 
> Prefer QDev API for QDev objects, avoid the underlying QOM layer.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  hw/ppc/spapr_cpu_core.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>

> 
> diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
> index 0c0fb3f1b0..40b7c52f7f 100644
> --- a/hw/ppc/spapr_cpu_core.c
> +++ b/hw/ppc/spapr_cpu_core.c
> @@ -245,8 +245,7 @@ static void spapr_cpu_core_unrealize(DeviceState *dev)
>               * spapr_cpu_core_realize(), make sure we only unrealize
>               * vCPUs that have already been realized.
>               */
> -            if (object_property_get_bool(OBJECT(sc->threads[i]), "realized",
> -                                         &error_abort)) {
> +            if (qdev_is_realized(DEVICE(sc->threads[i]))) {
>                  spapr_unrealize_vcpu(sc->threads[i], sc);
>              }
>              spapr_delete_vcpu(sc->threads[i]);
> -- 
> 2.41.0
> 
> 


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 21/21] hw: Add QOM parentship relation with CPUs
  2024-02-16 11:03 ` [PATCH 21/21] hw: Add QOM parentship relation with CPUs Philippe Mathieu-Daudé
@ 2024-02-22  9:59   ` Zhao Liu
  0 siblings, 0 replies; 41+ messages in thread
From: Zhao Liu @ 2024-02-22  9:59 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Michael S. Tsirkin, Marcel Apfelbaum, Paolo Bonzini,
	Richard Henderson, Eduardo Habkost, Edgar E. Iglesias,
	Chris Wulff, Marek Vasut, Nicholas Piggin,
	Daniel Henrique Barboza, Cédric Le Goater, David Gibson,
	Harsh Prateek Bora

On Fri, Feb 16, 2024 at 12:03:12PM +0100, Philippe Mathieu-Daudé wrote:
> Date: Fri, 16 Feb 2024 12:03:12 +0100
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
> Subject: [PATCH 21/21] hw: Add QOM parentship relation with CPUs
> X-Mailer: git-send-email 2.41.0
> 
> QDev objects created with object_new() need to manually add
> their parent relationship with object_property_add_child().
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  hw/i386/x86.c                            | 1 +
>  hw/microblaze/petalogix_ml605_mmu.c      | 1 +
>  hw/microblaze/petalogix_s3adsp1800_mmu.c | 1 +
>  hw/mips/cps.c                            | 1 +
>  hw/nios2/10m50_devboard.c                | 1 +
>  hw/ppc/e500.c                            | 1 +
>  hw/ppc/spapr.c                           | 1 +
>  7 files changed, 7 insertions(+)

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>

> 
> diff --git a/hw/i386/x86.c b/hw/i386/x86.c
> index 684dce90e9..7021419d91 100644
> --- a/hw/i386/x86.c
> +++ b/hw/i386/x86.c
> @@ -102,6 +102,7 @@ void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id, Error **errp)
>      if (!object_property_set_uint(cpu, "apic-id", apic_id, errp)) {
>          goto out;
>      }
> +    object_property_add_child(OBJECT(x86ms), "cpu[*]", OBJECT(cpu));
>      qdev_realize(DEVICE(cpu), NULL, errp);
>  
>  out:
> diff --git a/hw/microblaze/petalogix_ml605_mmu.c b/hw/microblaze/petalogix_ml605_mmu.c
> index 0f5fabc32e..dfd881322d 100644
> --- a/hw/microblaze/petalogix_ml605_mmu.c
> +++ b/hw/microblaze/petalogix_ml605_mmu.c
> @@ -83,6 +83,7 @@ petalogix_ml605_init(MachineState *machine)
>  
>      /* init CPUs */
>      cpu = MICROBLAZE_CPU(object_new(TYPE_MICROBLAZE_CPU));
> +    object_property_add_child(OBJECT(machine), "cpu", OBJECT(cpu));
>      object_property_set_str(OBJECT(cpu), "version", "8.10.a", &error_abort);
>      /* Use FPU but don't use floating point conversion and square
>       * root instructions
> diff --git a/hw/microblaze/petalogix_s3adsp1800_mmu.c b/hw/microblaze/petalogix_s3adsp1800_mmu.c
> index dad46bd7f9..255d8d4d47 100644
> --- a/hw/microblaze/petalogix_s3adsp1800_mmu.c
> +++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c
> @@ -70,6 +70,7 @@ petalogix_s3adsp1800_init(MachineState *machine)
>      MemoryRegion *sysmem = get_system_memory();
>  
>      cpu = MICROBLAZE_CPU(object_new(TYPE_MICROBLAZE_CPU));
> +    object_property_add_child(OBJECT(machine), "cpu", OBJECT(cpu));
>      object_property_set_str(OBJECT(cpu), "version", "7.10.d", &error_abort);
>      qdev_realize(DEVICE(cpu), NULL, &error_abort);
>  
> diff --git a/hw/mips/cps.c b/hw/mips/cps.c
> index 07b73b0a1f..6b4e918807 100644
> --- a/hw/mips/cps.c
> +++ b/hw/mips/cps.c
> @@ -84,6 +84,7 @@ static void mips_cps_realize(DeviceState *dev, Error **errp)
>          /* All cores use the same clock tree */
>          qdev_connect_clock_in(DEVICE(cpu), "clk-in", s->clock);
>  
> +        object_property_add_child(OBJECT(dev), "cpu[*]", OBJECT(cpu));
>          if (!qdev_realize_and_unref(DEVICE(cpu), NULL, errp)) {
>              return;
>          }
> diff --git a/hw/nios2/10m50_devboard.c b/hw/nios2/10m50_devboard.c
> index 6cb32f777b..f6a691d340 100644
> --- a/hw/nios2/10m50_devboard.c
> +++ b/hw/nios2/10m50_devboard.c
> @@ -95,6 +95,7 @@ static void nios2_10m50_ghrd_init(MachineState *machine)
>      cpu->exception_addr = 0xc8000120;
>      cpu->fast_tlb_miss_addr = 0xc0000100;
>  
> +    object_property_add_child(OBJECT(machine), "cpu", OBJECT(cpu));
>      qdev_realize_and_unref(DEVICE(cpu), NULL, &error_fatal);
>  
>      if (nms->vic) {
> diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
> index 3bd12b54ab..77b7d2858c 100644
> --- a/hw/ppc/e500.c
> +++ b/hw/ppc/e500.c
> @@ -956,6 +956,7 @@ void ppce500_init(MachineState *machine)
>           */
>          object_property_set_bool(OBJECT(cs), "start-powered-off", i != 0,
>                                   &error_abort);
> +        object_property_add_child(OBJECT(machine), "cpu[*]", OBJECT(cpu));
>          qdev_realize_and_unref(DEVICE(cs), NULL, &error_fatal);
>  
>          if (!firstenv) {
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 0d72d286d8..b6e5caa0d2 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -2715,6 +2715,7 @@ static void spapr_init_cpus(SpaprMachineState *spapr)
>                                      &error_fatal);
>              object_property_set_int(core, CPU_CORE_PROP_CORE_ID, core_id,
>                                      &error_fatal);
> +            object_property_add_child(OBJECT(spapr), "cpu[*]", OBJECT(core));
>              qdev_realize(DEVICE(core), NULL, &error_fatal);
>  
>              object_unref(core);
> -- 
> 2.41.0
> 
> 


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 01/21] hw/i386/pc: Do not use C99 mixed-declarations style
  2024-02-22  9:12   ` Zhao Liu
@ 2024-02-22 10:10     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-22 10:10 UTC (permalink / raw)
  To: Zhao Liu
  Cc: qemu-devel, qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Michael S. Tsirkin, Marcel Apfelbaum, Paolo Bonzini,
	Richard Henderson, Eduardo Habkost

On 22/2/24 10:12, Zhao Liu wrote:
> Hi Philippe,
> 
> On Fri, Feb 16, 2024 at 12:02:52PM +0100, Philippe Mathieu-Daudé wrote:
>> Date: Fri, 16 Feb 2024 12:02:52 +0100
>> From: Philippe Mathieu-Daudé <philmd@linaro.org>
>> Subject: [PATCH 01/21] hw/i386/pc: Do not use C99 mixed-declarations style
>> X-Mailer: git-send-email 2.41.0
>>
>> QEMU's coding style generally forbids C99 mixed declarations.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>>   hw/i386/pc.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
>> index 196827531a..3c00a87317 100644
>> --- a/hw/i386/pc.c
>> +++ b/hw/i386/pc.c
>> @@ -1227,6 +1227,7 @@ void pc_basic_device_init(struct PCMachineState *pcms,
>>        */
>>       if (pcms->hpet_enabled) {
>>           qemu_irq rtc_irq;
>> +        uint8_t compat;
>>   
>>           hpet = qdev_try_new(TYPE_HPET);
>>           if (!hpet) {
>> @@ -1238,8 +1239,7 @@ void pc_basic_device_init(struct PCMachineState *pcms,
>>            * use IRQ16~23, IRQ8 and IRQ2.  If the user has already set
>>            * the property, use whatever mask they specified.
>>            */
>> -        uint8_t compat = object_property_get_uint(OBJECT(hpet),
>> -                HPET_INTCAP, NULL);
>> +        compat = object_property_get_uint(OBJECT(hpet), HPET_INTCAP, NULL);
>>           if (!compat) {
>>               qdev_prop_set_uint32(hpet, HPET_INTCAP, hpet_irqs);
>>           }
> 
> "compat" is only used here to check. So, what about getting rid of this
> variable?
> 
> if (!object_property_get_uint(OBJECT(hpet), HPET_INTCAP, NULL)) {
>      qdev_prop_set_uint32(hpet, HPET_INTCAP, hpet_irqs);
> }

Ah yeah, I didn't noticed, thanks!



^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 16/21] hw/net/can/versal: Prefer object_initialize_child over object_initialize
  2024-02-16 11:03 ` [PATCH 16/21] hw/net/can/versal: " Philippe Mathieu-Daudé
@ 2024-02-23 11:06   ` Francisco Iglesias
  2024-02-23 12:23     ` Pavel Pisa via
  2025-08-21 13:33   ` Peter Maydell
  1 sibling, 1 reply; 41+ messages in thread
From: Francisco Iglesias @ 2024-02-23 11:06 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-arm, qemu-s390x, qemu-ppc, qemu-block, Pavel Pisa,
	Vikram Garhwal, Jason Wang

On 2024-02-16 12:03, Philippe Mathieu-Daudé wrote:
> When the QOM parent is available, prefer object_initialize_child()
> over object_initialize(), since it create the parent relationship.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Reviewed-by: Francisco Iglesias <francisco.iglesias@amd.com>


> ---
>   hw/net/can/xlnx-versal-canfd.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/net/can/xlnx-versal-canfd.c b/hw/net/can/xlnx-versal-canfd.c
> index 47a14cfe63..f8e4bd75e4 100644
> --- a/hw/net/can/xlnx-versal-canfd.c
> +++ b/hw/net/can/xlnx-versal-canfd.c
> @@ -1900,7 +1900,7 @@ static int canfd_populate_regarray(XlnxVersalCANFDState *s,
>           int index = rae[i].addr / 4;
>           RegisterInfo *r = &s->reg_info[index];
>   
> -        object_initialize(r, sizeof(*r), TYPE_REGISTER);
> +        object_initialize_child(OBJECT(s), "reg[*]", r, TYPE_REGISTER);
>   
>           *r = (RegisterInfo) {
>               .data = &s->regs[index],


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 16/21] hw/net/can/versal: Prefer object_initialize_child over object_initialize
  2024-02-23 11:06   ` Francisco Iglesias
@ 2024-02-23 12:23     ` Pavel Pisa via
  0 siblings, 0 replies; 41+ messages in thread
From: Pavel Pisa via @ 2024-02-23 12:23 UTC (permalink / raw)
  To: Francisco Iglesias
  Cc: Philippe Mathieu-Daudé, qemu-devel, qemu-arm, qemu-s390x,
	qemu-ppc, qemu-block, Vikram Garhwal, Jason Wang

On Friday 23 of February 2024 12:06:34 Francisco Iglesias wrote:
> On 2024-02-16 12:03, Philippe Mathieu-Daudé wrote:
> > When the QOM parent is available, prefer object_initialize_child()
> > over object_initialize(), since it create the parent relationship.
> >
> > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>
> Reviewed-by: Francisco Iglesias <francisco.iglesias@amd.com>

Reviewed-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 00/21] hw: More QDev cleanups
  2024-02-16 11:02 [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé
                   ` (20 preceding siblings ...)
  2024-02-16 11:03 ` [PATCH 21/21] hw: Add QOM parentship relation with CPUs Philippe Mathieu-Daudé
@ 2025-01-12 17:23 ` Philippe Mathieu-Daudé
  21 siblings, 0 replies; 41+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 17:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-arm, qemu-s390x, qemu-ppc, qemu-block

On 16/2/24 12:02, Philippe Mathieu-Daudé wrote:
> Various QDev cleanups extracted to my "enforce QDev API" branch.
> - When available, instead of plain QOM, use QDev API equivalent
> - Add missing QOM parentship for some obj created with qdev_*new()
> - Prefer object_initialize_child() over object_initialize()
> 
> Philippe Mathieu-Daudé (21):

>    hw: Replace DEVICE(object_new) -> qdev_new()
>    target: Replace DEVICE(object_new) -> qdev_new()

>    hw/usb: Inline usb_try_new()
>    hw/usb: Inline usb_new()

>    hw/net/can/versal: Prefer object_initialize_child over
>      object_initialize

>    hw: Add QOM parentship relation with CPUs

Queuing reviewed patches.


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 16/21] hw/net/can/versal: Prefer object_initialize_child over object_initialize
  2024-02-16 11:03 ` [PATCH 16/21] hw/net/can/versal: " Philippe Mathieu-Daudé
  2024-02-23 11:06   ` Francisco Iglesias
@ 2025-08-21 13:33   ` Peter Maydell
  1 sibling, 0 replies; 41+ messages in thread
From: Peter Maydell @ 2025-08-21 13:33 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, qemu-arm, qemu-s390x, qemu-ppc, qemu-block,
	Pavel Pisa, Vikram Garhwal, Francisco Iglesias, Jason Wang

On Fri, 16 Feb 2024 at 11:08, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> When the QOM parent is available, prefer object_initialize_child()
> over object_initialize(), since it create the parent relationship.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  hw/net/can/xlnx-versal-canfd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/net/can/xlnx-versal-canfd.c b/hw/net/can/xlnx-versal-canfd.c
> index 47a14cfe63..f8e4bd75e4 100644
> --- a/hw/net/can/xlnx-versal-canfd.c
> +++ b/hw/net/can/xlnx-versal-canfd.c
> @@ -1900,7 +1900,7 @@ static int canfd_populate_regarray(XlnxVersalCANFDState *s,
>          int index = rae[i].addr / 4;
>          RegisterInfo *r = &s->reg_info[index];
>
> -        object_initialize(r, sizeof(*r), TYPE_REGISTER);
> +        object_initialize_child(OBJECT(s), "reg[*]", r, TYPE_REGISTER);
>
>          *r = (RegisterInfo) {
>              .data = &s->regs[index],
> --

Hi -- I was just looking at this function since ASAN
reports a leak in it. I notice that this patch never got
applied -- any reason why?

Also, though, we call object_initialize(r, ...) and then
we immediately do "*r = { some struct }" which entirely
overwrites the initialization we just did. I guess that
should instead be initializing the individual fields...

-- PMM


^ permalink raw reply	[flat|nested] 41+ messages in thread

end of thread, other threads:[~2025-08-21 13:35 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-16 11:02 [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé
2024-02-16 11:02 ` [PATCH 01/21] hw/i386/pc: Do not use C99 mixed-declarations style Philippe Mathieu-Daudé
2024-02-22  9:12   ` Zhao Liu
2024-02-22 10:10     ` Philippe Mathieu-Daudé
2024-02-16 11:02 ` [PATCH 02/21] hw/i386/pc_sysfw: Use qdev_is_realized() instead of QOM API Philippe Mathieu-Daudé
2024-02-22  9:16   ` Zhao Liu
2024-02-16 11:02 ` [PATCH 03/21] hw/ppc/spapr_cpu: " Philippe Mathieu-Daudé
2024-02-22  9:56   ` Zhao Liu
2024-02-16 11:02 ` [PATCH 04/21] hw/tricore/testboard: Use qdev_new() instead of QOM basic API Philippe Mathieu-Daudé
2024-02-19 11:59   ` Bastian Koppelmann
2024-02-16 11:02 ` [PATCH 05/21] hw/ppc/pnv_bmc: Use qdev_new() instead of QOM API Philippe Mathieu-Daudé
2024-02-16 11:08   ` Cédric Le Goater
2024-02-16 11:02 ` [PATCH 06/21] hw: Replace DEVICE(object_new) -> qdev_new() Philippe Mathieu-Daudé
2024-02-22  9:50   ` Zhao Liu
2024-02-16 11:02 ` [PATCH 07/21] target: " Philippe Mathieu-Daudé
2024-02-22  9:54   ` Zhao Liu
2024-02-16 11:02 ` [PATCH 08/21] hw/isa: Inline isa_try_new() Philippe Mathieu-Daudé
2024-02-16 11:03 ` [PATCH 09/21] hw/usb: Inline usb_try_new() Philippe Mathieu-Daudé
2024-02-22  9:53   ` Zhao Liu
2024-02-16 11:03 ` [PATCH 10/21] hw/usb: Inline usb_new() Philippe Mathieu-Daudé
2024-02-22  9:55   ` Zhao Liu
2024-02-16 11:03 ` [PATCH 11/21] hw/usb: Add QOM parentship relation with hub devices Philippe Mathieu-Daudé
2024-02-22  9:49   ` Zhao Liu
2024-02-16 11:03 ` [PATCH 12/21] hw/pci-host/q35: Update q35_host_props[] comment Philippe Mathieu-Daudé
2024-02-16 11:03 ` [PATCH 13/21] hw/pci-host/raven: Embedded OrIRQ in PRePPCIState Philippe Mathieu-Daudé
2024-02-16 11:03 ` [PATCH 14/21] hw/pci-host/raven: Prefer object_initialize_child over object_initialize Philippe Mathieu-Daudé
2024-02-16 11:03 ` [PATCH 15/21] hw/core/register: " Philippe Mathieu-Daudé
2024-02-16 11:03 ` [PATCH 16/21] hw/net/can/versal: " Philippe Mathieu-Daudé
2024-02-23 11:06   ` Francisco Iglesias
2024-02-23 12:23     ` Pavel Pisa via
2025-08-21 13:33   ` Peter Maydell
2024-02-16 11:03 ` [PATCH 17/21] hw/i386/iommu: " Philippe Mathieu-Daudé
2024-02-22  9:24   ` Zhao Liu
2024-02-16 11:03 ` [PATCH 18/21] hw/pci-host/versatile: Replace object_initialize() -> _child() Philippe Mathieu-Daudé
2024-02-16 11:03 ` [PATCH 19/21] hw/s390x/zpci-bus: Add QOM parentship relation with zPCI devices Philippe Mathieu-Daudé
2024-02-19 13:38   ` Thomas Huth
2024-02-19 14:37     ` Philippe Mathieu-Daudé
2024-02-16 11:03 ` [PATCH 20/21] hw/arm/mps2: Add QOM parentship relation with OR IRQ gates Philippe Mathieu-Daudé
2024-02-16 11:03 ` [PATCH 21/21] hw: Add QOM parentship relation with CPUs Philippe Mathieu-Daudé
2024-02-22  9:59   ` Zhao Liu
2025-01-12 17:23 ` [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).