linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Hinko Kocevar <hinko.kocevar@ess.eu>
Cc: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>
Subject: Re: Recovering from AER: Uncorrected (Fatal) error
Date: Wed, 9 Dec 2020 15:32:27 -0600	[thread overview]
Message-ID: <20201209213227.GA2544987@bjorn-Precision-5520> (raw)
In-Reply-To: <d1ad4c01-ce73-dcc0-99b1-5fe45a984800@ess.eu>

On Wed, Dec 09, 2020 at 09:50:17PM +0100, Hinko Kocevar wrote:
> On 12/9/20 6:40 PM, Bjorn Helgaas wrote:

> > Hmm.  Yeah, I don't see anything in the path that would restore the
> > 01:00.0 config space, which seems like a problem.  Probably its
> > secondary/subordinate bus registers and window registers get reset to
> > 0 ("lspci -vv" would show that) so config/mem/io space below it is
> > accessible.
> 
> I guess the save/restore of the switch registers would be in the core PCI(e)
> code; and not a switch vendor/part specific.
> 
> I still have interest in getting this to work. With my limited knowledge of
> the PCI code base, is there anything I could do to help? Is there a
> particular code base area where you expect this should be managed; pci.c or
> pcie/aer.c or maybe hotplug/ source? I can try and tinker with it..
> 
> 
> Here is the 'lspci -vv' of the 01:00.0 device at the time after the reset:
> 
> 01:00.0 PCI bridge: PLX Technology, Inc. Device 8725 (rev ca) (prog-if 00
> [Normal decode])
>         Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr-
> Stepping- SERR- FastB2B- DisINTx-
>         Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort-
> <TAbort- <MAbort- >SERR- <PERR- INTx-
>         Interrupt: pin A routed to IRQ 128
>         Region 0: Memory at df200000 (32-bit, non-prefetchable) [virtual]
> [size=256K]
>         Bus: primary=00, secondary=00, subordinate=00, sec-latency=0
>         I/O behind bridge: 0000f000-00000fff [disabled]
>         Memory behind bridge: fff00000-000fffff [disabled]
>         Prefetchable memory behind bridge: 00000000fff00000-00000000000fffff
> [disabled]

Yep, this explains why nothing below the bridge is accessible.
Secondary/subordinate=0 means no config transactions will be
forwarded, and the windows are all disabled, so no MMIO transactions
will be forwarded either.

> Looks like many fields have been zeroed out. Should a bare
> restoration of the previous registers values be enough or does some
> other magic (i.e.  calling PCI functions/performing initialization
> tasks/etc) needs to happen to get that port back to sanity?

Good question.  Documentation/PCI/pci-error-recovery.rst has some
details about the design, including this:

  It is important for the platform to restore the PCI config space to
  the "fresh poweron" state, rather than the "last state". After a
  slot reset, the device driver will almost always use its standard
  device initialization routines, and an unusual config space setup
  may result in hung devices, kernel panics, or silent data
  corruption.

I'm not sure exactly how to interpret that.  It seems like "restoring
to 'fresh poweron' state" is basically just doing a reset, which gives
results like your 01:00.0 device above.  IIUC, we call a driver's
.slot_reset() callback after a reset, and it's supposed to be able to
initialize the device from power-on state.

01:00.0 is a Switch Upstream Port, so portdrv should claim it, and it
looks like pcie_portdrv_slot_reset() should be restoring some state.
But maybe dev->state_saved is false so pci_restore_state() bails out?
Maybe add some printks in that path to see where it's broken?

Bjorn

  reply	other threads:[~2020-12-09 21:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-04 12:52 Recovering from AER: Uncorrected (Fatal) error Hinko Kocevar
2020-12-04 22:38 ` Bjorn Helgaas
2020-12-09 10:02   ` Hinko Kocevar
2020-12-09 17:40     ` Bjorn Helgaas
2020-12-09 20:31       ` Hinko Kocevar
2020-12-09 20:50       ` Hinko Kocevar
2020-12-09 21:32         ` Bjorn Helgaas [this message]
2020-12-09 22:55           ` Hinko Kocevar
2020-12-10 12:56             ` Hinko Kocevar
2020-12-14 21:23             ` Keith Busch
2020-12-15 12:56               ` Hinko Kocevar
2020-12-15 18:56                 ` Keith Busch

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=20201209213227.GA2544987@bjorn-Precision-5520 \
    --to=helgaas@kernel.org \
    --cc=hinko.kocevar@ess.eu \
    --cc=linux-pci@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 NNTP newsgroup(s).