linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 0/5] PCI: Unify ECAM constants in native PCI Express drivers
@ 2020-11-29 23:07 Krzysztof Wilczyński
  2020-11-29 23:07 ` [PATCH v6 1/5] " Krzysztof Wilczyński
                   ` (6 more replies)
  0 siblings, 7 replies; 32+ messages in thread
From: Krzysztof Wilczyński @ 2020-11-29 23:07 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Rob Herring, Jonathan Cameron, Jonathan Chocron, Shawn Lin,
	Heiko Stuebner, Zhou Wang, Lorenzo Pieralisi, Will Deacon,
	Robert Richter, Michal Simek, Toan Le, Michael Ellerman,
	Benjamin Herrenschmidt, Paul Mackerras, Thomas Petazzoni,
	Nicolas Saenz Julienne, Florian Fainelli, Ray Jui, Scott Branden,
	Jonathan Derrick, linux-pci, linux-arm-kernel, linuxppc-dev,
	linux-rockchip, linux-rpi-kernel, bcm-kernel-feedback-list

Unify ECAM-related constants into a single set of standard constants
defining memory address shift values for the byte-level address that can
be used when accessing the PCI Express Configuration Space, and then
move native PCI Express controller drivers to use newly introduced
definitions retiring any driver-specific ones.

The ECAM ("Enhanced Configuration Access Mechanism") is defined by the
PCI Express specification (see PCI Express Base Specification, Revision
5.0, Version 1.0, Section 7.2.2, p. 676), thus most hardware should
implement it the same way.

Most of the native PCI Express controller drivers define their ECAM-related
constants, many of these could be shared, or use open-coded values when
setting the ".bus_shift" field of the "struct pci_ecam_ops".

All of the newly added constants should remove ambiguity and reduce the
number of open-coded values, and also correlate more strongly with the
descriptions in the aforementioned specification (see Table 7-1
"Enhanced Configuration Address Mapping", p. 677).

Suggested-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Krzysztof Wilczyński <kw@linux.com>

--- 
Changed in v6:
  Converted single patch into a series.
  Dropped changes related to PPC 4xx platform.
  Refactored pci_ecam_map_bus() so that bus, device function and offset
  are correctly masked, limiting offset to 4K as per the PCI Express
  Specification.  After the refactor this function will now use sensible
  defaults allowing for removal of the ".bus_shit" initialiser from all
  the users of the "ecam_ops" structure who do not use a non-standard
  ECAM bus shit values.

Changed in v5:
  Removed unused constant "PCIE_ECAM_DEV_SHIFT".
  Refactored ppc4xx_pciex_get_config_base() so that the "offset"
  parameter can be passed to so that the PCIE_ECAM_OFFSET() macro
  can be used.
  Used the ALIGN_DOWN() macro where 32 bit alignment is required
  instead using the 0xffc mask.
  Added CFG_ADDR_CFG_TYPE_1 macro to pci/controller/pcie-iproc.c to
  denote that this is a configuration type 1 address and access type.
  Refactored boundary check in pci/controller/vmd.c as used by the
  vmd_cfg_addr() function following addition of the PCIE_ECAM_OFFSET()
  macro.
  Changed the "bus->number" to simply pass the "bus" argument in the
  PCIE_ECAM_OFFSET() macro.

Changed in v4:
  Removed constants related to "CAM".
  Added more platforms and devices that can use new ECAM macros and
  constants.
  Removed unused ".bus_shift" initialisers from pci-xgene.c as
  xgene_pcie_map_bus() did not use these.

Changes in v3:
  Updated commit message wording.
  Updated regarding custom ECAM bus shift values and concerning PCI base
  configuration space access for Type 1 access.
  Refactored rockchip_pcie_rd_other_conf() and rockchip_pcie_wr_other_conf()
  and removed the "busdev" variable.
  Removed surplus "relbus" variable from nwl_pcie_map_bus() and
  xilinx_pcie_map_bus().
  Renamed the PCIE_ECAM_ADDR() macro to PCIE_ECAM_OFFSET().

Changes in v2:
  Use PCIE_ECAM_ADDR macro when computing ECAM address offset, but drop
  PCI_SLOT and PCI_FUNC macros from the PCIE_ECAM_ADDR macro in favour
  of using a single value for the device/function.

