All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: "Limonciello, Mario" <Mario.Limonciello@amd.com>
Cc: "Natikar, Basavaraj" <Basavaraj.Natikar@amd.com>,
	"bhelgaas@google.com" <bhelgaas@google.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"thomas@glanzmann.de" <thomas@glanzmann.de>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>
Subject: Re: [PATCH] PCI: Add quirk to clear MSI-X
Date: Mon, 20 Mar 2023 14:36:30 -0500	[thread overview]
Message-ID: <20230320193630.GA2301992@bhelgaas> (raw)
In-Reply-To: <MN0PR12MB61016417794D1AF00963AEC3E2809@MN0PR12MB6101.namprd12.prod.outlook.com>

On Mon, Mar 20, 2023 at 05:20:55PM +0000, Limonciello, Mario wrote:
> > -----Original Message-----
> > From: Bjorn Helgaas <helgaas@kernel.org>
> > Sent: Monday, March 20, 2023 12:15
> > To: Limonciello, Mario <Mario.Limonciello@amd.com>
> > Cc: Natikar, Basavaraj <Basavaraj.Natikar@amd.com>;
> > bhelgaas@google.com; linux-pci@vger.kernel.org; thomas@glanzmann.de;
> > Rafael J. Wysocki <rjw@rjwysocki.net>
> > Subject: Re: [PATCH] PCI: Add quirk to clear MSI-X

Whatever you're using for email adds all these redundant headers to
every response...

> > On Mon, Mar 20, 2023 at 01:32:16AM +0000, Limonciello, Mario wrote:
> > > > -----Original Message-----
> > > > From: Bjorn Helgaas <helgaas@kernel.org>
> > > > Sent: Friday, March 10, 2023 16:14
> > > > To: Limonciello, Mario <Mario.Limonciello@amd.com>
> > > > Cc: Natikar, Basavaraj <Basavaraj.Natikar@amd.com>; Natikar, Basavaraj
> > > > <Basavaraj.Natikar@amd.com>; bhelgaas@google.com; linux-
> > > > pci@vger.kernel.org; thomas@glanzmann.de
> > > > Subject: Re: [PATCH] PCI: Add quirk to clear MSI-X
> > > >
> > > > On Thu, Mar 09, 2023 at 06:57:38PM -0600, Mario Limonciello wrote:
> > > > > On 3/9/23 16:30, Bjorn Helgaas wrote:
> > > > > > On Thu, Mar 09, 2023 at 12:32:41PM -0600, Limonciello, Mario wrote:
> > > > > > > On 3/9/2023 12:25, Bjorn Helgaas wrote:
> > > > > > > ...

> > it's important that the commit log is accurate and makes sense even to
> > people who don't know the internals of the device.
> > 
> > It *sounds* like what's happening is:
> > 
> >   - OS writes PMCSR to put device in D3hot
> >   - BIOS traps D0->D3hot transition via something like SMI and
> >     captures MSI-X state
> >   - Device enters D3hot
> >   - Device internal MSI-X state is lost
> >   - BIOS traps D3hot->D0 transition via SMI
> >   - Device enters D0
> >   - BIOS restores MSI-X state
> >   - OS resumes use of device
> > 
> > If that's what's happening, the fact that the device loses the
> > internal state in D3hot sounds like a *hardware* defect -- if you put
> > the device in a system without a BIOS, the D0->D3hot->D0 transitions
> > would not work as required by the PCIe spec.
> 
> Actually it's a controller integrated into the APU.
> 
> So any system you put this APU into has a BIOS.  Because it's a socketed
> APU people can very easily move it from one motherboard to another and one
> vendor may have the BIOS properly configuring but another might not.
>
> > We can call the fact that BIOS lacks the MSI-X save/restore a BIOS
> > defect, but the only reason BIOS would *need* that save/restore is
> > because of the underlying *hardware* defect.
> > 
> > If that's the case, I would expect a commit log something like this:
> > 
> >   The AMD [1022:15b8] USB controller loses some internal functional
> >   MSI-X context when transitioning from D0 to D3hot.  BIOS normally
> >   traps D0->D3hot and D3hot->D0 transitions so it can save and restore
> >   that internal context, but some firmware in the field lacks this
> >   workaround.
> 
> I wouldn't call it a workaround.  The hardware is doing exactly as it's
> intended for how the firmware programmed.

The whole point of the PCI spec is to build devices where standard
features like power management can be operated without device-specific
knowledge.  If we need device-specific code in BIOS or Linux, I'd say
that's a workaround.

Does this device set No_Soft_Reset?  If it does, when it receives a
config write to PMCSR that puts it in D3hot, followed by a config
write that puts it back in D0, it's supposed to return to D0 with no
additional software intervention required.  I think that also means no
BIOS intervention is required.

If it does not set No_Soft_Reset, pci_pm_reset() assumes that a
D0->D3hot->D0 transition resets the device.  We save and restore the
MSI-X Capability in that case, but we do NOT run the
DECLARE_PCI_FIXUP_RESUME_EARLY quirks.  I think that means MSI-X would
not work after a PM reset of this device.

Bjorn

  reply	other threads:[~2023-03-20 19:42 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-06  7:23 [PATCH] PCI: Add quirk to clear MSI-X Basavaraj Natikar
2023-03-06  8:14 ` Thomas Glanzmann
2023-03-08 22:44 ` Bjorn Helgaas
2023-03-08 23:04   ` Limonciello, Mario
2023-03-09  7:34     ` Basavaraj Natikar
2023-03-09 18:25       ` Bjorn Helgaas
2023-03-09 18:32         ` Limonciello, Mario
2023-03-09 22:30           ` Bjorn Helgaas
2023-03-10  0:57             ` Mario Limonciello
2023-03-10  7:41               ` Basavaraj Natikar
2023-03-10 22:13               ` Bjorn Helgaas
2023-03-20  1:32                 ` Limonciello, Mario
2023-03-20 17:14                   ` Bjorn Helgaas
2023-03-20 17:20                     ` Limonciello, Mario
2023-03-20 19:36                       ` Bjorn Helgaas [this message]
2023-03-20 19:47                         ` Limonciello, Mario
2023-03-20 21:30                           ` Bjorn Helgaas
2023-03-20 21:37                             ` Limonciello, Mario
2023-03-20 22:08                               ` Bjorn Helgaas
2023-03-20 22:52                                 ` Mario Limonciello
2023-03-21 11:07                                   ` Bjorn Helgaas
2023-03-28 13:15                                     ` Basavaraj Natikar
2023-03-28 13:25                                       ` Limonciello, Mario
2023-03-28 17:42                                       ` Bjorn Helgaas
2023-03-10  7:22         ` Basavaraj Natikar

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=20230320193630.GA2301992@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=Basavaraj.Natikar@amd.com \
    --cc=Mario.Limonciello@amd.com \
    --cc=bhelgaas@google.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=thomas@glanzmann.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.