Skip to content

RFC Generic way of dealing with broken 64-bit buses

Nicolas Saenz Julienne linux-arm-kernel linux-devicetree lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest13 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13dt-bindings: Introduce 64bit-mmio-brokenDocumentation/devicetree/bindings/common-properties.txt+15 -00 replies
2/13driver core: Introduce MMIO configurationarch/Kconfig drivers/base/dd.c include/linux/device.h +1 more+20 -02 replies
3/13of: device: Introduce of_mmio_configure()drivers/of/device.c include/linux/of_device.h+27 -00 replies
4/13driver core: plafrom: Introduce platform_mmio_configure()drivers/base/platform.c+9 -00 replies
5/13pci: Introduce pci_mmio_configure()drivers/pci/pci-driver.c+26 -00 replies
6/13device core: Introduce dev_64bit_mmio_supported()include/linux/device.h+17 -00 replies
7/13arm64: Mark ARCH_MVEBU as needing broken 64bit MMIO supportarch/arm64/Kconfig.platforms+1 -00 replies
8/13arm64: dts: marvell: armada-ap80x: Mark config-space bus as 64bit-mmio-brokenarch/arm64/boot/dts/marvell/armada-ap80x.dtsi+1 -00 replies
9/13iommu/arm-smmu: Make use of dev_64bit_mmio_supported()drivers/iommu/arm/arm-smmu/arm-smmu.c drivers/iommu/arm/arm-smmu/arm-smmu.h+16 -25 replies
10/13iommu/arm-smmu-impl: Get rid of Marvell's implementation detailsdrivers/iommu/arm/arm-smmu/arm-smmu-impl.c+0 -212 replies
11/13arm64: Mark ARCH_BCM2835 as needing broken 64bit MMIO supportarch/arm64/Kconfig.platforms+1 -00 replies
12/13ARM: dts: bcm2711: Mark PCIe bus as 64bit-mmio-brokenarch/arm/boot/dts/bcm2711.dtsi+1 -00 replies
13/13scsi: megaraid: Make use of dev_64bit_mmio_supported()drivers/scsi/megaraid/megaraid_sas_fusion.c+11 -122 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC 00/13] Generic way of dealing with broken 64-bit buses

BCM2711, Raspberry Pi 4's arm64 system on chip, contains a PCIe bus that can't handle 64-bit accesses to its MMIO address space. The issue has already been discussed here[1], and it turns out BCM2711 isn't the only broken device in the wild.

In most cases, the solution to this issue is to convert writeq/readq() to into their lo_hi/hi_lo variants and the eventual introduction of some amount of locking. But that's not good enough for every device. For example, on some arm's SMMU configurations atomic 64-bit accesses are mandatory. This series tries to introduce a mechanism for drivers to be able to ascertain whether or not they are allowed to perform 64-bit accesses.

The big question is the amount of granularity needed to deal with this (think here of distro images):

- Build-time: if a broken platform included in the image, disallow any 64-bit access. Drivers that need 64-bit accesses could simply bypass the check and hope for the best. Imposes a performance penalty on otherwise well behaving platforms, and features that depend on 64bit access might be disabled unnecessarily. It's simple to implement, yet not very generic/future proof.

- Run-time: allow/disallow 64-bit accesses based on boot time checks (i.e. check which platform the kernel is running on). Gets rid of all the negative aspects imposed to well-behaving platforms. Well-behaving buses can't coexist with broken ones while using all features.

- Per-device: each device has its MMIO access properties and can take decisions based on its local bus. That said, I'm not aware of a system that absolutely needs this ATM.

This series implements the third option mainly as a proof of concept. It's my personal preference on how to deal with this. That said, my main aim ATM is to settle on a general approach.

Regards,
Nicolas

[1] https://lore.kernel.org/linux-arm-kernel/[email protected]/

---

Nicolas Saenz Julienne (13):
dt-bindings: Introduce 64bit-mmio-broken
driver core: Introduce MMIO configuration
of: device: Introduce of_mmio_configure()
driver core: plafrom: Introduce platform_mmio_configure()
pci: Introduce pci_mmio_configure()
device core: Introduce dev_64bit_mmio_supported()
arm64: Mark ARCH_MVEBU as needing broken 64bit MMIO support
arm64: dts: marvell: armada-ap80x: Mark config-space bus as
64bit-mmio-broken
iommu/arm-smmu: Make use of dev_64bit_mmio_supported() iommu/arm-smmu-impl: Get rid of Marvell's implementation details
arm64: Mark ARCH_BCM2835 as needing broken 64bit MMIO support
ARM: dts: bcm2711: Mark PCIe bus as 64bit-mmio-broken
scsi: megaraid: Make use of dev_64bit_mmio_supported()

 .../devicetree/bindings/common-properties.txt | 15 +++++++++++
 arch/Kconfig                                  |  8 ++++++
 arch/arm/boot/dts/bcm2711.dtsi                |  1 +
 arch/arm64/Kconfig.platforms                  |  2 ++
 arch/arm64/boot/dts/marvell/armada-ap80x.dtsi |  1 +
 drivers/base/dd.c                             |  6 +++++
 drivers/base/platform.c                       |  9 +++++++
 drivers/iommu/arm/arm-smmu/arm-smmu-impl.c    | 21 ---------------
 drivers/iommu/arm/arm-smmu/arm-smmu.c         |  9 +++++++
 drivers/iommu/arm/arm-smmu/arm-smmu.h         |  9 +++++--
 drivers/of/device.c                           | 19 ++++++++++++++
 drivers/pci/pci-driver.c                      | 26 +++++++++++++++++++
 drivers/scsi/megaraid/megaraid_sas_fusion.c   | 23 ++++++++--------
 include/linux/device.h                        | 20 ++++++++++++++
 include/linux/device/bus.h                    |  3 +++
 include/linux/of_device.h                     |  8 ++++++
 16 files changed, 145 insertions(+), 35 deletions(-)
Signature · 1 line
2.30.1