summary refs log tree commit diff stats
path: root/hw/pci/pci.c
diff options
context:
space:
mode:
authorEric Auger <eric.auger@redhat.com>2024-06-14 11:52:54 +0200
committerCédric Le Goater <clg@redhat.com>2024-06-24 23:15:30 +0200
commita95264191f10173e27b175ebc4a487520a523d62 (patch)
treedd4d55544e95d8c9d334c7765bf50447a86cf5c7 /hw/pci/pci.c
parent3ad35d9158bde0500aeaea4147345d39ad0ae1c0 (diff)
downloadfocaccia-qemu-a95264191f10173e27b175ebc4a487520a523d62.tar.gz
focaccia-qemu-a95264191f10173e27b175ebc4a487520a523d62.zip
HostIOMMUDevice: Store the aliased bus and devfn
Store the aliased bus and devfn in the HostIOMMUDevice.
This will be useful to handle info that are iommu group
specific and not device specific (such as reserved
iova ranges).

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/pci/pci.c')
-rw-r--r--hw/pci/pci.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index c8a8aab306..50b86d5790 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -2745,11 +2745,15 @@ AddressSpace *pci_device_iommu_address_space(PCIDevice *dev)
 bool pci_device_set_iommu_device(PCIDevice *dev, HostIOMMUDevice *hiod,
                                  Error **errp)
 {
-    PCIBus *iommu_bus;
+    PCIBus *iommu_bus, *aliased_bus;
+    int aliased_devfn;
 
     /* set_iommu_device requires device's direct BDF instead of aliased BDF */
-    pci_device_get_iommu_bus_devfn(dev, &iommu_bus, NULL, NULL);
+    pci_device_get_iommu_bus_devfn(dev, &iommu_bus,
+                                   &aliased_bus, &aliased_devfn);
     if (iommu_bus && iommu_bus->iommu_ops->set_iommu_device) {
+        hiod->aliased_bus = aliased_bus;
+        hiod->aliased_devfn = aliased_devfn;
         return iommu_bus->iommu_ops->set_iommu_device(pci_get_bus(dev),
                                                       iommu_bus->iommu_opaque,
                                                       dev->devfn, hiod, errp);