[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC v3.1 09/22] hw/pci: add pci_device_host_iommu_context()
From: |
Liu Yi L |
Subject: |
[RFC v3.1 09/22] hw/pci: add pci_device_host_iommu_context() |
Date: |
Sat, 22 Feb 2020 00:07:10 -0800 |
This patch adds pci_device_host_iommu_context() to expose HostIOMMUContext
to vIOMMU emulators via pci layer.
Cc: Kevin Tian <address@hidden>
Cc: Jacob Pan <address@hidden>
Cc: Peter Xu <address@hidden>
Cc: Eric Auger <address@hidden>
Cc: Yi Sun <address@hidden>
Cc: David Gibson <address@hidden>
Cc: Michael S. Tsirkin <address@hidden>
Signed-off-by: Liu Yi L <address@hidden>
---
hw/pci/pci.c | 8 ++++++++
include/hw/pci/pci.h | 1 +
2 files changed, 9 insertions(+)
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 3166cc3..288576f 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -2689,6 +2689,14 @@ AddressSpace *pci_device_iommu_address_space(PCIDevice
*dev)
return &address_space_memory;
}
+HostIOMMUContext *pci_device_host_iommu_context(PCIDevice *dev)
+{
+ if (dev && dev->host_iommu_fn) {
+ return dev->host_iommu_fn(dev);
+ }
+ return NULL;
+}
+
void pci_setup_iommu(PCIBus *bus, PCIIOMMUFunc fn, void *opaque)
{
bus->iommu_fn = fn;
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index e44eefb..cb514d0 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -494,6 +494,7 @@ AddressSpace *pci_device_iommu_address_space(PCIDevice
*dev);
void pci_setup_iommu(PCIBus *bus, PCIIOMMUFunc fn, void *opaque);
void pci_device_setup_iommu(PCIDevice *dev, PCIHostIOMMUFunc fn);
void pci_device_unset_iommu(PCIDevice *dev);
+HostIOMMUContext *pci_device_host_iommu_context(PCIDevice *dev);
static inline void
pci_set_byte(uint8_t *config, uint8_t val)
--
2.7.4
- [RFC v3.1 00/22] intel_iommu: expose Shared Virtual Addressing to VMs, Liu Yi L, 2020/02/22
- [RFC v3.1 03/22] vfio: check VFIO_TYPE1_NESTING_IOMMU support, Liu Yi L, 2020/02/22
- [RFC v3.1 09/22] hw/pci: add pci_device_host_iommu_context(),
Liu Yi L <=
- [RFC v3.1 13/22] vfio: add bind stage-1 page table support, Liu Yi L, 2020/02/22
- [RFC v3.1 06/22] vfio/pci: init HostIOMMUContext per-container, Liu Yi L, 2020/02/22
- [RFC v3.1 01/22] scripts/update-linux-headers: Import iommu.h, Liu Yi L, 2020/02/22
- [RFC v3.1 05/22] hw/pci: add pci_device_setup_iommu, Liu Yi L, 2020/02/22
- [RFC v3.1 08/22] vfio/common: add pasid_alloc/free support, Liu Yi L, 2020/02/22
- [RFC v3.1 11/22] intel_iommu: process pasid cache invalidation, Liu Yi L, 2020/02/22
- [RFC v3.1 19/22] intel_iommu: process PASID-based iotlb invalidation, Liu Yi L, 2020/02/22
- [RFC v3.1 04/22] hw/iommu: introduce HostIOMMUContext, Liu Yi L, 2020/02/22
- [RFC v3.1 07/22] vfio: get nesting iommu cap info from Kernel, Liu Yi L, 2020/02/22
- [RFC v3.1 10/22] intel_iommu: add virtual command capability support, Liu Yi L, 2020/02/22