QEMU-Arm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <graf@amazon.com>
To: <qemu-devel@nongnu.org>
Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org,
	qemu-s390x@nongnu.org, "Song Gao" <17746591750@163.com>,
	"Aditya Gupta" <adityag@linux.ibm.com>,
	"Alexey Kardashevskiy" <aik@ozlabs.ru>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Farhan Ali" <alifm@linux.ibm.com>,
	"Alistair Francis" <alistair.francis@wdc.com>,
	"Alistair Francis" <alistair@alistair23.me>,
	"Antony Pavlov" <antonynpavlov@gmail.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Artyom Tarasenko" <atar4qemu@gmail.com>,
	"BALATON Zoltan" <balaton@eik.bme.hu>,
	"Felipe Balbi" <balbi@kernel.org>,
	"Daniel P . Berrangé" <berrange@redhat.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"Brian Cain" <brian.cain@oss.qualcomm.com>,
	"Hendrik Brueckner" <brueckner@linux.ibm.com>,
	"Chao Liu" <chao.liu@processmission.com>,
	"Huacai Chen" <chenhuacai@kernel.org>,
	"Clément Chigot" <chigot@adacore.com>,
	"Cédric Le Goater" <clg@kaod.org>, "Helge Deller" <deller@gmx.de>,
	"Dorjoy Chowdhury" <dorjoychy111@gmail.com>,
	"Edgar E . Iglesias" <edgar.iglesias@gmail.com>,
	"Alexandre Iooss" <erdnaxe@crans.org>,
	"Eric Farman" <farman@linux.ibm.com>,
	"Fabiano Rosas" <farosas@suse.de>,
	"Francisco Iglesias" <francisco.iglesias@amd.com>,
	"Gaurav Sharma" <gaurav.sharma_7@nxp.com>,
	"Gautam Gala" <ggala@linux.ibm.com>,
	"Harsh Prateek Bora" <harshpb@linux.ibm.com>,
	"Hervé Poussineau" <hpoussin@reactos.org>,
	"Jan Kiszka" <jan.kiszka@web.de>,
	"Max Filippov" <jcmvbkbc@gmail.com>,
	"Joel Stanley" <joel@jms.id.au>,
	"Jared Rossi" <jrossi@linux.ibm.com>,
	"Tyrone Ting" <kfting@nuvoton.com>,
	"Frederic Konrad" <konrad.frederic@yahoo.fr>,
	"Laurent Vivier" <laurent@vivier.eu>,
	"Manos Pitsidianakis" <manos.pitsidianakis@linaro.org>,
	"Bibo Mao" <maobibo@loongson.cn>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Glenn Miles" <milesg@linux.ibm.com>,
	"Matthew Rosato" <mjrosato@linux.ibm.com>,
	"Michael Rolnik" <mrolnik@gmail.com>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	"Niek Linnenbank" <nieklinnenbank@gmail.com>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Halil Pasic" <pasic@linux.ibm.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Peter Xu" <peterx@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@mailo.com>,
	"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>,
	"Pierrick Bouvier" <pierrick.bouvier@oss.qualcomm.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Sai Pavan Boddu" <sai.pavan.boddu@amd.com>,
	"Samuel Tardieu" <sam@rfc1149.net>,
	"Bernhard Beschow" <shentey@gmail.com>,
	"Stafford Horne" <shorne@gmail.com>,
	"Sergio Lopez" <slp@redhat.com>,
	"Subbaraya Sundeep" <sundeep.lkml@gmail.com>,
	"Thomas Huth" <th.huth+qemu@posteo.eu>,
	"Ran Wang" <wangran@bosc.ac.cn>, "Hao Wu" <wuhaotsh@google.com>
Subject: [RFC PATCH v2 005/137] pci: Make pci_new*()/pci_create_simple*() take a QOM parent
Date: Sat, 18 Jul 2026 21:34:40 +0000	[thread overview]
Message-ID: <20260718213652.37673-6-graf@amazon.com> (raw)
In-Reply-To: <20260718213652.37673-1-graf@amazon.com>

Same rename-and-reintroduce treatment as qdev_new() and
sysbus_create_*(): mechanically rename the four PCI creation
helpers to *_orphan() and reintroduce the short names with a
leading (parent, id, ...) pair.

The parented pci_create_simple*() variants call qdev_realize() (not
pci_realize_and_unref()) since the child<> property already holds
the sole reference.

The mechanical rename part is generated by

  spatch --sp-file scripts/coccinelle/qom-parent/pci-new-orphan.cocci \
         --in-place --include-headers --dir .

or equivalently

  git ls-files '*.[ch]' '*.[ch].inc' '*.rst' '*.py' | \
      grep -v '^subprojects/' | \
      xargs sed -i \
        's/\bpci_create_simple_multifunction\b/&_orphan/g;
         s/\bpci_create_simple\b/&_orphan/g;
         s/\bpci_new_multifunction\b/&_orphan/g;
         s/\bpci_new\b/&_orphan/g'

AI-used-for: code (refactoring)
Signed-off-by: Alexander Graf <graf@amazon.com>
---
 hw/alpha/dp264.c                              |  4 +-
 hw/arm/realview.c                             |  4 +-
 hw/arm/sbsa-ref.c                             |  2 +-
 hw/arm/versatilepb.c                          |  4 +-
 hw/hppa/machine.c                             |  8 +--
 hw/i386/pc.c                                  |  2 +-
 hw/i386/pc_piix.c                             |  4 +-
 hw/i386/pc_q35.c                              | 10 +--
 hw/mips/boston.c                              |  2 +-
 hw/mips/fuloong2e.c                           |  4 +-
 hw/mips/loongson3_virt.c                      |  2 +-
 hw/mips/malta.c                               |  2 +-
 hw/pci-host/articia.c                         |  4 +-
 hw/pci-host/bonito.c                          |  2 +-
 hw/pci-host/grackle.c                         |  2 +-
 hw/pci-host/gt64120.c                         |  2 +-
 hw/pci-host/i440fx.c                          |  2 +-
 hw/pci-host/mv64361.c                         |  2 +-
 hw/pci-host/pnv_phb.c                         |  2 +-
 hw/pci-host/ppc4xx_pci.c                      |  2 +-
 hw/pci-host/ppce500.c                         |  2 +-
 hw/pci-host/raven.c                           |  2 +-
 hw/pci-host/sabre.c                           |  6 +-
 hw/pci-host/sh_pci.c                          |  2 +-
 hw/pci-host/uninorth.c                        |  8 +--
 hw/pci/pci.c                                  | 65 +++++++++++++++----
 hw/pci/pcie_sriov.c                           |  2 +-
 hw/ppc/amigaone.c                             |  2 +-
 hw/ppc/mac_newworld.c                         |  4 +-
 hw/ppc/mac_oldworld.c                         |  4 +-
 hw/ppc/pegasos.c                              |  2 +-
 hw/ppc/prep.c                                 |  4 +-
 hw/ppc/sam460ex.c                             |  4 +-
 hw/ppc/spapr.c                                |  2 +-
 hw/riscv/boston-aia.c                         |  2 +-
 hw/sparc64/sun4u.c                            |  8 +--
 hw/vfio/igd.c                                 |  2 +-
 hw/xen/xen_pt_graphics.c                      |  2 +-
 include/hw/pci/pci.h                          | 18 +++--
 .../qom-parent/pci-new-orphan.cocci           | 28 ++++++++
 40 files changed, 157 insertions(+), 78 deletions(-)
 create mode 100644 scripts/coccinelle/qom-parent/pci-new-orphan.cocci

diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
index f928e0cee8..6999168df6 100644
--- a/hw/alpha/dp264.c
+++ b/hw/alpha/dp264.c
@@ -110,7 +110,7 @@ static void clipper_init(MachineState *machine)
      * Importantly, we need to provide a PCI device node for it, otherwise
      * some operating systems won't notice there's an ISA bus to configure.
      */
-    i82378_dev = DEVICE(pci_create_simple(pci_bus, PCI_DEVFN(7, 0), "i82378"));
+    i82378_dev = DEVICE(pci_create_simple_orphan(pci_bus, PCI_DEVFN(7, 0), "i82378"));
     isa_bus = ISA_BUS(qdev_get_child_bus(i82378_dev, "isa.0"));
 
     /* Connect the ISA PIC to the Typhoon IRQ used for ISA interrupts. */
@@ -129,7 +129,7 @@ static void clipper_init(MachineState *machine)
     isa_create_simple(isa_bus, TYPE_SMC37C669_SUPERIO);
 
     /* IDE disk setup.  */
