Re: [PATCH V6] PCI: rcar: Add L1 link state fix into data abort hook

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Lorenzo,

On Tue, Jul 27, 2021 at 6:11 PM Lorenzo Pieralisi
<lorenzo.pieralisi@xxxxxxx> 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@xxxxxxxxxxxxxx

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



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux