[RFC PATCH v2 124/137] hw/i386/amd_iommu: Parent internally-created AMDVI-PCI under the IOMMU

Alexander Graf <[email protected]>
Newsgroups org.nongnu.qemu-arm,org.nongnu.qemu-devel,org.nongnu.qemu-riscv
Message-ID <[email protected]>
When the AMD IOMMU creates its own PCI companion device (no pci-id
supplied by the user), parent it under the sysbus IOMMU so it has a
canonical path at <iommu>/pci.  The user-supplied path already
parents via -device.

AI-used-for: code (refactoring)
Signed-off-by: Alexander Graf <[email protected]>
---
 hw/i386/amd_iommu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
index 90252c52af..e3394bad6e 100644
--- a/hw/i386/amd_iommu.c
+++ b/hw/i386/amd_iommu.c
@@ -2698,7 +2698,8 @@ static void amdvi_sysbus_realize(DeviceState *dev, Error **errp)
         s->pci = AMD_IOMMU_PCI(pdev);
         dc->vmsd = &vmstate_amdvi_sysbus_migratable;
     } else {
-        s->pci = AMD_IOMMU_PCI(object_new(TYPE_AMD_IOMMU_PCI));
+        s->pci = AMD_IOMMU_PCI(object_new_child(OBJECT(s), "pci",
+                                                TYPE_AMD_IOMMU_PCI));
         /* This device should take care of IOMMU PCI properties */
         if (!qdev_realize(DEVICE(s->pci), &bus->qbus, errp)) {
             return;
-- 
2.47.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.