-    pci_dev = pci_create_simple(pci_bus, -1, "cmd646-ide");
+    pci_dev = pci_create_simple_orphan(pci_bus, -1, "cmd646-ide");
     pci_ide_create_devs(pci_dev);
 
     /* Load PALcode.  Given that this is not "real" cpu palcode,
diff --git a/hw/arm/realview.c b/hw/arm/realview.c
index 287c092c2d..0642e35dd2 100644
--- a/hw/arm/realview.c
+++ b/hw/arm/realview.c
@@ -297,11 +297,11 @@ static void realview_init(MachineState *machine,
         sysbus_connect_irq(busdev, 3, pic[51]);
         pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci");
         if (machine_usb(machine)) {
-            pci_create_simple(pci_bus, -1, "pci-ohci");
+            pci_create_simple_orphan(pci_bus, -1, "pci-ohci");
         }
         n = drive_get_max_bus(IF_SCSI);
         while (n >= 0) {
-            dev = DEVICE(pci_create_simple(pci_bus, -1, "lsi53c895a"));
+            dev = DEVICE(pci_create_simple_orphan(pci_bus, -1, "lsi53c895a"));
             lsi53c8xx_handle_legacy_cmdline(dev);
             n--;
         }
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
index a821833fa7..f9fb681d31 100644
--- a/hw/arm/sbsa-ref.c
+++ b/hw/arm/sbsa-ref.c
@@ -695,7 +695,7 @@ static void create_pcie(SBSAMachineState *sms,
 
     pci_init_nic_devices(pci->bus, mc->default_nic);
 
-    pci_create_simple(pci->bus, -1, "bochs-display");
+    pci_create_simple_orphan(pci->bus, -1, "bochs-display");
 
     create_smmu(sms, pci->bus, sysmem, secure_sysmem);
 }
diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c
index b80410db0d..81bd397b5d 100644
--- a/hw/arm/versatilepb.c
+++ b/hw/arm/versatilepb.c
@@ -270,11 +270,11 @@ static void versatile_init(MachineState *machine, int board_id)
     pci_init_nic_devices(pci_bus, "rtl8139");
 
     if (machine_usb(machine)) {
-        pci_create_simple(pci_bus, -1, "pci-ohci");
+        pci_create_simple_orphan(pci_bus, -1, "pci-ohci");
     }
     n = drive_get_max_bus(IF_SCSI);
     while (n >= 0) {
-        dev = DEVICE(pci_create_simple(pci_bus, -1, "lsi53c895a"));
+        dev = DEVICE(pci_create_simple_orphan(pci_bus, -1, "lsi53c895a"));
         lsi53c8xx_handle_legacy_cmdline(dev);
         n--;
     }
diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
index 02cafbda85..91fe4845c4 100644
--- a/hw/hppa/machine.c
+++ b/hw/hppa/machine.c
@@ -428,7 +428,7 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus,
 
     if (pci_bus && hppa_is_pa20(&cpu[0]->env)) {
         /* BMC board: HP Diva GSP PCI card */
-        pci_dev = pci_new_multifunction(PCI_DEVFN(2, 0), "diva-gsp");
+        pci_dev = pci_new_multifunction_orphan(PCI_DEVFN(2, 0), "diva-gsp");
         if (!lasi_dev) {
             /* bind default keyboard/serial to Diva card */
             qdev_prop_set_chr(DEVICE(pci_dev), "chardev1", serial_hd(0));
@@ -443,7 +443,7 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus,
     if (!lasi_dev && machine->enable_graphics && defaults_enabled()) {
         USBBus *usb_bus;
 
-        pci_create_simple(pci_bus, -1, "pci-ohci");
+        pci_create_simple_orphan(pci_bus, -1, "pci-ohci");
         usb_bus = USB_BUS(object_resolve_type_unambiguous(TYPE_USB_BUS,
                                                           &error_abort));
         usb_create_simple(usb_bus, "usb-kbd");
@@ -721,7 +721,7 @@ static void machine_HP_B160L_init(MachineState *machine)
 
     /* SCSI disk setup. */
     if (drive_get_max_bus(IF_SCSI) >= 0) {
-        dev = DEVICE(pci_create_simple(pci_bus, -1, "lsi53c895a"));
+        dev = DEVICE(pci_create_simple_orphan(pci_bus, -1, "lsi53c895a"));
         lsi53c8xx_handle_legacy_cmdline(dev);
     }
 
@@ -773,7 +773,7 @@ static void machine_HP_C3700_init(MachineState *machine)
 
     /* SCSI disk setup. */
     if (drive_get_max_bus(IF_SCSI) >= 0) {
-        DeviceState *dev = DEVICE(pci_create_simple(pci_bus, -1, "lsi53c895a"));
+        DeviceState *dev = DEVICE(pci_create_simple_orphan(pci_bus, -1, "lsi53c895a"));
         lsi53c8xx_handle_legacy_cmdline(dev);
     }
 
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index bd5ab3d854..11a9d5df97 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1104,7 +1104,7 @@ void pc_basic_device_init(struct PCMachineState *pcms,
         xen_gnttab_create();
         xen_xenstore_create();
         if (pcms->pcibus) {
-            pci_create_simple(pcms->pcibus, -1, "xen-platform");
+            pci_create_simple_orphan(pcms->pcibus, -1, "xen-platform");
         }
         xen_bus_init();
     }
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index e580f9f2a6..bd4c129143 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -236,7 +236,7 @@ static void pc_init1(MachineState *machine, const char *pci_type)
 
     gsi_state = pc_gsi_create(&x86ms->gsi, true);
 
-    pci_dev = pci_new_multifunction(-1, pcms->south_bridge);
+    pci_dev = pci_new_multifunction_orphan(-1, pcms->south_bridge);
     object_property_set_bool(OBJECT(pci_dev), "has-usb",
                              machine_usb(machine), &error_abort);
     object_property_set_bool(OBJECT(pci_dev), "has-acpi",
@@ -384,7 +384,7 @@ static void pc_xen_hvm_init(MachineState *machine)
                       : TYPE_I440FX_PCI_DEVICE);
 
     xen_igd_reserve_slot(pcms->pcibus);
-    pci_create_simple(pcms->pcibus, -1, "xen-platform");
+    pci_create_simple_orphan(pcms->pcibus, -1, "xen-platform");
 }
 #endif
 
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 0731403e55..daa75dbc26 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -114,12 +114,12 @@ static int ehci_create_ich9_with_companions(PCIBus *bus, int slot)
         return -1;
     }
 
