From 58f66c2581b3c4a45a02717330f1b2188424889b Mon Sep 17 00:00:00 2001 From: Shameer Kolothum Date: Wed, 15 Jan 2025 16:11:21 +0000 Subject: [PATCH] smmu-common: Return sysmem address space only for vfio-pci This will enable pcie-root-port hotplug event irq to work. Discussion Link: https://lore.kernel.org/qemu-devel/74114c0db34b420a90e9fe5bd991767e@huawei.com/ Signed-off-by: Shameer Kolothum --- hw/arm/smmu-common.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c index 3a257a5b0e..6c4b82757f 100644 --- a/hw/arm/smmu-common.c +++ b/hw/arm/smmu-common.c @@ -639,9 +639,16 @@ static AddressSpace *smmu_find_add_as(PCIBus *bus, void *opaque, int devfn) SMMUState *s = opaque; SMMUPciBus *sbus = smmu_get_sbus(s, bus); SMMUDevice *sdev = smmu_get_sdev(s, sbus, bus, devfn); + bool is_vfio = false; + PCIDevice *pdev; + + pdev = pci_find_device(bus, pci_bus_num(bus), devfn); + if (object_dynamic_cast(OBJECT(pdev), "vfio-pci")) { + is_vfio = true; + } /* Return the system as if the device uses stage-2 only */ - if (s->nested && !sdev->s1_hwpt) { + if (s->nested && !sdev->s1_hwpt && is_vfio) { return &sdev->as_sysmem; } else { return &sdev->as; -- 2.41.0.windows.1