Krzysztof Wilczyński (5):
  PCI: Unify ECAM constants in native PCI Express drivers
  PCI: thunder-pem: Add constant for custom ".bus_shit" initialiser
  PCI: iproc: Convert to use the new ECAM constants
  PCI: vmd: Update type of the __iomem pointers
  PCI: xgene: Removed unused ".bus_shift" initialisers from pci-xgene.c

 drivers/pci/controller/dwc/pcie-al.c        | 12 ++------
 drivers/pci/controller/dwc/pcie-hisi.c      |  2 --
 drivers/pci/controller/pci-aardvark.c       | 13 ++-------
 drivers/pci/controller/pci-host-generic.c   |  1 -
 drivers/pci/controller/pci-thunder-ecam.c   |  1 -
 drivers/pci/controller/pci-thunder-pem.c    | 13 +++++++--
 drivers/pci/controller/pci-xgene.c          |  2 --
 drivers/pci/controller/pcie-brcmstb.c       | 16 ++---------
 drivers/pci/controller/pcie-iproc.c         | 31 ++++++---------------
 drivers/pci/controller/pcie-rockchip-host.c | 27 +++++++++---------
 drivers/pci/controller/pcie-rockchip.h      |  8 +-----
 drivers/pci/controller/pcie-tango.c         |  1 -
 drivers/pci/controller/pcie-xilinx-nwl.c    |  9 ++----
 drivers/pci/controller/pcie-xilinx.c        | 11 ++------
 drivers/pci/controller/vmd.c                | 19 ++++++-------
 drivers/pci/ecam.c                          | 23 ++++++++++-----
 include/linux/pci-ecam.h                    | 27 ++++++++++++++++++
 17 files changed, 96 insertions(+), 120 deletions(-)

-- 
2.29.2


^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2020-12-10 19:59 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-29 23:07 [PATCH v6 0/5] PCI: Unify ECAM constants in native PCI Express drivers Krzysztof Wilczyński
2020-11-29 23:07 ` [PATCH v6 1/5] " Krzysztof Wilczyński
2020-11-30 11:08   ` Lorenzo Pieralisi
2020-11-30 15:30     ` Krzysztof Wilczyński
2020-11-30 18:23   ` Derrick, Jonathan
2020-12-06 20:16   ` Krzysztof Wilczyński
2020-12-07  3:25     ` Florian Fainelli
2020-12-07 20:29       ` Jim Quinlan
2020-11-29 23:07 ` [PATCH v6 2/5] PCI: thunder-pem: Add constant for custom ".bus_shit" initialiser Krzysztof Wilczyński
2020-11-29 23:07 ` [PATCH v6 3/5] PCI: iproc: Convert to use the new ECAM constants Krzysztof Wilczyński
2020-11-29 23:07 ` [PATCH v6 4/5] PCI: vmd: Update type of the __iomem pointers Krzysztof Wilczyński
2020-11-30  9:06   ` David Laight
2020-11-30 17:20     ` Bjorn Helgaas
2020-11-30 18:19       ` Derrick, Jonathan
2020-11-29 23:07 ` [PATCH v6 5/5] PCI: xgene: Removed unused ".bus_shift" initialisers from pci-xgene.c Krzysztof Wilczyński
2020-12-01 15:34 ` [PATCH v6 0/5] PCI: Unify ECAM constants in native PCI Express drivers Lorenzo Pieralisi
2020-12-08 15:41   ` Michael Walle
2020-12-08 21:06     ` Bjorn Helgaas
2020-12-08 21:11       ` Michael Walle
2020-12-09 12:36     ` Bjorn Helgaas
2020-12-09 13:08       ` Michael Walle
2020-12-09 14:57         ` Bjorn Helgaas
2020-12-09 15:40           ` Michael Walle
2020-12-09 20:29             ` Vladimir Oltean
2020-12-09 20:59               ` Bjorn Helgaas
2020-12-09 21:20                 ` Vladimir Oltean
2020-12-09 21:34                   ` Bjorn Helgaas
2020-12-09 21:43                     ` Vladimir Oltean
2020-12-09 22:05                       ` Bjorn Helgaas
2020-12-10 17:38               ` Bjorn Helgaas
2020-12-10 19:58                 ` Michael Walle
2020-12-08 16:07 ` Qian Cai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).