-    ehci = pci_new_multifunction(PCI_DEVFN(slot, 7), name);
+    ehci = pci_new_multifunction_orphan(PCI_DEVFN(slot, 7), name);
     pci_realize_and_unref(ehci, bus, &error_fatal);
     usbbus = QLIST_FIRST(&ehci->qdev.child_bus);
 
     for (i = 0; i < 3; i++) {
-        uhci = pci_new_multifunction(PCI_DEVFN(slot, comp[i].func),
+        uhci = pci_new_multifunction_orphan(PCI_DEVFN(slot, comp[i].func),
                                      comp[i].name);
         qdev_prop_set_string(&uhci->qdev, "masterbus", usbbus->name);
         qdev_prop_set_uint32(&uhci->qdev, "firstport", comp[i].port);
@@ -235,7 +235,7 @@ static void pc_q35_init(MachineState *machine)
     gsi_state = pc_gsi_create(&x86ms->gsi, true);
 
     /* create ISA bus */
-    lpc = pci_new_multifunction(PCI_DEVFN(ICH9_LPC_DEV, ICH9_LPC_FUNC),
+    lpc = pci_new_multifunction_orphan(PCI_DEVFN(ICH9_LPC_DEV, ICH9_LPC_FUNC),
                                 TYPE_ICH9_LPC_DEVICE);
     lpc_dev = DEVICE(lpc);
     qdev_prop_set_bit(lpc_dev, "smm-enabled",
@@ -290,7 +290,7 @@ static void pc_q35_init(MachineState *machine)
         AHCIPCIState *ich9;
 
         /* ahci and SATA device, for q35 1 ahci controller is built-in */
-        pdev = pci_create_simple_multifunction(pcms->pcibus,
+        pdev = pci_create_simple_multifunction_orphan(pcms->pcibus,
                                                PCI_DEVFN(ICH9_SATA1_DEV,
                                                          ICH9_SATA1_FUNC),
                                                "ich9-ahci");
@@ -311,7 +311,7 @@ static void pc_q35_init(MachineState *machine)
         PCIDevice *smb;
 
         /* TODO: Populate SPD eeprom data.  */
-        smb = pci_create_simple_multifunction(pcms->pcibus,
+        smb = pci_create_simple_multifunction_orphan(pcms->pcibus,
                                               PCI_DEVFN(ICH9_SMB_DEV,
                                                         ICH9_SMB_FUNC),
                                               TYPE_ICH9_SMB_DEVICE);
diff --git a/hw/mips/boston.c b/hw/mips/boston.c
index e328c578a5..18ede54ae8 100644
--- a/hw/mips/boston.c
+++ b/hw/mips/boston.c
@@ -769,7 +769,7 @@ static void boston_mach_init(MachineState *machine)
     qemu_chr_fe_set_handlers(&s->lcd_display, NULL, NULL,
                              boston_lcd_event, NULL, s, NULL, true);
 
-    pdev = pci_create_simple_multifunction(&PCI_BRIDGE(&pcie2->root)->sec_bus,
+    pdev = pci_create_simple_multifunction_orphan(&PCI_BRIDGE(&pcie2->root)->sec_bus,
                                            PCI_DEVFN(0, 0), TYPE_ICH9_AHCI);
     ich9 = ICH9_AHCI(pdev);
     g_assert(ARRAY_SIZE(hd) == ich9->ahci.ports);
diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c
index 9a712ee930..e0cbf4df3d 100644
--- a/hw/mips/fuloong2e.c
+++ b/hw/mips/fuloong2e.c
@@ -286,7 +286,7 @@ static void mips_fuloong2e_init(MachineState *machine)
     pci_bus = bonito_init((qemu_irq *)&(env->irq[2]));
 
     /* South bridge -> IP5 */
-    pci_dev = pci_new_multifunction(PCI_DEVFN(FULOONG2E_VIA_SLOT, 0),
+    pci_dev = pci_new_multifunction_orphan(PCI_DEVFN(FULOONG2E_VIA_SLOT, 0),
                                     TYPE_VT82C686B_ISA);
 
     /* Set properties on individual devices before realizing the south bridge */
@@ -312,7 +312,7 @@ static void mips_fuloong2e_init(MachineState *machine)
     /* GPU */
     if (vga_interface_type != VGA_NONE) {
         vga_interface_created = true;
-        pci_dev = pci_new(-1, "ati-vga");
+        pci_dev = pci_new_orphan(-1, "ati-vga");
         dev = DEVICE(pci_dev);
         qdev_prop_set_uint32(dev, "vgamem_mb", 16);
         qdev_prop_set_uint16(dev, "x-device-id", 0x5159);
diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c
index 854f7f6801..1729eb1c0b 100644
--- a/hw/mips/loongson3_virt.c
+++ b/hw/mips/loongson3_virt.c
@@ -465,7 +465,7 @@ static inline void loongson3_virt_devices_init(MachineState *machine,
     if (defaults_enabled() && object_class_by_name("pci-ohci")) {
         USBBus *usb_bus;
 
-        pci_create_simple(pci_bus, -1, "pci-ohci");
+        pci_create_simple_orphan(pci_bus, -1, "pci-ohci");
         usb_bus = USB_BUS(object_resolve_type_unambiguous(TYPE_USB_BUS,
                                                           &error_abort));
         usb_create_simple(usb_bus, "usb-kbd");
diff --git a/hw/mips/malta.c b/hw/mips/malta.c
index fc5dbf262c..38edbbadd6 100644
--- a/hw/mips/malta.c
+++ b/hw/mips/malta.c
@@ -1233,7 +1233,7 @@ void mips_malta_init(MachineState *machine)
     pci_bus_map_irqs(pci_bus, malta_pci_slot_get_pirq);
 
     /* Southbridge */
-    piix4 = pci_new_multifunction(PIIX4_PCI_DEVFN, TYPE_PIIX4_PCI_DEVICE);
+    piix4 = pci_new_multifunction_orphan(PIIX4_PCI_DEVFN, TYPE_PIIX4_PCI_DEVICE);
     qdev_prop_set_uint32(DEVICE(piix4), "smb_io_base", 0x1100);
     pci_realize_and_unref(piix4, pci_bus, &error_fatal);
     isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(piix4), "isa.0"));
diff --git a/hw/pci-host/articia.c b/hw/pci-host/articia.c
index 04623dfd84..0556c0ccff 100644
--- a/hw/pci-host/articia.c
+++ b/hw/pci-host/articia.c
@@ -185,10 +185,10 @@ static void articia_realize(DeviceState *dev, Error **errp)
     h->bus = pci_register_root_bus(dev, NULL, articia_pcihost_set_irq,
                                    amigaone_pcihost_bus0_map_irq, dev, &s->mem,
                                    &s->io, PCI_DEVFN(8, 0), 4, TYPE_PCI_BUS);
-    pdev = pci_create_simple_multifunction(h->bus, PCI_DEVFN(0, 0),
+    pdev = pci_create_simple_multifunction_orphan(h->bus, PCI_DEVFN(0, 0),
                                            TYPE_ARTICIA_PCI_HOST);
     ARTICIA_PCI_HOST(pdev)->as = s;
-    pci_create_simple(h->bus, PCI_DEVFN(0, 1), TYPE_ARTICIA_PCI_BRIDGE);
+    pci_create_simple_orphan(h->bus, PCI_DEVFN(0, 1), TYPE_ARTICIA_PCI_BRIDGE);
 
     sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->reg);
     sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->mem);
diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index cd7272c90c..40a62d62b6 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -747,7 +747,7 @@ PCIBus *bonito_init(qemu_irq *pic)
     pcihost->pic = pic;
     sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
 
-    d = pci_new(PCI_DEVFN(0, 0), TYPE_PCI_BONITO);
+    d = pci_new_orphan(PCI_DEVFN(0, 0), TYPE_PCI_BONITO);
     s = PCI_BONITO(d);
     s->pcihost = pcihost;
     pcihost->pci_dev = s;
diff --git a/hw/pci-host/grackle.c b/hw/pci-host/grackle.c
index b0db7870b0..c76cb61dc9 100644
--- a/hw/pci-host/grackle.c
+++ b/hw/pci-host/grackle.c
@@ -60,7 +60,7 @@ static void grackle_realize(DeviceState *dev, Error **errp)
                                      &s->pci_io,
                                      0, 4, TYPE_PCI_BUS);
 
-    pci_create_simple(phb->bus, 0, "grackle");
+    pci_create_simple_orphan(phb->bus, 0, "grackle");
 }
 
 static void grackle_init(Object *obj)
diff --git a/hw/pci-host/gt64120.c b/hw/pci-host/gt64120.c
index 566f928304..c1a94a3daa 100644
--- a/hw/pci-host/gt64120.c
+++ b/hw/pci-host/gt64120.c
@@ -1204,7 +1204,7 @@ static void gt64120_realize(DeviceState *dev, Error **errp)
                                 get_system_io(),
                                 PCI_DEVFN(18, 0), TYPE_PCI_BUS);
 
-    pci_create_simple(phb->bus, PCI_DEVFN(0, 0), "gt64120_pci");
+    pci_create_simple_orphan(phb->bus, PCI_DEVFN(0, 0), "gt64120_pci");
     memory_region_init_io(&phb->conf_mem, OBJECT(phb),
                           &pci_host_conf_le_ops,
                           s, "pci-conf-idx", 4);
diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c
index c1982f7962..e91ddd5d07 100644
--- a/hw/pci-host/i440fx.c
+++ b/hw/pci-host/i440fx.c
@@ -282,7 +282,7 @@ static void i440fx_pcihost_realize(DeviceState *dev, Error **errp)
                          s->io_memory, 0, TYPE_PCI_BUS);
     phb->bus = b;
 
-    d = pci_create_simple(b, 0, s->pci_type);
+    d = pci_create_simple_orphan(b, 0, s->pci_type);
     f = I440FX_PCI_DEVICE(d);
 
     range_set_bounds(&s->pci_hole, s->below_4g_mem_size,
diff --git a/hw/pci-host/mv64361.c b/hw/pci-host/mv64361.c
index 495a82befd..f75951c873 100644
--- a/hw/pci-host/mv64361.c
+++ b/hw/pci-host/mv64361.c
@@ -94,7 +94,7 @@ static void mv64361_pcihost_realize(DeviceState *dev, Error **errp)
                                    pci_swizzle_map_irq_fn, dev,
                                    &s->mem, &s->io, 0, 4, TYPE_PCI_BUS);
     g_free(name);
-    pci_create_simple(h->bus, 0, TYPE_MV64361_PCI_BRIDGE);
+    pci_create_simple_orphan(h->bus, 0, TYPE_MV64361_PCI_BRIDGE);
     qdev_init_gpio_out(dev, s->irq, ARRAY_SIZE(s->irq));
 }
 
diff --git a/hw/pci-host/pnv_phb.c b/hw/pci-host/pnv_phb.c
index 0b556d1bf5..fc0b226bef 100644
--- a/hw/pci-host/pnv_phb.c
+++ b/hw/pci-host/pnv_phb.c
@@ -167,7 +167,7 @@ static void pnv_phb_realize(DeviceState *dev, Error **errp)
     }
 
     if (defaults_enabled()) {
-        PCIDevice *root = pci_new(PCI_DEVFN(0, 0), TYPE_PNV_PHB_ROOT_PORT);
+        PCIDevice *root = pci_new_orphan(PCI_DEVFN(0, 0), TYPE_PNV_PHB_ROOT_PORT);
 
         pci_realize_and_unref(root, pci->bus, errp);
     }
diff --git a/hw/pci-host/ppc4xx_pci.c b/hw/pci-host/ppc4xx_pci.c
index b9a00f5193..cd7b16aa87 100644
--- a/hw/pci-host/ppc4xx_pci.c
+++ b/hw/pci-host/ppc4xx_pci.c
@@ -332,7 +332,7 @@ static void ppc4xx_pcihost_realize(DeviceState *dev, Error **errp)
                               TYPE_PCI_BUS);
     h->bus = b;
 
-    pci_create_simple(b, 0, TYPE_PPC4xx_HOST_BRIDGE);
+    pci_create_simple_orphan(b, 0, TYPE_PPC4xx_HOST_BRIDGE);
 
     /* XXX split into 2 memory regions, one for config space, one for regs */
     memory_region_init(&s->container, OBJECT(s), "pci-container", PCI_ALL_SIZE);
diff --git a/hw/pci-host/ppce500.c b/hw/pci-host/ppce500.c
index 67180ba5f0..838a01608c 100644
--- a/hw/pci-host/ppce500.c
+++ b/hw/pci-host/ppce500.c
@@ -473,7 +473,7 @@ static void e500_pcihost_realize(DeviceState *dev, Error **errp)
     address_space_init(&s->bm_as, &s->bm, "pci-bm");
     pci_setup_iommu(b, &ppce500_iommu_ops, s);
 
-    pci_create_simple(b, 0, TYPE_PPC_E500_PCI_BRIDGE);
+    pci_create_simple_orphan(b, 0, TYPE_PPC_E500_PCI_BRIDGE);
 
     memory_region_init(&s->container, OBJECT(h), "pci-container", PCIE500_ALL_SIZE);
     memory_region_init_io(&h->conf_mem, OBJECT(h), &pci_host_conf_be_ops, h,
diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c
index b3836dc9a2..abcf9b28e1 100644
--- a/hw/pci-host/raven.c
+++ b/hw/pci-host/raven.c
@@ -281,7 +281,7 @@ static void raven_pcihost_realizefn(DeviceState *d, Error **errp)
                           "pci-intack", 1);
     memory_region_add_subregion(address_space_mem, 0xbffffff0, &s->pci_intack);
 
-    pci_create_simple(h->bus, PCI_DEVFN(0, 0), TYPE_RAVEN_PCI_DEVICE);
+    pci_create_simple_orphan(h->bus, PCI_DEVFN(0, 0), TYPE_RAVEN_PCI_DEVICE);
 
     address_space_init(&s->bm_as, &s->bm, "raven-bm");
     pci_setup_iommu(h->bus, &raven_iommu_ops, s);
diff --git a/hw/pci-host/sabre.c b/hw/pci-host/sabre.c
index cd2328ad53..d8c815d404 100644
--- a/hw/pci-host/sabre.c
+++ b/hw/pci-host/sabre.c
@@ -383,7 +383,7 @@ static void sabre_realize(DeviceState *dev, Error **errp)
                                      &s->pci_ioport,
                                      0, 0x40, TYPE_PCI_BUS);
 
