PCIIOMMUOps.set_memory_region() is introduced to set the downstream memory
region of a pci bus. When PCIIOMMUOps.get_address_space() is already
registered by the pci host(e.g. TYPE_DESIGNWARE_PCIE_HOST),
PCIIOMMUOps.set_memory_region() should be registered as well, so an IOMMU
can designate the downstream memory region for the pci bus.
Signed-off-by: Jason Chien <jason.chien@sifive.com>
---
include/hw/pci/pci.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index c0717e3121..cb3039bce8 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -388,6 +388,19 @@ typedef struct PCIIOMMUOps {
* @devfn: device and function number
*/
AddressSpace * (*get_address_space)(PCIBus *bus, void *opaque, int devfn);
+ /**
+ * @set_memory_region: set the downstream memory region for a set of
+ * devices on a PCI bus.
+ *
+ * Optional callback, which should be implemented when get_address_space()
+ * is registered by the PCI host(e.g. TYPE_DESIGNWARE_PCIE_HOST), which
+ * makes an IOMMU not able to register get_address_space() again.
+ *
+ * @opaque: the data passed to pci_setup_iommu().
+ *
+ * @mr: the downsteam memory region
+ */
+ void (*set_memory_region)(void *opaque, MemoryRegion *mr);
/**
* @set_iommu_device: attach a HostIOMMUDevice to a vIOMMU
*
--
2.43.2