[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 2/6] hw/pci: Add an API to set the downstream memory region o
From: |
Jason Chien |
Subject: |
[RFC PATCH 2/6] hw/pci: Add an API to set the downstream memory region of a PCI bus |
Date: |
Mon, 16 Dec 2024 08:48:53 +0800 |
pci_setup_iommu_downstream_mem() invokes PCIIOMMUOps.set_memory_region()
to set the downstream memroy region of a PCI bus.
Signed-off-by: Jason Chien <jason.chien@sifive.com>
---
hw/pci/pci.c | 6 ++++++
include/hw/pci/pci.h | 7 +++++++
2 files changed, 13 insertions(+)
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 1416ae202c..8703d75ac3 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -2811,6 +2811,12 @@ void pci_setup_iommu(PCIBus *bus, const PCIIOMMUOps
*ops, void *opaque)
bus->iommu_opaque = opaque;
}
+void pci_setup_iommu_downstream_mem(PCIBus *bus, MemoryRegion *mr)
+{
+ assert(bus->iommu_ops && bus->iommu_ops->set_memory_region);
+ bus->iommu_ops->set_memory_region(bus->iommu_opaque, mr);
+}
+
static void pci_dev_get_w64(PCIBus *b, PCIDevice *dev, void *opaque)
{
Range *range = opaque;
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index cb3039bce8..9ae2cc61f1 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -450,6 +450,13 @@ void pci_device_unset_iommu_device(PCIDevice *dev);
* @opaque: passed to callbacks of the @ops structure.
*/
void pci_setup_iommu(PCIBus *bus, const PCIIOMMUOps *ops, void *opaque);
+/**
+ * pci_setup_iommu_downstream_mem: Designate a memory region for a PCIBus
+ *
+ * @bus: the #PCIBus being updated.
+ * @mr: the designated memory region.
+ */
+void pci_setup_iommu_downstream_mem(PCIBus *bus, MemoryRegion *mr);
pcibus_t pci_bar_address(PCIDevice *d,
int reg, uint8_t type, pcibus_t size);
--
2.43.2
- [RFC PATCH 0/6] Avoid contention for PCIIOMMUOps between IOMMU and PCIe host, Jason Chien, 2024/12/15
- [RFC PATCH 1/6] include/hw/pci: Add a callback to set the downstream memory region of a pci bus, Jason Chien, 2024/12/15
- [RFC PATCH 2/6] hw/pci: Add an API to set the downstream memory region of a PCI bus,
Jason Chien <=
- [RFC PATCH 3/6] hw/pci-host: Enable DW PCIe host to send memory transactions over specific mr, Jason Chien, 2024/12/15
- [RFC PATCH 4/6] hw/riscv/riscv-iommu: Allow PCI hosts with iommu_ops registered connecting to the IOMMU, Jason Chien, 2024/12/15
- [RFC PATCH 5/6] hw/riscv/riscv-iommu: Acquire device IDs dynamically, Jason Chien, 2024/12/15
- [RFC PATCH 6/6] include/hw/pci: Send PCI dma requests with memory attributes containing BDF, Jason Chien, 2024/12/15