[PATCH 1/2] PCI: Add CONFIG_PCI_ARCH_ENDIAN_AUTOSWAP

Timothy Pearson tpearson at raptorengineering.com
Sat Oct 18 05:17:56 AEDT 2025


Certain hardware devices, such as the IBM POWER9 CPU, transparently swap PCI
bus MMIO data endianness when running in big endian mode.  This transparent
data swapping presents issues for certain types of BARs, for example little
endian framebuffers, where the device driver needs to be aware the PCI BAR
is now appearing as big endian from the host's perspective.

Introduce CONFIG_PCI_ARCH_ENDIAN_AUTOSWAP and enable on ppc64 systems.

Signed-off-by: Timothy Pearson <tpearson at raptorengineering.com>
---
 arch/powerpc/Kconfig | 1 +
 drivers/pci/Kconfig  | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index e24f4d88885a..0e75fe570389 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -314,6 +314,7 @@ config PPC
 	select OF_EARLY_FLATTREE
 	select OLD_SIGACTION			if PPC32
 	select OLD_SIGSUSPEND
+	select PCI_ARCH_ENDIAN_AUTOSWAP		if PCI && PPC64
 	select PCI_DOMAINS			if PCI
 	select PCI_MSI_ARCH_FALLBACKS		if PCI_MSI
 	select PCI_SYSCALL			if PCI
diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
index 7065a8e5f9b1..fccc01110763 100644
--- a/drivers/pci/Kconfig
+++ b/drivers/pci/Kconfig
@@ -40,6 +40,10 @@ config PCI_DOMAINS_GENERIC
 config PCI_SYSCALL
 	bool
 
+config PCI_ARCH_ENDIAN_AUTOSWAP
+	bool
+	depends on PCI
+
 source "drivers/pci/pcie/Kconfig"
 
 config PCI_MSI
-- 
2.51.0


More information about the Linuxppc-dev mailing list