From: Volodymyr Babchuk <[email protected]> There are high chances that there will be a number of a consecutive accesses to configuration space of one device. To speed things up, we can program ATU only during first access.
This is mostly beneficial taking into account the previous patch that adds 1ms delay after ATU reprogramming. Signed-off-by: Volodymyr Babchuk <[email protected]> Signed-off-by: Mykyta Poturai <[email protected]> --- v1->v2: * rebased --- xen/arch/arm/pci/pci-designware.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xen/arch/arm/pci/pci-designware.c b/xen/arch/arm/pci/pci-designware.c index def2c12d63..cec52cf81a 100644 --- a/xen/arch/arm/pci/pci-designware.c +++ b/xen/arch/arm/pci/pci-designware.c @@ -272,6 +272,14 @@ static void dw_pcie_prog_outbound_atu(struct pci_host_bridge *pci, int index, int type, uint64_t cpu_addr, uint64_t pci_addr, uint64_t size) { + static uint64_t prev_addr = ~0; + + /* Simple optimization to not-program ATU for every transaction */ + if (prev_addr == pci_addr) + return; + + prev_addr = pci_addr; + __dw_pcie_prog_outbound_atu(pci, 0, index, type, cpu_addr, pci_addr, size); } -- 2.34.1
