linux/drivers/pci/controller/dwc
Krzysztof Wilczyński e7708f5b10 PCI: Unify ECAM constants in native PCI Express drivers
Add ECAM-related constants to provide a set of standard constants
defining memory address shift values to the byte-level address that can
be used to access the PCI Express Configuration Space, and then move
native PCI Express controller drivers to use the newly introduced
definitions retiring driver-specific ones.

Refactor pci_ecam_map_bus() function to use newly added constants so
that limits to the bus, device function and offset (now limited to 4K as
per the specification) are in place to prevent the defective or
malicious caller from supplying incorrect configuration offset and thus
targeting the wrong device when accessing extended configuration space.

This refactor also allows for the ".bus_shift" initialisers to be
dropped when the user is not using a custom value as a default value
will be used as per the PCI Express Specification.

Thanks to Qian Cai <qcai@redhat.com>, Michael Walle <michael@walle.cc>,
and Vladimir Oltean <olteanv@gmail.com> for reporting a pci_ecam_create()
issue with .bus_shift and to Vladimir for proposing the fix.

[bhelgaas: incorporate Vladimir's fix, update commit log]
Suggested-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20201129230743.3006978-2-kw@linux.com
Tested-by: Michael Walle <michael@walle.cc>
Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Jon Derrick <jonathan.derrick@intel.com>
Reviewed-by: Bjorn Helgaas <bhelgaas@google.com>
2020-12-10 14:55:49 -06:00
..
Kconfig PCI: meson: Build as module by default 2020-10-05 13:01:42 +01:00
Makefile PCI: uniphier: Add Socionext UniPhier Pro5 PCIe endpoint controller driver 2020-06-04 10:03:18 +01:00
pci-dra7xx.c PCI: dwc: Fix MSI page leakage in suspend/resume 2020-10-13 09:52:49 +01:00
pci-exynos.c PCI: dwc: exynos: Use pci_ops for root config space accessors 2020-09-08 16:37:02 +01:00
pci-imx6.c Merge branch 'remotes/lorenzo/pci/imx6' 2020-10-21 09:58:40 -05:00
pci-keystone.c PCI: keystone: Remove iATU register mapping 2020-10-13 09:52:49 +01:00
pci-layerscape-ep.c PCI: layerscape: Add EP mode support for ls1088a and ls2088a 2020-09-21 11:46:05 +01:00
pci-layerscape.c PCI: layerscape: Add LS1028a support 2019-11-08 10:45:00 +00:00
pci-meson.c Merge branch 'remotes/lorenzo/pci/meson' 2020-10-21 09:58:41 -05:00
pcie-al.c PCI: Unify ECAM constants in native PCI Express drivers 2020-12-10 14:55:49 -06:00
pcie-armada8k.c Merge branch 'pci/irq-error' 2020-08-05 18:24:22 -05:00
pcie-artpec6.c PCI: dwc: Move N_FTS setup to common setup 2020-09-10 16:50:53 +01:00
pcie-designware-ep.c PCI: designware-ep: Modify MSI and MSIX CAP way of finding 2020-09-21 11:46:04 +01:00
pcie-designware-host.c PCI: dwc: Restore ATU memory resource setup to use last entry 2020-11-04 13:55:30 -06:00
pcie-designware-plat.c PCI: dwc: Check CONFIG_PCI_MSI inside dw_pcie_msi_init() 2020-09-08 16:37:02 +01:00
pcie-designware.c PCI: dwc: Add common iATU register support 2020-10-13 09:52:49 +01:00
pcie-designware.h PCI: dwc: Fix MSI page leakage in suspend/resume 2020-10-13 09:52:49 +01:00
pcie-hisi.c PCI: Unify ECAM constants in native PCI Express drivers 2020-12-10 14:55:49 -06:00
pcie-histb.c PCI: dwc: Check CONFIG_PCI_MSI inside dw_pcie_msi_init() 2020-09-08 16:37:02 +01:00
pcie-intel-gw.c PCI: dwc: Move N_FTS setup to common setup 2020-09-10 16:50:53 +01:00
pcie-kirin.c Merge branch 'remotes/lorenzo/pci/kirin' 2020-10-21 09:58:41 -05:00
pcie-qcom.c Merge branch 'remotes/lorenzo/pci/qcom' 2020-10-21 09:58:43 -05:00
pcie-spear13xx.c PCI: dwc: Use DBI accessors 2020-09-10 16:50:53 +01:00
pcie-tegra194.c Merge branch 'remotes/lorenzo/pci/tegra' 2020-10-21 09:58:43 -05:00
pcie-uniphier-ep.c PCI: uniphier: Add Socionext UniPhier Pro5 PCIe endpoint controller driver 2020-06-04 10:03:18 +01:00
pcie-uniphier.c PCI: dwc: Check CONFIG_PCI_MSI inside dw_pcie_msi_init() 2020-09-08 16:37:02 +01:00