-    pci_create_simple(phb->bus, 0, TYPE_SABRE_PCI_DEVICE);
+    pci_create_simple_orphan(phb->bus, 0, TYPE_SABRE_PCI_DEVICE);
 
     /* IOMMU */
     memory_region_add_subregion_overlap(&s->sabre_config, 0x200,
@@ -391,12 +391,12 @@ static void sabre_realize(DeviceState *dev, Error **errp)
     pci_setup_iommu(phb->bus, &sabre_iommu_ops, s->iommu);
 
     /* APB secondary busses */
-    pci_dev = pci_new_multifunction(PCI_DEVFN(1, 0), TYPE_SIMBA_PCI_BRIDGE);
+    pci_dev = pci_new_multifunction_orphan(PCI_DEVFN(1, 0), TYPE_SIMBA_PCI_BRIDGE);
     s->bridgeB = PCI_BRIDGE(pci_dev);
     pci_bridge_map_irq(s->bridgeB, "pciB", pci_simbaB_map_irq);
     pci_realize_and_unref(pci_dev, phb->bus, &error_fatal);
 
-    pci_dev = pci_new_multifunction(PCI_DEVFN(1, 1), TYPE_SIMBA_PCI_BRIDGE);
+    pci_dev = pci_new_multifunction_orphan(PCI_DEVFN(1, 1), TYPE_SIMBA_PCI_BRIDGE);
     s->bridgeA = PCI_BRIDGE(pci_dev);
     pci_bridge_map_irq(s->bridgeA, "pciA", pci_simbaA_map_irq);
     pci_realize_and_unref(pci_dev, phb->bus, &error_fatal);
diff --git a/hw/pci-host/sh_pci.c b/hw/pci-host/sh_pci.c
index 3ffd2cdbd7..749b9d76a1 100644
--- a/hw/pci-host/sh_pci.c
+++ b/hw/pci-host/sh_pci.c
@@ -142,7 +142,7 @@ static void sh_pcic_host_realize(DeviceState *dev, Error **errp)
     sysbus_init_mmio(sbd, &s->memconfig_a7);
     memory_region_add_subregion(get_system_memory(), 0xfe240000, &s->isa);
 
-    s->dev = pci_create_simple(phb->bus, PCI_DEVFN(0, 0), "sh_pci_host");
+    s->dev = pci_create_simple_orphan(phb->bus, PCI_DEVFN(0, 0), "sh_pci_host");
 }
 
 static void sh_pcic_pci_realize(PCIDevice *d, Error **errp)
diff --git a/hw/pci-host/uninorth.c b/hw/pci-host/uninorth.c
index 10972de694..4590687bd3 100644
--- a/hw/pci-host/uninorth.c
+++ b/hw/pci-host/uninorth.c
@@ -126,7 +126,7 @@ static void pci_unin_main_realize(DeviceState *dev, Error **errp)
                                    &s->pci_io,
                                    PCI_DEVFN(11, 0), 4, TYPE_PCI_BUS);
 
-    pci_create_simple(h->bus, PCI_DEVFN(11, 0), "uni-north-pci");
+    pci_create_simple_orphan(h->bus, PCI_DEVFN(11, 0), "uni-north-pci");
 
     /*
      * DEC 21154 bridge was unused for many years, this comment is
@@ -176,7 +176,7 @@ static void pci_u3_agp_realize(DeviceState *dev, Error **errp)
                                    &s->pci_io,
                                    PCI_DEVFN(11, 0), 4, TYPE_PCI_BUS);
 
-    pci_create_simple(h->bus, PCI_DEVFN(11, 0), "u3-agp");
+    pci_create_simple_orphan(h->bus, PCI_DEVFN(11, 0), "u3-agp");
 }
 
 static void pci_u3_agp_init(Object *obj)
@@ -220,7 +220,7 @@ static void pci_unin_agp_realize(DeviceState *dev, Error **errp)
                                    &s->pci_io,
                                    PCI_DEVFN(11, 0), 4, TYPE_PCI_BUS);
 
-    pci_create_simple(h->bus, PCI_DEVFN(11, 0), "uni-north-agp");
+    pci_create_simple_orphan(h->bus, PCI_DEVFN(11, 0), "uni-north-agp");
 }
 
 static void pci_unin_agp_init(Object *obj)
@@ -253,7 +253,7 @@ static void pci_unin_internal_realize(DeviceState *dev, Error **errp)
                                    &s->pci_io,
                                    PCI_DEVFN(14, 0), 4, TYPE_PCI_BUS);
 
-    pci_create_simple(h->bus, PCI_DEVFN(14, 0), "uni-north-internal-pci");
+    pci_create_simple_orphan(h->bus, PCI_DEVFN(14, 0), "uni-north-internal-pci");
 }
 
 static void pci_unin_internal_init(Object *obj)
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index d14fc6478e..61b9f2a230 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -2118,7 +2118,7 @@ bool pci_init_nic_in_slot(PCIBus *rootbus, const char *model,
         exit(1);
     }
 
-    pci_dev = pci_new(devfn, model);
+    pci_dev = pci_new_orphan(devfn, model);
     qdev_set_nic_properties(&pci_dev->qdev, nd);
     pci_realize_and_unref(pci_dev, bus, &error_fatal);
     return true;
@@ -2129,15 +2129,15 @@ PCIDevice *pci_vga_init(PCIBus *bus)
     vga_interface_created = true;
     switch (vga_interface_type) {
     case VGA_CIRRUS:
-        return pci_create_simple(bus, -1, "cirrus-vga");
+        return pci_create_simple_orphan(bus, -1, "cirrus-vga");
     case VGA_QXL:
-        return pci_create_simple(bus, -1, "qxl-vga");
+        return pci_create_simple_orphan(bus, -1, "qxl-vga");
     case VGA_STD:
-        return pci_create_simple(bus, -1, "VGA");
+        return pci_create_simple_orphan(bus, -1, "VGA");
     case VGA_VMWARE:
-        return pci_create_simple(bus, -1, "vmware-svga");
+        return pci_create_simple_orphan(bus, -1, "vmware-svga");
     case VGA_VIRTIO:
-        return pci_create_simple(bus, -1, "virtio-vga");
+        return pci_create_simple_orphan(bus, -1, "virtio-vga");
     case VGA_NONE:
     default: /* Other non-PCI types. Checking for unsupported types is already
                 done in vl.c. */
@@ -2399,12 +2399,53 @@ static PCIDevice *pci_new_internal(int devfn, bool multifunction,
     return PCI_DEVICE(dev);
 }
 
-PCIDevice *pci_new_multifunction(int devfn, const char *name)
+static PCIDevice *pci_new_child_internal(Object *parent, const char *id,
+                                          int devfn, bool multifunction,
+                                          const char *type)
+{
+    DeviceState *dev;
+
+    dev = qdev_new(parent, id, type);
+    qdev_prop_set_int32(dev, "addr", devfn);
+    qdev_prop_set_bit(dev, "multifunction", multifunction);
+    return PCI_DEVICE(dev);
+}
+
+PCIDevice *pci_new_multifunction(Object *parent, const char *id,
+                                 int devfn, const char *type)
+{
+    return pci_new_child_internal(parent, id, devfn, true, type);
+}
+
+PCIDevice *pci_new(Object *parent, const char *id,
+                   int devfn, const char *type)
+{
+    return pci_new_child_internal(parent, id, devfn, false, type);
+}
+
+PCIDevice *pci_create_simple_multifunction(Object *parent, const char *id,
+                                           PCIBus *bus, int devfn,
+                                           const char *type)
+{
+    PCIDevice *dev = pci_new_multifunction(parent, id, devfn, type);
+    qdev_realize(DEVICE(dev), BUS(bus), &error_fatal);
+    return dev;
+}
+
+PCIDevice *pci_create_simple(Object *parent, const char *id,
+                             PCIBus *bus, int devfn, const char *type)
+{
+    PCIDevice *dev = pci_new(parent, id, devfn, type);
+    qdev_realize(DEVICE(dev), BUS(bus), &error_fatal);
+    return dev;
+}
+
+PCIDevice *pci_new_multifunction_orphan(int devfn, const char *name)
 {
     return pci_new_internal(devfn, true, name);
 }
 
