linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: "Pali Rohár" <pali@kernel.org>,
	"Bjorn Helgaas" <helgaas@kernel.org>,
	"Marek Vasut" <marek.vasut@gmail.com>,
	linux-pci <linux-pci@vger.kernel.org>,
	"Marek Vasut" <marek.vasut+renesas@gmail.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Wolfram Sang" <wsa@the-dreams.de>,
	"Yoshihiro Shimoda" <yoshihiro.shimoda.uh@renesas.com>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH V6] PCI: rcar: Add L1 link state fix into data abort hook
Date: Tue, 27 Jul 2021 18:16:29 +0200	[thread overview]
Message-ID: <CAMuHMdVxBCe2TKNkAHCNtmGFs5ozvx2gouxr4JErrdVZOi-8EQ@mail.gmail.com> (raw)
In-Reply-To: <20210727161142.GA15814@lpieralisi>

Hi Lorenzo,

On Tue, Jul 27, 2021 at 6:11 PM Lorenzo Pieralisi
<lorenzo.pieralisi@arm.com> wrote:
> On Mon, Jul 19, 2021 at 07:23:40PM +0200, Pali Rohár wrote:
>
> [...]
>
> > > > > +#ifdef CONFIG_ARM
> > > > > +static DEFINE_SPINLOCK(pmsr_lock);
> > > > > +static int rcar_pcie_aarch32_abort_handler(unsigned long addr,
> > > > > +               unsigned int fsr, struct pt_regs *regs)
> > > > > +{
> > > > > +       unsigned long flags;
> > > > > +       int ret = 0;
> > > > > +       u32 pmsr;
> > > > > +
> > > > > +       spin_lock_irqsave(&pmsr_lock, flags);
> > > > > +
> > > > > +       if (!pcie_base || !__clk_is_enabled(pcie_bus_clk)) {
> > > > > +               ret = 1;
> > > > > +               goto unlock_exit;
> > > > > +       }
> > > > > +
> > > > > +       pmsr = readl(pcie_base + PMSR);
> > > > > +
> > > > > +       /*
> > > > > +        * Test if the PCIe controller received PM_ENTER_L1 DLLP and
> > > > > +        * the PCIe controller is not in L1 link state. If true, apply
> > > > > +        * fix, which will put the controller into L1 link state, from
> > > > > +        * which it can return to L0s/L0 on its own.
> > > > > +        */
> > > > > +       if ((pmsr & PMEL1RX) && ((pmsr & PMSTATE) != PMSTATE_L1)) {
> > > > > +               writel(L1IATN, pcie_base + PMCTLR);
> > > > > +               while (!(readl(pcie_base + PMSR) & L1FAEG))
> > > > > +                       ;
> >
> > Infinite loop in abort handler is not a good idea. If this software
> > workaround is not able to fix HW in broken state then it is better to
> > let kernel finish abort handler and reboot machine (or whatever is
> > default action for particular abort handler).

The default action is to crash with an imprecise external abort.

> Probably worth adding a timeout, I can do it before merging it.

Indeed, better to lock up with a message than without ;-)

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  reply	other threads:[~2021-07-27 16:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-14 20:05 marek.vasut
2021-05-17  7:39 ` Geert Uytterhoeven
2021-07-17 17:33 ` Bjorn Helgaas
2021-07-17 18:14   ` Marek Vasut
2021-07-19  8:59   ` Lorenzo Pieralisi
2021-07-19 15:38     ` Marek Vasut
2021-07-19 17:23     ` Pali Rohár
2021-07-19 18:39       ` Marek Vasut
2021-07-22 20:31         ` Pali Rohár
2021-07-19 22:06       ` Bjorn Helgaas
2021-07-27 16:11       ` Lorenzo Pieralisi
2021-07-27 16:16         ` Geert Uytterhoeven [this message]
2021-07-26 14:47   ` Geert Uytterhoeven
2021-07-26 17:49     ` Bjorn Helgaas
2021-07-27 16:32       ` Lorenzo Pieralisi
2021-08-05 18:30         ` Pali Rohár
2021-07-27 17:08       ` Marek Vasut
2021-08-04 11:06         ` Lorenzo Pieralisi

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=CAMuHMdVxBCe2TKNkAHCNtmGFs5ozvx2gouxr4JErrdVZOi-8EQ@mail.gmail.com \
    --to=geert@linux-m68k.org \
    --cc=bhelgaas@google.com \
    --cc=geert+renesas@glider.be \
    --cc=helgaas@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=marek.vasut+renesas@gmail.com \
    --cc=marek.vasut@gmail.com \
    --cc=pali@kernel.org \
    --cc=wsa@the-dreams.de \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    --subject='Re: [PATCH V6] PCI: rcar: Add L1 link state fix into data abort hook' \
    /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

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 NNTP newsgroup(s).