[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 21/42] HostIOMMUDevice: Store the aliased bus and devfn
From: |
Cédric Le Goater |
Subject: |
[PULL 21/42] HostIOMMUDevice: Store the aliased bus and devfn |
Date: |
Mon, 24 Jun 2024 23:24:35 +0200 |
From: Eric Auger <eric.auger@redhat.com>
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>
---
include/sysemu/host_iommu_device.h | 2 ++
hw/pci/pci.c | 8 ++++++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/include/sysemu/host_iommu_device.h
b/include/sysemu/host_iommu_device.h
index
40e0fa13efb5c023bc9b46fc99bf553cb93adf24..ee6c813c8b2299ed1d1d3b34d143c20a8ec27400
100644
--- a/include/sysemu/host_iommu_device.h
+++ b/include/sysemu/host_iommu_device.h
@@ -35,6 +35,8 @@ struct HostIOMMUDevice {
char *name;
void *agent; /* pointer to agent device, ie. VFIO or VDPA device */
+ PCIBus *aliased_bus;
+ int aliased_devfn;
HostIOMMUDeviceCaps caps;
};
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index
c8a8aab30646c5e37816f49f6ef9d1bdf8be241f..50b86d57907411ee7646b436dda53503eca33c13
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);
--
2.45.2
- [PULL 11/42] vfio: Create host IOMMU device instance, (continued)
- [PULL 11/42] vfio: Create host IOMMU device instance, Cédric Le Goater, 2024/06/24
- [PULL 12/42] hw/pci: Introduce helper function pci_device_get_iommu_bus_devfn(), Cédric Le Goater, 2024/06/24
- [PULL 13/42] hw/pci: Introduce pci_device_[set|unset]_iommu_device(), Cédric Le Goater, 2024/06/24
- [PULL 14/42] vfio/pci: Pass HostIOMMUDevice to vIOMMU, Cédric Le Goater, 2024/06/24
- [PULL 15/42] intel_iommu: Extract out vtd_cap_init() to initialize cap/ecap, Cédric Le Goater, 2024/06/24
- [PULL 16/42] intel_iommu: Implement [set|unset]_iommu_device() callbacks, Cédric Le Goater, 2024/06/24
- [PULL 17/42] intel_iommu: Check compatibility with host IOMMU capabilities, Cédric Le Goater, 2024/06/24
- [PULL 18/42] HostIOMMUDevice: Store the VFIO/VDPA agent, Cédric Le Goater, 2024/06/24
- [PULL 19/42] virtio-iommu: Implement set|unset]_iommu_device() callbacks, Cédric Le Goater, 2024/06/24
- [PULL 20/42] HostIOMMUDevice: Introduce get_iova_ranges callback, Cédric Le Goater, 2024/06/24
- [PULL 21/42] HostIOMMUDevice: Store the aliased bus and devfn,
Cédric Le Goater <=
- [PULL 22/42] virtio-iommu: Compute host reserved regions, Cédric Le Goater, 2024/06/24
- [PULL 23/42] virtio-iommu: Remove the implementation of iommu_set_iova_range, Cédric Le Goater, 2024/06/24
- [PULL 24/42] hw/vfio: Remove memory_region_iommu_set_iova_ranges() call, Cédric Le Goater, 2024/06/24
- [PULL 26/42] vfio: Make vfio_devices_dma_logging_start() return bool, Cédric Le Goater, 2024/06/24
- [PULL 25/42] memory: Remove IOMMU MR iommu_set_iova_range API, Cédric Le Goater, 2024/06/24
- [PULL 29/42] vfio/common: Extract vIOMMU code from vfio_sync_dirty_bitmap(), Cédric Le Goater, 2024/06/24
- [PULL 27/42] vfio: Remove unused declarations from vfio-common.h, Cédric Le Goater, 2024/06/24
- [PULL 32/42] vfio/container: Modify vfio_get_iommu_type() to use a container fd, Cédric Le Goater, 2024/06/24
- [PULL 33/42] vfio/container: Introduce vfio_get_iommu_class_name(), Cédric Le Goater, 2024/06/24
- [PULL 30/42] vfio/container: Introduce vfio_address_space_insert(), Cédric Le Goater, 2024/06/24