-PCIDevice *pci_new(int devfn, const char *name)
+PCIDevice *pci_new_orphan(int devfn, const char *name)
 {
     return pci_new_internal(devfn, false, name);
 }
@@ -2414,17 +2455,17 @@ bool pci_realize_and_unref(PCIDevice *dev, PCIBus *bus, Error **errp)
     return qdev_realize_and_unref(&dev->qdev, &bus->qbus, errp);
 }
 
-PCIDevice *pci_create_simple_multifunction(PCIBus *bus, int devfn,
+PCIDevice *pci_create_simple_multifunction_orphan(PCIBus *bus, int devfn,
                                            const char *name)
 {
-    PCIDevice *dev = pci_new_multifunction(devfn, name);
+    PCIDevice *dev = pci_new_multifunction_orphan(devfn, name);
     pci_realize_and_unref(dev, bus, &error_fatal);
     return dev;
 }
 
-PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name)
+PCIDevice *pci_create_simple_orphan(PCIBus *bus, int devfn, const char *name)
 {
-    PCIDevice *dev = pci_new(devfn, name);
+    PCIDevice *dev = pci_new_orphan(devfn, name);
     pci_realize_and_unref(dev, bus, &error_fatal);
     return dev;
 }
diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c
index c41ac95bee..a69a41cdde 100644
--- a/hw/pci/pcie_sriov.c
+++ b/hw/pci/pcie_sriov.c
@@ -171,7 +171,7 @@ bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset,
     dev->exp.sriov_pf.vf = g_new(PCIDevice *, total_vfs);
 
     for (uint16_t i = 0; i < total_vfs; i++) {
-        PCIDevice *vf = pci_new(devfn, vfname);
+        PCIDevice *vf = pci_new_orphan(devfn, vfname);
         vf->exp.sriov_vf.pf = dev;
         vf->exp.sriov_vf.vf_number = i;
 
diff --git a/hw/ppc/amigaone.c b/hw/ppc/amigaone.c
index 528c2c656a..c6b331ff16 100644
--- a/hw/ppc/amigaone.c
+++ b/hw/ppc/amigaone.c
@@ -355,7 +355,7 @@ static void amigaone_init(MachineState *machine)
     pci_bus = PCI_BUS(qdev_get_child_bus(dev, "pci.0"));
 
     /* VIA VT82c686B South Bridge (multifunction PCI device) */
-    via = OBJECT(pci_create_simple_multifunction(pci_bus, PCI_DEVFN(7, 0),
+    via = OBJECT(pci_create_simple_multifunction_orphan(pci_bus, PCI_DEVFN(7, 0),
                                                  TYPE_VT82C686B_ISA));
     object_property_add_alias(OBJECT(machine), "rtc-time",
                               object_resolve_path_component(via, "rtc"),
diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index 31dda69127..0df953b9e1 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -348,7 +348,7 @@ static void ppc_core99_init(MachineState *machine)
     pci_bus = PCI_HOST_BRIDGE(uninorth_pci_dev)->bus;
 
     /* MacIO */
-    macio = OBJECT(pci_new(-1, TYPE_NEWWORLD_MACIO));
+    macio = OBJECT(pci_new_orphan(-1, TYPE_NEWWORLD_MACIO));
     dev = DEVICE(macio);
     qdev_prop_set_uint64(dev, "frequency", tbfreq);
     qdev_prop_set_bit(dev, "has-pmu", has_pmu);
@@ -416,7 +416,7 @@ static void ppc_core99_init(MachineState *machine)
     }
 
     if (machine->usb) {
-        pci_create_simple(pci_bus, -1, "pci-ohci");
+        pci_create_simple_orphan(pci_bus, -1, "pci-ohci");
 
         /* U3 needs to use USB for input because Linux doesn't support via-cuda
         on PPC64 */
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index aa366ca190..e6c5830c38 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -229,7 +229,7 @@ static void ppc_heathrow_init(MachineState *machine)
     pci_bus = PCI_HOST_BRIDGE(grackle_dev)->bus;
 
     /* MacIO */
-    macio = OBJECT(pci_new(PCI_DEVFN(16, 0), TYPE_OLDWORLD_MACIO));
+    macio = OBJECT(pci_new_orphan(PCI_DEVFN(16, 0), TYPE_OLDWORLD_MACIO));
     qdev_prop_set_uint64(DEVICE(macio), "frequency", tbfreq);
 
     dev = DEVICE(object_resolve_path_component(macio, "escc"));
@@ -285,7 +285,7 @@ static void ppc_heathrow_init(MachineState *machine)
     qdev_realize_and_unref(dev, adb_bus, &error_fatal);
 
     if (machine_usb(machine)) {
-        pci_create_simple(pci_bus, -1, "pci-ohci");
+        pci_create_simple_orphan(pci_bus, -1, "pci-ohci");
     }
 
     if (!graphic_width) {
diff --git a/hw/ppc/pegasos.c b/hw/ppc/pegasos.c
index 3dc02423ee..0030068ab3 100644
--- a/hw/ppc/pegasos.c
+++ b/hw/ppc/pegasos.c
@@ -241,7 +241,7 @@ static void pegasos_init(MachineState *machine)
 
     /* VIA VT8231 South Bridge (multifunction PCI device) */
     devfn = PCI_DEVFN(pm->type == PEGASOS1 ? 7 : 12, 0);
-    pm->sb = DEVICE(pci_new_multifunction(devfn, TYPE_VT8231_ISA));
+    pm->sb = DEVICE(pci_new_multifunction_orphan(devfn, TYPE_VT8231_ISA));
     via = OBJECT(pm->sb);
 
     /* Set properties on individual devices before realizing the south bridge */
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index f53ff9c582..a716d5da6a 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -300,7 +300,7 @@ static void ibm_40p_init(MachineState *machine)
     }
 
     /* PCI -> ISA bridge */
-    i82378_dev = DEVICE(pci_new(PCI_DEVFN(11, 0), "i82378"));
+    i82378_dev = DEVICE(pci_new_orphan(PCI_DEVFN(11, 0), "i82378"));
     qdev_realize_and_unref(i82378_dev, BUS(pci_bus), &error_fatal);
     qdev_connect_gpio_out(i82378_dev, 0,
                           qdev_get_gpio_in(DEVICE(cpu), PPC6xx_INPUT_INT));
@@ -350,7 +350,7 @@ static void ibm_40p_init(MachineState *machine)
         qdev_prop_set_uint32(dev, "config", 12);
         isa_realize_and_unref(isa_dev, isa_bus, &error_fatal);
 
-        dev = DEVICE(pci_create_simple(pci_bus, PCI_DEVFN(1, 0), "lsi53c810"));
+        dev = DEVICE(pci_create_simple_orphan(pci_bus, PCI_DEVFN(1, 0), "lsi53c810"));
         lsi53c8xx_handle_legacy_cmdline(dev);
         qdev_connect_gpio_out(dev, 0, qdev_get_gpio_in(i82378_dev, 13));
 
diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c
index 88c4e66b2d..0c4c6f6256 100644
--- a/hw/ppc/sam460ex.c
+++ b/hw/ppc/sam460ex.c
@@ -422,14 +422,14 @@ static void sam460ex_init(MachineState *machine)
     pci_bus = PCI_BUS(qdev_get_child_bus(dev, "pci.0"));
 
     /* PCI devices */
-    pci_create_simple(pci_bus, PCI_DEVFN(6, 0), "sm501");
+    pci_create_simple_orphan(pci_bus, PCI_DEVFN(6, 0), "sm501");
     /*
      * SoC has a single SATA port but we don't emulate that
      * However, firmware and usual clients have driver for SiI311x
      * PCI SATA card so add one for convenience by default
      */
     if (defaults_enabled()) {
-        PCIIDEState *s = PCI_IDE(pci_create_simple(pci_bus, -1, "sii3112"));
+        PCIIDEState *s = PCI_IDE(pci_create_simple_orphan(pci_bus, -1, "sii3112"));
         DriveInfo *di;
 
         di = drive_get_by_index(IF_IDE, 0);
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 30bf0cd0c0..4ead6ba664 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -3075,7 +3075,7 @@ static void spapr_machine_init(MachineState *machine)
     }
 
     if (machine->usb) {
-        pci_create_simple(phb->bus, -1, "nec-usb-xhci");
+        pci_create_simple_orphan(phb->bus, -1, "nec-usb-xhci");
 
         if (has_vga) {
             USBBus *usb_bus;
diff --git a/hw/riscv/boston-aia.c b/hw/riscv/boston-aia.c
index 0fbb44c5df..029cf23696 100644
--- a/hw/riscv/boston-aia.c
+++ b/hw/riscv/boston-aia.c
@@ -418,7 +418,7 @@ static void boston_mach_init(MachineState *machine)
     qemu_chr_fe_set_handlers(&s->lcd_display, NULL, NULL,
                              boston_lcd_event, NULL, s, NULL, true);
 
-    pdev = pci_create_simple_multifunction(&PCI_BRIDGE(&pcie2->root)->sec_bus,
+    pdev = pci_create_simple_multifunction_orphan(&PCI_BRIDGE(&pcie2->root)->sec_bus,
                                            PCI_DEVFN(0, 0), TYPE_ICH9_AHCI);
     ich9 = ICH9_AHCI(pdev);
     g_assert(ARRAY_SIZE(hd) == ich9->ahci.ports);
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index bd73d26e2c..5de873126c 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -599,7 +599,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
     pci_bus_set_slot_reserved_mask(pci_busA, 0xfffffff1);
     pci_bus_set_slot_reserved_mask(pci_busB, 0xfffffff0);
 
-    ebus = pci_new_multifunction(PCI_DEVFN(1, 0), TYPE_EBUS);
+    ebus = pci_new_multifunction_orphan(PCI_DEVFN(1, 0), TYPE_EBUS);
     qdev_prop_set_uint64(DEVICE(ebus), "console-serial-base",
                          hwdef->console_serial_base);
     pci_realize_and_unref(ebus, pci_busA, &error_fatal);
@@ -618,7 +618,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
 
     switch (vga_interface_type) {
     case VGA_STD:
-        pci_create_simple(pci_busA, PCI_DEVFN(2, 0), "VGA");
+        pci_create_simple_orphan(pci_busA, PCI_DEVFN(2, 0), "VGA");
         vga_interface_created = true;
         break;
     case VGA_NONE:
@@ -632,7 +632,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
 
     nd = qemu_find_nic_info(mc->default_nic, true, NULL);
     if (nd) {
-        pci_dev = pci_new_multifunction(PCI_DEVFN(1, 1), mc->default_nic);
+        pci_dev = pci_new_multifunction_orphan(PCI_DEVFN(1, 1), mc->default_nic);
         dev = &pci_dev->qdev;
         qdev_set_nic_properties(dev, nd);
         pci_realize_and_unref(pci_dev, pci_busA, &error_fatal);
@@ -648,7 +648,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
         qemu_macaddr_default_if_unset(&macaddr);
     }
 
-    pci_dev = pci_new(PCI_DEVFN(3, 0), "cmd646-ide");
+    pci_dev = pci_new_orphan(PCI_DEVFN(3, 0), "cmd646-ide");
     qdev_prop_set_uint32(&pci_dev->qdev, "secondary", 1);
     pci_realize_and_unref(pci_dev, pci_busA, &error_fatal);
     pci_ide_create_devs(pci_dev);
diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
index e091f21b6a..bea0d57a11 100644
--- a/hw/vfio/igd.c
+++ b/hw/vfio/igd.c
@@ -334,7 +334,7 @@ static int vfio_pci_igd_lpc_init(VFIOPCIDevice *vdev,
     lpc_bridge = pci_find_device(pci_device_root_bus(pdev),
                                  0, PCI_DEVFN(0x1f, 0));
     if (!lpc_bridge) {
-        lpc_bridge = pci_create_simple(pci_device_root_bus(pdev),
+        lpc_bridge = pci_create_simple_orphan(pci_device_root_bus(pdev),
                                  PCI_DEVFN(0x1f, 0), "vfio-pci-igd-lpc-bridge");
     }
 
diff --git a/hw/xen/xen_pt_graphics.c b/hw/xen/xen_pt_graphics.c
index 7df9344500..4457209e83 100644
--- a/hw/xen/xen_pt_graphics.c
+++ b/hw/xen/xen_pt_graphics.c
@@ -399,7 +399,7 @@ void xen_igd_passthrough_isa_bridge_create(XenPCIPassthroughState *s,
     }
 
     /* Currently IGD drivers always need to access PCH by 1f.0. */
-    bridge_dev = pci_create_simple(bus, PCI_DEVFN(0x1f, 0),
+    bridge_dev = pci_create_simple_orphan(bus, PCI_DEVFN(0x1f, 0),
                                    "igd-passthrough-isa-bridge");
 
     /*
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index f2448e941a..cbbb6a3756 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -1088,13 +1088,23 @@ pci_set_quad_by_mask(uint8_t *config, uint64_t mask, uint64_t reg)
     pci_set_quad(config, (~mask & val) | (mask & rval));
 }
 
-PCIDevice *pci_new_multifunction(int devfn, const char *name);
-PCIDevice *pci_new(int devfn, const char *name);
+PCIDevice *pci_new_multifunction(Object *parent, const char *id,
+                                 int devfn, const char *type);
+PCIDevice *pci_new(Object *parent, const char *id,
+                   int devfn, const char *type);
+PCIDevice *pci_create_simple_multifunction(Object *parent, const char *id,
+                                           PCIBus *bus, int devfn,
+                                           const char *type);
+PCIDevice *pci_create_simple(Object *parent, const char *id,
+                             PCIBus *bus, int devfn, const char *type);
+
+PCIDevice *pci_new_multifunction_orphan(int devfn, const char *name);
+PCIDevice *pci_new_orphan(int devfn, const char *name);
 bool pci_realize_and_unref(PCIDevice *dev, PCIBus *bus, Error **errp);
 
-PCIDevice *pci_create_simple_multifunction(PCIBus *bus, int devfn,
+PCIDevice *pci_create_simple_multifunction_orphan(PCIBus *bus, int devfn,
                                            const char *name);
-PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name);
+PCIDevice *pci_create_simple_orphan(PCIBus *bus, int devfn, const char *name);
 
 void lsi53c8xx_handle_legacy_cmdline(DeviceState *lsi_dev);
 
diff --git a/scripts/coccinelle/qom-parent/pci-new-orphan.cocci b/scripts/coccinelle/qom-parent/pci-new-orphan.cocci
new file mode 100644
index 0000000000..e6cfd0d6c1
--- /dev/null
+++ b/scripts/coccinelle/qom-parent/pci-new-orphan.cocci
@@ -0,0 +1,28 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+//
+// Rename pci_new*/pci_create_simple*() to *_orphan() so that the
+// short names can be reintroduced with a mandatory (parent, id, ...)
+// signature.
+//
+// spatch --sp-file scripts/coccinelle/qom-parent/pci-new-orphan.cocci \
+//        --in-place --include-headers --dir .
+
+@@
+@@
+- pci_new_multifunction
++ pci_new_multifunction_orphan
+
+@@
+@@
+- pci_new
++ pci_new_orphan
+
+@@
+@@
+- pci_create_simple_multifunction
++ pci_create_simple_multifunction_orphan
+
+@@
+@@
+- pci_create_simple
++ pci_create_simple_orphan
-- 
2.47.1



  parent reply	other threads:[~2026-07-18 21:40 UTC|newest]

Thread overview: 290+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-11 22:34 [RFC PATCH 000/134] qom: Make composition-tree parenting mandatory Alexander Graf
2026-07-11 22:34 ` [RFC PATCH 001/134] qom: Introduce object_new_child() Alexander Graf
2026-07-13  8:47   ` Daniel P. Berrangé
2026-07-13  9:01     ` Graf (AWS), Alexander
2026-07-11 22:34 ` [RFC PATCH 002/134] qdev: Rename qdev_new()/qdev_try_new() to *_orphan() Alexander Graf
2026-07-13  8:22   ` Philippe Mathieu-Daudé
2026-07-11 22:34 ` [RFC PATCH 003/134] qdev: Reintroduce qdev_new() with a mandatory QOM parent Alexander Graf
2026-07-13 10:55   ` Philippe Mathieu-Daudé
2026-07-11 22:34 ` [RFC PATCH 004/134] sysbus: Make sysbus_create_simple()/_varargs() take a " Alexander Graf
2026-07-13 10:54   ` Philippe Mathieu-Daudé
2026-07-11 22:34 ` [RFC PATCH 005/134] pci: Make pci_new*()/pci_create_simple*() " Alexander Graf
2026-07-11 22:34 ` [RFC PATCH 006/134] isa: Make isa_new()/isa_try_new()/isa_create_simple() " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 007/134] i2c: Make i2c_slave_new()/i2c_slave_create_simple() " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 008/134] ssi, usb: Make bus-layer creators " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 009/134] cpu: Make cpu_create() " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 010/134] hw/avr: Give onboard devices " Alexander Graf
2026-07-13  8:25   ` Philippe Mathieu-Daudé
2026-07-11 22:35 ` [RFC PATCH 011/134] hw/tricore: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 012/134] hw/xtensa: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 013/134] hw/alpha: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 014/134] hw/nitro: " Alexander Graf
2026-07-13  8:29   ` Philippe Mathieu-Daudé
2026-07-11 22:35 ` [RFC PATCH 015/134] hw/vmapple: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 016/134] hw/hppa: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 017/134] hw/microblaze: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 018/134] hw/sh4: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 019/134] hw/s390x: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 020/134] hw/or1k: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 021/134] hw/loongarch: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 022/134] hw/intc: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 023/134] hw/pci-host: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 024/134] hw/core: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 025/134] hw/remote: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 026/134] hw/ufs: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 027/134] hw/nvme: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 028/134] hw/vfio: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 029/134] hw/mem: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 030/134] hw/cxl: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 031/134] hw/hexagon: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 032/134] hw/xen: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 033/134] hw/display: " Alexander Graf
2026-07-13  8:32   ` Philippe Mathieu-Daudé
2026-07-11 22:35 ` [RFC PATCH 034/134] hw/nvram: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 035/134] hw/dma: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 036/134] hw/misc: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 037/134] hw/scsi: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 038/134] hw/net: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 039/134] hw/ide: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 040/134] hw/i3c: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 041/134] hw/pci-bridge: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 042/134] hw/sparc64: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 043/134] hw/sparc: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 044/134] hw/m68k: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 045/134] hw/rtc: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 046/134] hw/i2c: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 047/134] hw/block: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 048/134] hw/char: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 049/134] hw/isa: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 050/134] hw/pci: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 051/134] hw/riscv: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 052/134] hw/mips: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 053/134] hw/i386: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 054/134] hw/ppc: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 055/134] hw/pci, hw/isa: Give VGA and slot-NIC helpers " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 056/134] hw/arm/virt: Give onboard devices " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 057/134] hw/arm/sbsa-ref: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 058/134] hw/arm/xilinx-zynq: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 059/134] hw/arm/xlnx-versal, xlnx-zynqmp: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 060/134] hw/arm/realview, integratorcp: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 061/134] hw/arm/npcm: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 062/134] hw/arm/versatile, vexpress: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 063/134] hw/arm/stellaris, musicpal: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 064/134] hw/arm/exynos: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 065/134] hw/arm/allwinner: " Alexander Graf
2026-07-11 22:35 ` [RFC PATCH 066/134] hw/arm/strongarm: " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 067/134] hw/arm/omap: " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 068/134] hw/arm/mps2: " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 069/134] hw/arm/imx: " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 070/134] hw/arm/misc: " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 071/134] hw/arm/aspeed: Give onboard devices a QOM parent (part 1) Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 072/134] hw/arm/aspeed: Give onboard devices a QOM parent (part 2) Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 073/134] hw/nvram/at24c: Give at24c_eeprom_init() a QOM parent Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 074/134] hw/i386/pc: Give pcspk " Alexander Graf
2026-07-13  8:34   ` Philippe Mathieu-Daudé
2026-07-11 22:36 ` [RFC PATCH 075/134] hw/timer, hw/net: Give i8254 and isa-ne2000 helpers " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 076/134] hw/misc/unimp: Give create_unimplemented_device() " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 077/134] hw/usb: Give -usbdevice and auto-hub devices " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 078/134] hw/audio: Give -audio model= " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 079/134] hw/xen: Give xenstore-driven backend " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 080/134] hw/nitro: Give the vsock bridge " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 081/134] hw/isa: Give the isabus-bridge " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 082/134] net, target/mips: Give -nic and CPU-with-clock helpers " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 083/134] usb, ssi, i2c: Remove *_orphan() creator variants Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 084/134] isa: " Alexander Graf
2026-07-13  8:35   ` Philippe Mathieu-Daudé
2026-07-11 22:36 ` [RFC PATCH 085/134] pci: " Alexander Graf
2026-07-13  8:36   ` Philippe Mathieu-Daudé
2026-07-11 22:36 ` [RFC PATCH 086/134] cpu: Remove cpu_create_orphan() Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 087/134] sysbus: Remove *_orphan() creator variants Alexander Graf
2026-07-13  8:36   ` Philippe Mathieu-Daudé
2026-07-11 22:36 ` [RFC PATCH 088/134] qdev: Remove qdev_new_orphan() and qdev_try_new_orphan() Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 089/134] memory: Accept non-device owners in memory_region_init_ram() Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 090/134] hw/misc-boards: Give memory regions an explicit owner Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 091/134] hw/mips: " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 092/134] hw/riscv: " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 093/134] hw/i386: " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 094/134] hw/arm: " Alexander Graf
2026-07-12 15:12   ` Bernhard Beschow
2026-07-11 22:36 ` [RFC PATCH 095/134] hw/arm/omap1: " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 096/134] hw/sh4: " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 097/134] hw/m68k: " Alexander Graf
2026-07-12 14:20   ` Thomas Huth
2026-07-11 22:36 ` [RFC PATCH 098/134] hw/ppc: " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 099/134] hw/tricore: " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 100/134] hw/xtensa: " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 101/134] hw/display: " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 102/134] hw/arm/omap: Give lcdc and dma " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 103/134] hw/char: Give parallel and htif " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 104/134] hw/remote: Give " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 105/134] system, backends: Give named " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 106/134] hw/ide: Let ide_init_ioport() take " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 107/134] memory: Require an owner for named memory regions Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 108/134] irq: Rename qemu_allocate_irq*() and friends to *_orphan() Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 109/134] irq: Reintroduce qemu_allocate_irq*() with a mandatory owner and name Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 110/134] hw/pci, hw/usb, system: Give allocated IRQs an " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 111/134] hw/i386, hw/xen: " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 112/134] hw/arm: " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 113/134] hw/xtensa: " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 114/134] hw: " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 115/134] hw/core: Parent GPIO input IRQs and embedded IRQState via QOM Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 116/134] irq: Delete the *_orphan() IRQ allocation variants Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 117/134] sysbus: Parent main-system-bus directly under /machine Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 118/134] accel: Parent the accelerator singleton " Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 119/134] hw/core/reset: Give the root reset container and legacy shims a QOM path Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 120/134] system: Parent per-MR helper objects under their owner Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 121/134] hw/virtio, hw/display: Parent per-device helper objects Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 122/134] hw/i386/amd_iommu: Parent internally-created AMDVI-PCI under the IOMMU Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 123/134] hw/s390x, hw/remote: Parent per-devfn IOMMU objects Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 124/134] hw/pci-host/raven: Parent the OR-IRQ under the host bridge Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 125/134] hw/arm/mps2: Parent the OR-IRQ gates under the machine Alexander Graf
2026-07-11 22:36 ` [RFC PATCH 126/134] hw/arm/digic: Parent the DIGIC SoC " Alexander Graf
2026-07-11 22:37 ` [RFC PATCH 127/134] hw/microblaze: Parent the CPU " Alexander Graf
2026-07-11 22:37 ` [RFC PATCH 128/134] hw: Pair object_initialize_child() with plain realize() Alexander Graf
2026-07-11 22:37 ` [RFC PATCH 129/134] hw: Parent board-created CPUs under the machine Alexander Graf
2026-07-13 16:35   ` Bernhard Beschow
2026-07-13 20:01   ` Brian Cain
2026-07-11 22:37 ` [RFC PATCH 130/134] hw/pci-host/versatile: Use object_initialize_child() for pci_dev Alexander Graf
2026-07-11 22:37 ` [RFC PATCH 131/134] docs, qapi, scripts, iotests: Update /machine/unattached path references Alexander Graf
2026-07-11 22:37 ` [RFC PATCH 132/134] qom: Delete /machine/unattached and error on unparented realize Alexander Graf
2026-07-11 22:37 ` [RFC PATCH 133/134] docs/devel/qom: Document the composition-tree parenting contract Alexander Graf
2026-07-11 22:37 ` [RFC PATCH 134/134] MAINTAINERS: Add scripts/coccinelle/qom-parent/ under QOM Alexander Graf
2026-07-12 10:56 ` [RFC PATCH 000/134] qom: Make composition-tree parenting mandatory Bernhard Beschow
2026-07-18 21:34 ` [RFC PATCH v2 000/137] " Alexander Graf
2026-07-18 21:34   ` [RFC PATCH v2 001/137] qom: Introduce object_new_child() Alexander Graf
2026-07-18 21:34   ` [RFC PATCH v2 002/137] qdev: Rename qdev_new()/qdev_try_new() to *_orphan() Alexander Graf
2026-07-18 21:34   ` [RFC PATCH v2 003/137] qdev: Reintroduce qdev_new() with a mandatory QOM parent Alexander Graf
2026-07-18 21:34   ` [RFC PATCH v2 004/137] sysbus: Make sysbus_create_simple()/_varargs() take a " Alexander Graf
2026-07-18 21:34   ` Alexander Graf [this message]
2026-07-18 21:34   ` [RFC PATCH v2 006/137] isa: Make isa_new()/isa_try_new()/isa_create_simple() " Alexander Graf
2026-07-18 21:34   ` [RFC PATCH v2 007/137] i2c: Make i2c_slave_new()/i2c_slave_create_simple() " Alexander Graf
2026-07-18 21:34   ` [RFC PATCH v2 008/137] ssi, usb: Make bus-layer creators " Alexander Graf
2026-07-18 21:34   ` [RFC PATCH v2 009/137] cpu: Make cpu_create() " Alexander Graf
2026-07-18 21:34   ` [RFC PATCH v2 010/137] hw/avr: Give onboard devices " Alexander Graf
2026-07-18 21:34   ` [RFC PATCH v2 011/137] hw/tricore: " Alexander Graf
2026-07-18 21:34   ` [RFC PATCH v2 012/137] hw/xtensa: " Alexander Graf
2026-07-18 21:34   ` [RFC PATCH v2 013/137] hw/alpha: " Alexander Graf
2026-07-18 21:34   ` [RFC PATCH v2 014/137] hw/nitro: " Alexander Graf
2026-07-18 21:34   ` [RFC PATCH v2 015/137] hw/vmapple: " Alexander Graf
2026-07-18 21:34   ` [RFC PATCH v2 016/137] hw/hppa: " Alexander Graf
2026-07-18 21:34   ` [RFC PATCH v2 017/137] hw/microblaze: " Alexander Graf
2026-07-18 21:34   ` [RFC PATCH v2 018/137] hw/sh4: " Alexander Graf
2026-07-18 21:34   ` [RFC PATCH v2 019/137] hw/s390x: " Alexander Graf
2026-07-18 21:34   ` [RFC PATCH v2 020/137] hw/or1k: " Alexander Graf
2026-07-18 21:34   ` [RFC PATCH v2 021/137] hw/loongarch: " Alexander Graf
2026-07-18 21:34   ` [RFC PATCH v2 022/137] hw/intc: " Alexander Graf
2026-07-18 21:34   ` [RFC PATCH v2 023/137] hw/pci-host: " Alexander Graf
2026-07-18 21:34   ` [RFC PATCH v2 024/137] hw/core: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 025/137] hw/remote: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 026/137] hw/ufs: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 027/137] hw/nvme: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 028/137] hw/vfio: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 029/137] hw/mem: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 030/137] hw/cxl: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 031/137] hw/hexagon: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 032/137] hw/xen: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 033/137] hw/display: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 034/137] hw/nvram: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 035/137] hw/dma: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 036/137] hw/misc: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 037/137] hw/scsi: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 038/137] hw/net: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 039/137] hw/ide: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 040/137] hw/i3c: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 041/137] hw/core/sysbus: Skip nested devices in foreach_dynamic_sysbus_device() Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 042/137] hw/pci-bridge: Give onboard devices a QOM parent Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 043/137] hw/sparc64: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 044/137] hw/sparc: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 045/137] hw/m68k: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 046/137] hw/rtc: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 047/137] hw/i2c: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 048/137] hw/block: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 049/137] hw/char: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 050/137] hw/isa: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 051/137] hw/pci: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 052/137] hw/riscv: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 053/137] hw/mips: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 054/137] hw/i386: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 055/137] hw/ppc: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 056/137] hw/pci, hw/isa: Give VGA and slot-NIC helpers " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 057/137] hw/arm/virt: Give onboard devices " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 058/137] hw/arm/sbsa-ref: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 059/137] hw/arm/xilinx-zynq: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 060/137] hw/arm/xlnx-versal, xlnx-zynqmp: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 061/137] hw/arm/realview, integratorcp: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 062/137] hw/arm/npcm: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 063/137] hw/arm/versatile, vexpress: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 064/137] hw/arm/stellaris, musicpal: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 065/137] hw/arm/exynos: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 066/137] hw/arm/allwinner: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 067/137] hw/arm/strongarm: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 068/137] hw/arm/omap: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 069/137] hw/arm/mps2: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 070/137] hw/arm/imx: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 071/137] hw/arm/misc: " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 072/137] hw/arm/aspeed: Give onboard devices a QOM parent (part 1) Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 073/137] hw/arm/aspeed: Give onboard devices a QOM parent (part 2) Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 074/137] hw/nvram/at24c: Give at24c_eeprom_init() a QOM parent Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 075/137] hw/i386/pc: Give pcspk " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 076/137] hw/timer, hw/net: Give i8254 and isa-ne2000 helpers " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 077/137] hw/misc/unimp: Give create_unimplemented_device() " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 078/137] hw/usb: Give -usbdevice and auto-hub devices " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 079/137] hw/audio: Give -audio model= " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 080/137] hw/xen: Give xenstore-driven backend " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 081/137] hw/nitro: Give the vsock bridge " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 082/137] hw/isa: Give the isabus-bridge " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 083/137] net, target/mips: Give -nic and CPU-with-clock helpers " Alexander Graf
2026-07-18 21:35   ` [RFC PATCH v2 084/137] usb, ssi, i2c: Remove *_orphan() creator variants Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 085/137] isa: " Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 086/137] pci: " Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 087/137] cpu: Remove cpu_create_orphan() Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 088/137] sysbus: Remove *_orphan() creator variants Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 089/137] qdev: Remove qdev_new_orphan() and qdev_try_new_orphan() Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 090/137] memory: Accept non-device owners in memory_region_init_ram() Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 091/137] hw/misc-boards: Give memory regions an explicit owner Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 092/137] hw/mips: " Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 093/137] hw/riscv: " Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 094/137] hw/i386: " Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 095/137] hw/arm: " Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 096/137] hw/arm/omap1: " Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 097/137] hw/sh4: " Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 098/137] hw/m68k: " Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 099/137] hw/ppc: " Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 100/137] hw/tricore: " Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 101/137] hw/xtensa: " Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 102/137] hw/display: " Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 103/137] hw/arm/omap: Give lcdc and dma " Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 104/137] hw/char: Give parallel and htif " Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 105/137] hw/remote: Give " Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 106/137] system, backends: Give named " Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 107/137] hw/ide: Let ide_init_ioport() take " Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 108/137] memory: Require an owner for named memory regions Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 109/137] irq: Rename qemu_allocate_irq*() and friends to *_orphan() Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 110/137] irq: Reintroduce qemu_allocate_irq*() with a mandatory owner and name Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 111/137] hw/pci, hw/usb, system: Give allocated IRQs an " Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 112/137] hw/i386, hw/xen: " Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 113/137] hw/arm: " Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 114/137] hw/xtensa: " Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 115/137] hw: " Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 116/137] hw/core: Parent GPIO input IRQs and embedded IRQState via QOM Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 117/137] irq: Delete the *_orphan() IRQ allocation variants Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 118/137] sysbus: Parent main-system-bus directly under /machine Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 119/137] accel: Parent the accelerator singleton " Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 120/137] hw/intc/mips_gic: Register reset handler at realize, not instance_init Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 121/137] hw/core/reset: Give the root reset container and legacy shims a QOM path Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 122/137] system: Parent per-MR helper objects under their owner Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 123/137] hw/virtio, hw/display: Parent per-device helper objects Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 124/137] hw/i386/amd_iommu: Parent internally-created AMDVI-PCI under the IOMMU Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 125/137] hw/s390x, hw/remote: Parent per-devfn IOMMU objects Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 126/137] hw/pci-host/raven: Parent the OR-IRQ under the host bridge Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 127/137] hw/arm/mps2: Parent the OR-IRQ gates under the machine Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 128/137] hw/arm/digic: Parent the DIGIC SoC " Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 129/137] hw/microblaze: Parent the CPU " Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 130/137] hw: Pair object_initialize_child() with plain realize() Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 131/137] hw: Parent board-created CPUs under the machine Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 132/137] hw/pci-host/versatile: Use object_initialize_child() for pci_dev Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 133/137] docs, qapi, scripts, iotests: Update /machine/unattached path references Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 134/137] qom: Delete /machine/unattached and error on unparented realize Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 135/137] tests/qtest/qom-test: Add smp-max init-time ceiling test Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 136/137] docs/devel/qom: Document the composition-tree parenting contract Alexander Graf
2026-07-18 21:36   ` [RFC PATCH v2 137/137] MAINTAINERS: Add scripts/coccinelle/qom-parent/ under QOM Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260718213652.37673-6-graf@amazon.com \
    --to=graf@amazon.com \
    --cc=17746591750@163.com \
    --cc=adityag@linux.ibm.com \
    --cc=aik@ozlabs.ru \
    --cc=alex.bennee@linaro.org \
    --cc=alifm@linux.ibm.com \
    --cc=alistair.francis@wdc.com \
    --cc=alistair@alistair23.me \
    --cc=antonynpavlov@gmail.com \
    --cc=armbru@redhat.com \
    --cc=atar4qemu@gmail.com \
    --cc=balaton@eik.bme.hu \
    --cc=balbi@kernel.org \
    --cc=berrange@redhat.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=brian.cain@oss.qualcomm.com \
    --cc=brueckner@linux.ibm.com \
    --cc=chao.liu@processmission.com \
    --cc=chenhuacai@kernel.org \
    --cc=chigot@adacore.com \
    --cc=clg@kaod.org \
    --cc=deller@gmx.de \
    --cc=dorjoychy111@gmail.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=erdnaxe@crans.org \
    --cc=farman@linux.ibm.com \
    --cc=farosas@suse.de \
    --cc=francisco.iglesias@amd.com \
    --cc=gaurav.sharma_7@nxp.com \
    --cc=ggala@linux.ibm.com \
    --cc=harshpb@linux.ibm.com \
    --cc=hpoussin@reactos.org \
    --cc=jan.kiszka@web.de \
    --cc=jcmvbkbc@gmail.com \
    --cc=joel@jms.id.au \
    --cc=jrossi@linux.ibm.com \
    --cc=kfting@nuvoton.com \
    --cc=konrad.frederic@yahoo.fr \
    --cc=laurent@vivier.eu \
    --cc=manos.pitsidianakis@linaro.org \
    --cc=maobibo@loongson.cn \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=milesg@linux.ibm.com \
    --cc=mjrosato@linux.ibm.com \
    --cc=mrolnik@gmail.com \
    --cc=mst@redhat.com \
    --cc=nieklinnenbank@gmail.com \
    --cc=npiggin@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=pasic@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=peterx@redhat.com \
    --cc=philmd@mailo.com \
    --cc=philmd@oss.qualcomm.com \
    --cc=pierrick.bouvier@oss.qualcomm.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=sai.pavan.boddu@amd.com \
    --cc=sam@rfc1149.net \
    --cc=shentey@gmail.com \
    --cc=shorne@gmail.com \
    --cc=slp@redhat.com \
    --cc=sundeep.lkml@gmail.com \
    --cc=th.huth+qemu@posteo.eu \
    --cc=wangran@bosc.ac.cn \
    --cc=wuhaotsh@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox