]> Gentwo Git Trees - linux/.git/commit
PCI: xilinx-nwl: Fix ECAM programming
authorJani Nurminen <jani.nurminen@windriver.com>
Fri, 12 Sep 2025 09:09:48 +0000 (11:09 +0200)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 29 Sep 2025 21:37:23 +0000 (16:37 -0500)
commit98a4f5b7359205ced1b6a626df3963bf7c5e5052
tree5ea8fc9df6dc847295d5dc582c3ae71d1c34d46b
parent8f5ae30d69d7543eee0d70083daf4de8fe15d585
PCI: xilinx-nwl: Fix ECAM programming

When PCIe has been set up by the bootloader, the ecam_size field in the
E_ECAM_CONTROL register already contains a value.

The driver previously programmed it to 0xc (for 16 busses; 16 MB), but
bumped to 0x10 (for 256 busses; 256 MB) by the commit 2fccd11518f1 ("PCI:
xilinx-nwl: Modify ECAM size to enable support for 256 buses").

Regardless of what the bootloader has programmed, the driver ORs in a
new maximal value without doing a proper RMW sequence. This can lead to
problems.

For example, if the bootloader programs in 0xc and the driver uses 0x10,
the ORed result is 0x1c, which is beyond the ecam_max_size limit of 0x10
(from E_ECAM_CAPABILITIES).

Avoid the problems by doing a proper RMW.

Fixes: 2fccd11518f1 ("PCI: xilinx-nwl: Modify ECAM size to enable support for 256 buses")
Signed-off-by: Jani Nurminen <jani.nurminen@windriver.com>
[mani: added stable tag]
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/e83a2af2-af0b-4670-bcf5-ad408571c2b0@windriver.com
drivers/pci/controller/pcie-xilinx-nwl.c