public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Sathyanarayanan Kuppuswamy  <sathyanarayanan.kuppuswamy@linux.intel.com>
Cc: "Natu, Mahesh" <mahesh.natu@intel.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] PCI/EDR: Clear PCIe Device Status errors after EDR error recovery
Date: Fri, 7 Apr 2023 17:41:42 -0500	[thread overview]
Message-ID: <20230407224142.GA3829056@bhelgaas> (raw)
In-Reply-To: <cc7cc268-f614-beaf-da5a-a4db9137c38a@linux.intel.com>

On Fri, Apr 07, 2023 at 03:19:32PM -0700, Sathyanarayanan Kuppuswamy wrote:
> On 4/7/23 9:46 AM, Bjorn Helgaas wrote:
> > On Thu, Apr 06, 2023 at 10:31:20PM -0700, Sathyanarayanan Kuppuswamy wrote:
> >> On 4/6/23 3:21 PM, Bjorn Helgaas wrote:
> >>> On Thu, Apr 06, 2023 at 02:52:02PM -0700, Sathyanarayanan Kuppuswamy wrote:
> >>>> On 4/6/23 2:07 PM, Bjorn Helgaas wrote:
> >>>>> On Wed, Mar 15, 2023 at 04:54:49PM -0700, Kuppuswamy Sathyanarayanan wrote:
> >>>>>> Commit 068c29a248b6 ("PCI/ERR: Clear PCIe Device Status errors only if
> >>>>>> OS owns AER") adds support to clear error status in the Device Status
> >>>>>> Register(DEVSTA) only if OS owns the AER support. But this change
> >>>>>> breaks the requirement of the EDR feature which requires OS to cleanup
> >>>>>> the error registers even if firmware owns the control of AER support.

> ...
> > An EDR notification is issued on a bus device that is still present,
> > i.e., a DPC port or parent, but child devices have been disconnected
> > (ACPI v6.3, sec 5.6.6).
> 
> IMO, instead of bus device, we can call it as root port or down stream
> port. Please check the PCI firmware specification, r3.3, section 4.3.13.

Yeah, that makes sense.  I just used the "bus device" language because
that's what's in the ACPI spec.  But I think the PCI terms would
probably be more helpful here.  And I'll cite the r6.5 spec instead of
v6.3.

> Firmware may wish to issue Error Disconnect Recover notification on a port
> that is parent of the port that experienced the containment event.
> 
> So it is either a downstream port or a root port.

Right.

> > That box *does* suggest clearing the port error status before bringing
> > the port out of DPC, and we're doing it in the opposite order:
> > 
> >   edr_handle_event(pdev)
> >     edev = acpi_dpc_port_get(pdev)
> >     # Both pdev and edev are present; pdev is same as edev or a
> >     # parent of edev; children of edev are disconnected
> >     dpc_process_error(edev)
> >     pcie_do_recovery(edev, dpc_reset_link)
> >       if (state == pci_channel_io_frozen)
> >         dpc_reset_link                  # (reset_subordinates)
> >           pci_write_config_word(PCI_EXP_DPC_STATUS_TRIGGER) # exit DPC
> >       if (AER native)
> >         pcie_clear_device_status(edev)
> >           clear PCI_EXP_DEVSTA          # doesn't happen
> >     if (PCI_ERS_RESULT_RECOVERED)
> >       pcie_clear_device_status
> >         clear PCI_EXP_DEVSTA            # added by this patch
> > 
> > Does it matter?  I dunno, but I don't *think* so.  We really don't
> > care about the value of PCI_EXP_DEVSTA anywhere except
> > pci_wait_for_pending_transaction(), which isn't applicable here.  And
> > I don't think the fact that it probably has an Error Detected bit set
> > when exiting DPC is a problem.
> 
> Agree that it is not a fatal issue. But leaving the stale error state
> is something that needs to be fixed.

Definitely agree we should clear the stale state.  I just meant that I
don't think it matters that we clear the status *after* exiting DPC,
instead of clearing it before exiting DPC as shown in the flowchart.

Bjorn

  reply	other threads:[~2023-04-07 22:42 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-15 23:54 [PATCH v2] PCI/EDR: Clear PCIe Device Status errors after EDR error recovery Kuppuswamy Sathyanarayanan
2023-03-24 17:53 ` Sathyanarayanan Kuppuswamy
2023-03-29 22:09 ` Bjorn Helgaas
2023-03-29 22:38   ` Sathyanarayanan Kuppuswamy
2023-03-30 15:45     ` Bjorn Helgaas
2023-03-31  6:46       ` Sathyanarayanan Kuppuswamy
2023-03-31 15:10         ` Bjorn Helgaas
2023-04-06 21:07 ` Bjorn Helgaas
2023-04-06 21:52   ` Sathyanarayanan Kuppuswamy
2023-04-06 22:21     ` Bjorn Helgaas
2023-04-06 22:46       ` Natu, Mahesh
2023-04-07  5:31       ` Sathyanarayanan Kuppuswamy
2023-04-07 16:46         ` Bjorn Helgaas
2023-04-07 22:19           ` Sathyanarayanan Kuppuswamy
2023-04-07 22:41             ` Bjorn Helgaas [this message]
2023-04-07 21:51 ` Bjorn Helgaas
2023-04-07 21:52   ` Bjorn Helgaas
2023-04-07 22:25     ` Sathyanarayanan Kuppuswamy
2023-04-07 22:21   ` Sathyanarayanan Kuppuswamy

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=20230407224142.GA3829056@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mahesh.natu@intel.com \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    /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