|
@@ -3,6 +3,7 @@
|
|
|
|
|
|
#include "exec/memory.h"
|
|
|
#include "sysemu/dma.h"
|
|
|
+#include "sysemu/host_iommu_device.h"
|
|
|
|
|
|
/* PCI includes legacy ISA access. */
|
|
|
#include "hw/isa/isa.h"
|
|
@@ -383,10 +384,45 @@ typedef struct PCIIOMMUOps {
|
|
|
*
|
|
|
* @devfn: device and function number
|
|
|
*/
|
|
|
- AddressSpace * (*get_address_space)(PCIBus *bus, void *opaque, int devfn);
|
|
|
+ AddressSpace * (*get_address_space)(PCIBus *bus, void *opaque, int devfn);
|
|
|
+ /**
|
|
|
+ * @set_iommu_device: attach a HostIOMMUDevice to a vIOMMU
|
|
|
+ *
|
|
|
+ * Optional callback, if not implemented in vIOMMU, then vIOMMU can't
|
|
|
+ * retrieve host information from the associated HostIOMMUDevice.
|
|
|
+ *
|
|
|
+ * @bus: the #PCIBus of the PCI device.
|
|
|
+ *
|
|
|
+ * @opaque: the data passed to pci_setup_iommu().
|
|
|
+ *
|
|
|
+ * @devfn: device and function number of the PCI device.
|
|
|
+ *
|
|
|
+ * @dev: the #HostIOMMUDevice to attach.
|
|
|
+ *
|
|
|
+ * @errp: pass an Error out only when return false
|
|
|
+ *
|
|
|
+ * Returns: true if HostIOMMUDevice is attached or else false with errp set.
|
|
|
+ */
|
|
|
+ bool (*set_iommu_device)(PCIBus *bus, void *opaque, int devfn,
|
|
|
+ HostIOMMUDevice *dev, Error **errp);
|
|
|
+ /**
|
|
|
+ * @unset_iommu_device: detach a HostIOMMUDevice from a vIOMMU
|
|
|
+ *
|
|
|
+ * Optional callback.
|
|
|
+ *
|
|
|
+ * @bus: the #PCIBus of the PCI device.
|
|
|
+ *
|
|
|
+ * @opaque: the data passed to pci_setup_iommu().
|
|
|
+ *
|
|
|
+ * @devfn: device and function number of the PCI device.
|
|
|
+ */
|
|
|
+ void (*unset_iommu_device)(PCIBus *bus, void *opaque, int devfn);
|
|
|
} PCIIOMMUOps;
|
|
|
|
|
|
AddressSpace *pci_device_iommu_address_space(PCIDevice *dev);
|
|
|
+bool pci_device_set_iommu_device(PCIDevice *dev, HostIOMMUDevice *hiod,
|
|
|
+ Error **errp);
|
|
|
+void pci_device_unset_iommu_device(PCIDevice *dev);
|
|
|
|
|
|
/**
|
|
|
* pci_setup_iommu: Initialize specific IOMMU handlers for a PCIBus
|