From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: Songyang Li <leesongyang@outlook.com>
Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] MIPS: Octeon: Add PCIe link status check
Date: Mon, 15 Apr 2024 10:34:26 +0200 [thread overview]
Message-ID: <ZhzmkuYJOTIVNVL9@alpha.franken.de> (raw)
In-Reply-To: <TY3P286MB27542582C36379EB4A128DEFB4332@TY3P286MB2754.JPNP286.PROD.OUTLOOK.COM>
On Wed, Mar 20, 2024 at 11:22:00PM +0800, Songyang Li wrote:
> 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>
> ---
> arch/mips/pci/pcie-octeon.c | 6 ++++++
> 1 file changed, 6 insertions(+)
> mode change 100644 => 100755 arch/mips/pci/pcie-octeon.c
>
> diff --git a/arch/mips/pci/pcie-octeon.c b/arch/mips/pci/pcie-octeon.c
> old mode 100644
> new mode 100755
> index 2583e318e8c6..b080c7c6cc46
> --- 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;
> --
> 2.34.1
applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
prev parent reply other threads:[~2024-04-15 8:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-20 15:22 [PATCH] MIPS: Octeon: Add PCIe link status check Songyang Li
2024-04-15 8:34 ` Thomas Bogendoerfer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZhzmkuYJOTIVNVL9@alpha.franken.de \
--to=tsbogend@alpha.franken.de \
--cc=leesongyang@outlook.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).