From: Mario Limonciello <mario.limonciello@amd.com>
To: Bjorn Helgaas <helgaas@kernel.org>, Gary Li <Gary.Li@amd.com>
Cc: "Mario Limonciello" <superm1@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Mathias Nyman" <mathias.nyman@intel.com>,
"Mika Westerberg" <mika.westerberg@linux.intel.com>,
"open list : PCI SUBSYSTEM" <linux-pci@vger.kernel.org>,
"open list" <linux-kernel@vger.kernel.org>,
"open list : USB XHCI DRIVER" <linux-usb@vger.kernel.org>,
"Daniel Drake" <drake@endlessos.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Subject: Re: [PATCH v5 2/5] PCI: Check PCI_PM_CTRL instead of PCI_COMMAND in pci_dev_wait()
Date: Tue, 3 Sep 2024 12:31:00 -0500 [thread overview]
Message-ID: <bdc99602-7bb2-4026-8122-e92f894aca09@amd.com> (raw)
In-Reply-To: <20240903171157.GA254033@bhelgaas>
On 9/3/2024 12:11, Bjorn Helgaas wrote:
<snip>
>>
>> I guess I reading between the lines you have an assumption that you
>> can't read the vendor ID from D3; which doesn't appear to be the
>> case from our testing.
>
> A Vendor ID read of a device in D3hot should definitely work.
> Obviously if the device were in D3cold, we'd get no response at all,
> so the requester should log a UR error and fabricate ~0 data.
>
> But if the device starts out in D3cold and we power it up, it should
> not go through D3hot. The only legal transition from D3cold is to
> D0uninitialized (PCIe r6.0, sec 5.8).
Right. The issue is it didn't finish getting into D3 at the time that
we attempted to go to D0 though. So all this extra time is basically
waiting for the D0->D3 transition to finish followed by D3->D0uninitialized.
The best description I could offer is to call it an "aborted" D3.
>
> OK, so with [1] and patch 3/5:
>
> 1) Initially the device is in D0
>
> 2) We put it in D3cold (using some ACPI method) because the
> autosuspend delay expired (?)
>
> 3) Plugging in the dock wakes up the device, so we power up the
> device (via pci_power_up(), which again uses some ACPI method), and
> it should transition to D0uninitialized
>
> 4) With patch 3/5, pci_power_up() calls pci_dev_wait() because
> dev->current_state == PCI_D3cold
>
> 5) I *assume* RRS SV is enabled (lspci -vv of Root Port would
> confirm this; maybe we should add a pci_dbg message about which
> register we're polling). If so, patch [1] means we should poll
> Vendor ID until successful completion.
>
Yup.
RootCap: CRSVisible+
RootCtl: ErrCorrectable- ErrNon-Fatal- ErrFatal-
PMEIntEna+ CRSVisible+
> 6) pci_dbg log should confirm the device is ready with a "ready %dms
> after D3cold->D0" message, which would mean we got a successful
> completion when reading Vendor ID
>
> 7) For debugging purposes, it would be interesting to read and log
> the PCI_PM_CTRL value here. Per sec 2.3.1, the device is not
> allowed to return RRS at this point since we already got a
> successful completion.
>
OK let me get a debug log with [1], 3/5, 6.11-rc6 and a message added
about this value to share back.
> 8) The USB4 stack sees the device and assumes it is in D0, but it
> seems to still be in D3cold. What is this based on? Is there a
> config read that returns ~0 data when it shouldn't?
>
Yes there is. From earlier in the thread I have a [log] I shared.
The message emitted is from ring_interrupt_active():
"thunderbolt 0000:e5:00.5: interrupt for TX ring 0 is already enabled"
[log] https://gist.github.com/superm1/cb407766ab15f42f12a6fe9d1196f6fc
next prev parent reply other threads:[~2024-09-03 17:31 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-23 15:40 [PATCH v5 0/5] Verify devices transition from D3cold to D0 Mario Limonciello
2024-08-23 15:40 ` [PATCH v5 1/5] PCI: Use an enum for reset type in pci_dev_wait() Mario Limonciello
2024-08-23 15:40 ` [PATCH v5 2/5] PCI: Check PCI_PM_CTRL instead of PCI_COMMAND " Mario Limonciello
2024-08-23 19:54 ` Bjorn Helgaas
2024-08-26 19:16 ` Mario Limonciello
2024-08-27 17:43 ` Mario Limonciello
2024-08-27 19:44 ` Bjorn Helgaas
2024-08-30 0:01 ` Bjorn Helgaas
2024-09-03 16:29 ` Mario Limonciello
2024-09-03 17:11 ` Bjorn Helgaas
2024-09-03 17:31 ` Mario Limonciello [this message]
2024-09-03 18:25 ` Bjorn Helgaas
2024-09-03 18:32 ` Mario Limonciello
2024-09-03 21:32 ` Bjorn Helgaas
2024-09-04 12:05 ` Mika Westerberg
2024-09-04 15:24 ` Mario Limonciello
2024-09-05 9:33 ` Mika Westerberg
2024-09-09 20:40 ` Mario Limonciello
2024-09-10 9:13 ` Mika Westerberg
2024-09-13 4:12 ` Mario Limonciello
2024-09-13 4:58 ` Mika Westerberg
2024-09-13 7:23 ` Mika Westerberg
2024-09-13 20:56 ` Mario Limonciello
2024-09-15 7:07 ` Mika Westerberg
2024-08-23 15:40 ` [PATCH v5 3/5] PCI: Verify functions currently in D3cold have entered D0 Mario Limonciello
2024-08-23 15:40 ` [PATCH v5 4/5] PCI: Allow Ryzen XHCI controllers into D3cold and drop delays Mario Limonciello
2024-08-23 15:40 ` [PATCH v5 5/5] PCI: Drop Radeon quirk for Macbook Pro 8.2 Mario Limonciello
2024-12-04 17:30 ` [PATCH v5 0/5] Verify devices transition from D3cold to D0 Mario Limonciello
2024-12-04 23:45 ` Bjorn Helgaas
2024-12-05 3:44 ` Mario Limonciello
2024-12-05 18:12 ` Bjorn Helgaas
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=bdc99602-7bb2-4026-8122-e92f894aca09@amd.com \
--to=mario.limonciello@amd.com \
--cc=Gary.Li@amd.com \
--cc=bhelgaas@google.com \
--cc=drake@endlessos.org \
--cc=gregkh@linuxfoundation.org \
--cc=helgaas@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=mika.westerberg@linux.intel.com \
--cc=superm1@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).