[PATCH 1/2] PCI: Add CONFIG_PCI_ARCH_ENDIAN_AUTOSWAP

Thomas Zimmermann tzimmermann at suse.de
Fri Nov 21 19:00:01 AEDT 2025


Hi,

sorry for the delay in reviewing. I've wondered for some time what to 
make of this series.

Am 17.10.25 um 20:17 schrieb Timothy Pearson:
> 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.

I would not want a config option. In the latest version of the driver, 
we have a struct to describe device quirks. [1] I think we should detect 
this scenario in the driver and set the quirk if necessary. The 
detection can be at compile time though.

If this problem affects many graphics drivers, we can re-evaluate.

[1] 
https://gitlab.freedesktop.org/drm/misc/kernel/-/blob/drm-misc-next-2025-11-14/drivers/gpu/drm/ast/ast_drv.h?ref_type=tags#L167

Best regards
Thomas

>
> 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

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)




More information about the Linuxppc-dev mailing list