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.

Assisted-by: Kiro
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


Reply via email to