When PCIIOMMUOps.get_address_space() is already registered by the pci host, e.g. TYPE_DESIGNWARE_PCIE_HOST, IOMMU cannot overwrite this hook without breaking the PCIe translation rule, which means that IOMMU and the pci host cannot coexist.
This RFC introduces a new callback, PCIIOMMUOps.set_memory_region(), and an API, pci_setup_iommu_downstream_mem, to avoid the contention for PCIIOMMUOps.get_address_space(). Jason Chien (6): include/hw/pci: Add a callback to set the downstream memory region of a pci bus hw/pci: Add an API to set the downstream memory region of a PCI bus hw/pci-host: Enable DW PCIe host to send memory transactions over specific mr hw/riscv/riscv-iommu: Allow PCI hosts with iommu_ops registered connecting to the IOMMU hw/riscv/riscv-iommu: Acquire device IDs dynamically include/hw/pci: Send PCI dma requests with memory attributes containing BDF hw/pci-host/designware.c | 18 +++++++++++++++--- hw/pci/pci.c | 6 ++++++ hw/riscv/riscv-iommu.c | 21 +++++++++++++++++++-- include/hw/pci-host/designware.h | 2 ++ include/hw/pci/pci.h | 20 ++++++++++++++++++++ include/hw/pci/pci_device.h | 15 ++++++++++++--- 6 files changed, 74 insertions(+), 8 deletions(-) -- 2.43.2