@@ -2706,6 +2706,21 @@ void pci_device_unbind_gpasid(PCIBus *bus, int32_t devfn,
}
}
+void pci_device_flush_pasid_iotlb(PCIBus *bus, int32_t devfn,
+ struct iommu_cache_invalidate_info *info)
+{
+ PCIDevice *dev;
+
+ if (!bus) {
+ return;
+ }
+
+ dev = bus->devices[devfn];
+ if (dev && dev->pasid_ops) {
+ dev->pasid_ops->flush_pasid_iotlb(bus, devfn, info);
+ }
+}
+
static void pci_dev_get_w64(PCIBus *b, PCIDevice *dev, void *opaque)
{
Range *range = opaque;
@@ -272,6 +272,8 @@ struct PCIPASIDOps {
struct gpasid_bind_data *g_bind_data);
void (*unbind_gpasid)(PCIBus *bus, int32_t devfn,
struct gpasid_bind_data *g_bind_data);
+ void (*flush_pasid_iotlb)(PCIBus *bus, int32_t devfn,
+ struct iommu_cache_invalidate_info *info);
};
struct PCIDevice {
@@ -506,6 +508,8 @@ void pci_device_bind_gpasid(PCIBus *bus, int32_t devfn,
struct gpasid_bind_data *g_bind_data);
void pci_device_unbind_gpasid(PCIBus *bus, int32_t devfn,
struct gpasid_bind_data *g_bind_data);
+void pci_device_flush_pasid_iotlb(PCIBus *bus, int32_t devfn,
+ struct iommu_cache_invalidate_info *info);
static inline void
pci_set_byte(uint8_t *config, uint8_t val)
This patch adds flush_pasid_iotlb() in PCIPASIDOps for passing guest PASID-based iotlb flush operation to host via vfio interface. Cc: Kevin Tian <kevin.tian@intel.com> Cc: Jacob Pan <jacob.jun.pan@linux.intel.com> Cc: Peter Xu <peterx@redhat.com> Cc: Eric Auger <eric.auger@redhat.com> Cc: Yi Sun <yi.y.sun@linux.intel.com> Cc: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Liu Yi L <yi.l.liu@intel.com> --- hw/pci/pci.c | 15 +++++++++++++++ include/hw/pci/pci.h | 4 ++++ 2 files changed, 19 insertions(+)