1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/drivers/pci/controller/dwc
Serge Semin 8522e17d4c PCI: dwc: Introduce dma-ranges property support for RC-host
In accordance with the generic PCIe Root Port DT-bindings the "dma-ranges"
property has the same format as the "ranges" property. The only difference
is in their semantics. The "dma-ranges" property describes the PCIe-to-CPU
memory mapping in opposite to the CPU-to-PCIe mapping of the "ranges"
property. Even though the DW PCIe controllers are normally equipped with
the internal Address Translation Unit which inbound and outbound tables
can be used to implement both properties semantics, it was surprising for
me to discover that the host-related part of the DW PCIe driver currently
supports the "ranges" property only while the "dma-ranges" windows are
just ignored. Having the "dma-ranges" supported in the driver would be
very handy for the platforms, that don't tolerate the 1:1 CPU-PCIe memory
mapping and require a customized PCIe memory layout. So let's fix that by
introducing the "dma-ranges" property support.

First of all we suggest to rename the dw_pcie_prog_inbound_atu() method to
dw_pcie_prog_ep_inbound_atu() and create a new version of the
dw_pcie_prog_inbound_atu() function. Thus we'll have two methods for the
RC and EP controllers respectively in the same way as it has been
developed for the outbound ATU setup methods.

Secondly aside with the memory window index and type the new
dw_pcie_prog_inbound_atu() function will accept CPU address, PCIe address
and size as its arguments. These parameters define the PCIe and CPU memory
ranges which will be used to setup the respective inbound ATU mapping. The
passed parameters need to be verified against the ATU ranges constraints
in the same way as it is done for the outbound ranges.

Finally the DMA-ranges detected for the PCIe controller need to be
converted to the inbound ATU entries during the host controller
initialization procedure. It will be done in the framework of the
dw_pcie_iatu_setup() method. Note before setting the inbound ranges up we
need to disable all the inbound ATU entries in order to prevent unexpected
PCIe TLPs translations defined by some third party software like
bootloaders.

Link: https://lore.kernel.org/r/20221113191301.5526-16-Sergey.Semin@baikalelectronics.ru
Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2022-11-23 16:01:55 +01:00
..
Kconfig Merge branch 'remotes/lorenzo/pci/qcom' 2021-11-05 11:28:52 -05:00
Makefile PCI: qcom-ep: Add Qualcomm PCIe Endpoint controller driver 2021-10-11 15:34:02 -05:00
pci-dra7xx.c Merge branch 'pci/ctrl/pm-ops' 2022-08-04 11:46:52 -05:00
pci-exynos.c Merge branch 'pci/ctrl/pm-ops' 2022-08-04 11:46:52 -05:00
pci-imx6.c PCI: imx6: Initialize PHY before deasserting core reset 2022-11-11 16:56:10 +01:00
pci-keystone.c Merge branch 'pci/misc' 2022-08-04 11:46:53 -05:00
pci-layerscape-ep.c PCI: dwc: Add start_link/stop_link inlines 2022-07-05 19:00:52 -05:00
pci-layerscape.c PCI: dwc: Rename struct pcie_port to dw_pcie_rp 2022-07-05 19:00:52 -05:00
pci-meson.c PCI: dwc: Rename struct pcie_port to dw_pcie_rp 2022-07-05 19:00:52 -05:00
pcie-al.c PCI: dwc: Rename struct pcie_port to dw_pcie_rp 2022-07-05 19:00:52 -05:00
pcie-armada8k.c Merge branch 'pci/misc' 2022-08-04 11:46:53 -05:00
pcie-artpec6.c PCI: dwc: Rename struct pcie_port to dw_pcie_rp 2022-07-05 19:00:52 -05:00
pcie-designware-ep.c PCI: dwc: Introduce dma-ranges property support for RC-host 2022-11-23 16:01:55 +01:00
pcie-designware-host.c PCI: dwc: Introduce dma-ranges property support for RC-host 2022-11-23 16:01:55 +01:00
pcie-designware-plat.c PCI: dwc-plat: Drop dw_plat_pcie_of_match[] forward declaration 2022-07-05 19:00:52 -05:00
pcie-designware.c PCI: dwc: Introduce dma-ranges property support for RC-host 2022-11-23 16:01:55 +01:00
pcie-designware.h PCI: dwc: Introduce dma-ranges property support for RC-host 2022-11-23 16:01:55 +01:00
pcie-dw-rockchip.c PCI: dwc: Rename struct pcie_port to dw_pcie_rp 2022-07-05 19:00:52 -05:00
pcie-fu740.c Merge branch 'pci/ctrl/fu740' 2022-08-04 11:41:55 -05:00
pcie-hisi.c PCI: hisi: Avoid invalid address space conversions 2022-01-03 15:05:28 -06:00
pcie-histb.c PCI: histb: Switch to using gpiod API 2022-11-14 11:56:50 +01:00
pcie-intel-gw.c Merge branch 'pci/ctrl/pm-ops' 2022-08-04 11:46:52 -05:00
pcie-keembay.c PCI: dwc: Convert struct pcie_port.msi_irq to an array 2022-08-01 15:15:33 -05:00
pcie-kirin.c PCI: dwc: Replace of_gpio_named_count() by gpiod_count() 2022-10-03 10:34:46 +02:00
pcie-qcom-ep.c PCI: qcom-ep: Check platform_get_resource_byname() return value 2022-10-05 17:30:55 -05:00
pcie-qcom.c PCI: qcom: Fix error message for reset_control_assert() 2022-11-10 16:05:20 +01:00
pcie-spear13xx.c Merge branch 'pci/misc' 2022-08-04 11:46:53 -05:00
pcie-tegra194-acpi.c PCI: dwc: Simplify in/outbound iATU setup methods 2022-08-01 15:15:09 -05:00
pcie-tegra194.c Merge branch 'pci/ctrl/tegra194' 2022-08-04 11:46:51 -05:00
pcie-uniphier-ep.c PCI: uniphier-ep: Add NX1 support 2022-02-11 16:26:21 +00:00
pcie-uniphier.c PCI: dwc: Rename struct pcie_port to dw_pcie_rp 2022-07-05 19:00:52 -05:00
pcie-visconti.c PCI: dwc: Rename struct pcie_port to dw_pcie_rp 2022-07-05 19:00:52 -05:00