aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorSongyang Li <leesongyang@outlook.com>2024-03-20 23:22:00 +0800
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>2024-04-15 10:22:22 +0200
commit29b83a64df3b42c88c0338696feb6fdcd7f1f3b7 (patch)
tree50d57a01bbbaa8fa2a4f3ad0855c41e840f4fd6e
parenta1b7508cef6208ad06377d2aa05b0f89f7d6b516 (diff)
downloadlinux-29b83a64df3b42c88c0338696feb6fdcd7f1f3b7.tar.gz
MIPS: Octeon: Add PCIe link status check
The standard PCIe configuration read-write interface is used to access the configuration space of the peripheral PCIe devices of the mips processor after the PCIe link surprise down, it can generate kernel panic caused by "Data bus error". So it is necessary to add PCIe link status check for system protection. When the PCIe link is down or in training, assigning a value of 0 to the configuration address can prevent read-write behavior to the configuration space of peripheral PCIe devices, thereby preventing kernel panic. Signed-off-by: Songyang Li <leesongyang@outlook.com> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
-rwxr-xr-x[-rw-r--r--]arch/mips/pci/pcie-octeon.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/mips/pci/pcie-octeon.c b/arch/mips/pci/pcie-octeon.c
index 2583e318e8c6b3..b080c7c6cc4632 100644..100755
--- a/arch/mips/pci/pcie-octeon.c
+++ b/arch/mips/pci/pcie-octeon.c
@@ -230,12 +230,18 @@ static inline uint64_t __cvmx_pcie_build_config_addr(int pcie_port, int bus,
{
union cvmx_pcie_address pcie_addr;
union cvmx_pciercx_cfg006 pciercx_cfg006;
+ union cvmx_pciercx_cfg032 pciercx_cfg032;
pciercx_cfg006.u32 =
cvmx_pcie_cfgx_read(pcie_port, CVMX_PCIERCX_CFG006(pcie_port));
if ((bus <= pciercx_cfg006.s.pbnum) && (dev != 0))
return 0;
+ pciercx_cfg032.u32 =
+ cvmx_pcie_cfgx_read(pcie_port, CVMX_PCIERCX_CFG032(pcie_port));
+ if ((pciercx_cfg032.s.dlla == 0) || (pciercx_cfg032.s.lt == 1))
+ return 0;
+
pcie_addr.u64 = 0;
pcie_addr.config.upper = 2;
pcie_addr.config.io = 1;