From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Mario Limonciello <mario.limonciello@amd.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
Shyam Sundar S K <Shyam-sundar.S-k@amd.com>,
bhelgaas@google.com, linux-kernel@vger.kernel.org,
linux-acpi@vger.kernel.org, platform-driver-x86@vger.kernel.org,
Iain Lane <iain@orangesquash.org.uk>,
rafael@kernel.org
Subject: Re: [PATCH v16 3/3] platform/x86/amd: pmc: Don't let PCIe root ports go into D3
Date: Tue, 5 Sep 2023 22:21:26 +0200 [thread overview]
Message-ID: <CAJZ5v0iqn=Pj1k4=u5Mb9PyYeB471Efob5rUiEBchbUrJeL=rg@mail.gmail.com> (raw)
In-Reply-To: <f1c65b21-88cb-4ba3-8380-0d2d3fb42c8d@amd.com>
On Tue, Sep 5, 2023 at 9:57 PM Mario Limonciello
<mario.limonciello@amd.com> wrote:
>
> On 9/5/2023 05:15, Hans de Goede wrote:
> > Hi Shyam,
> >
> > On 9/5/23 12:08, Shyam Sundar S K wrote:
> >>
> >>
> >> On 8/29/2023 10:42 PM, Mario Limonciello wrote:
> >>> commit 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend")
> >>> changed pci_bridge_d3_possible() so that any vendor's PCIe ports
> >>> from modern machines (>=2015) are allowed to be put into D3.
> >>>
> >>> Iain reports that USB devices can't be used to wake a Lenovo Z13
> >>> from suspend. This is because the PCIe root port has been put
> >>> into D3 and AMD's platform can't handle USB devices waking from
> >>> a hardware sleep state in this case.
> >>>
> >>> This problem only occurs on Linux, and only when the AMD PMC driver
> >>> is utilized to put the device into a hardware sleep state. Comparing
> >>> the behavior on Windows and Linux, Windows doesn't put the root ports
> >>> into D3.
> >>>
> >>> A variety of approaches were discussed to change PCI core to handle this
> >>> case generically but no consensus was reached. To limit the scope of
> >>> effect only to the affected machines introduce a workaround into the
> >>> amd-pmc driver to only apply to the PCI root ports in affected machines
> >>> when going into hardware sleep.
> >>>
> >>> Link: https://lore.kernel.org/linux-pci/20230818193932.27187-1-mario.limonciello@amd.com/
> >>> Fixes: 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend")
> >>> Reported-by: Iain Lane <iain@orangesquash.org.uk>
> >>> Closes: https://forums.lenovo.com/t5/Ubuntu/Z13-can-t-resume-from-suspend-with-external-USB-keyboard/m-p/5217121
> >>> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> >>
> >> See if this change can be moved to pmc-quirks.c, besides that change
> >> looks good to me. Thank you.
> >>
> >> Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
> >
> > Thank you for the review.
> >
> > I also just replied to this series (to the cover-letter)
> > with an alternative approach based on making the
> > XHCI driver call pci_d3cold_disable() on the XHCI
> > PCIe-device on affected AMD chipsets.
> >
> > That seems like a cleaner approach to me. I wonder
> > if you have any remarks about that approach ?
> >
>
> I was thinking more about Hans' comments to the cover letter as well as
> Shyam's comments to move it into pmc-quirks.c.
>
> Perhaps it would better be conveying what's going on by having a
> dedicated step that amd-pmc calls pci_choose_state() for each PCIe
> device and checks the value against the constraints. If "any" of them
> are mismatched it could emit a message. This is a little bit of
> duplication though because drivers/acpi/x86/s2idle.c already also emits
> a similar message for some devices when pm_debug_messages is enabled.
>
> Then the special case would be for PCIe root ports that are mismatched
> the driver overrides it. If this logic change is wouldn't make sense
> for it to be moved into pmc-quirks.c.
>
> I don't think using pci_d3cold_disable() / pci_d3cold_enable() is
> correct though. If PCI core stays the same it should still be setting
> pdev->bridge_d3 to zero. The problem isn't with D3cold on the PCIe RP
> at s2didle, it's with D3hot.
Well, it's not even that.
If there were no devices expected to wake up the system from sleep
under the given Root Port, it might very well go into D3hot IIUC, so
the wakeup capability seems to be the key property here.
I need to think a bit more about this.
next prev parent reply other threads:[~2023-09-05 20:21 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-29 17:12 [PATCH v16 0/3] Avoid PCIe D3 for AMD PCIe root ports Mario Limonciello
2023-08-29 17:12 ` [PATCH v16 1/3] ACPI: x86: s2idle: Export symbol for fetching constraints for module use Mario Limonciello
2023-08-31 18:58 ` Rafael J. Wysocki
2023-08-29 17:12 ` [PATCH v16 2/3] platform/x86/amd: pmc: Adjust workarounds to be part of a switch/case Mario Limonciello
2023-08-29 17:12 ` [PATCH v16 3/3] platform/x86/amd: pmc: Don't let PCIe root ports go into D3 Mario Limonciello
2023-09-05 10:08 ` Shyam Sundar S K
2023-09-05 10:15 ` Hans de Goede
2023-09-05 19:57 ` Mario Limonciello
2023-09-05 20:21 ` Rafael J. Wysocki [this message]
2023-09-05 20:51 ` Bjorn Helgaas
2023-09-05 22:16 ` Mario Limonciello
2023-09-05 10:13 ` [PATCH v16 0/3] Avoid PCIe D3 for AMD PCIe root ports Hans de Goede
2023-09-05 12:45 ` Mario Limonciello
2023-09-06 12:24 ` Hans de Goede
2023-09-06 13:38 ` Mario Limonciello
2023-09-06 18:56 ` Rafael J. Wysocki
2023-09-06 19:10 ` Mario Limonciello
2023-09-06 19:57 ` Rafael J. Wysocki
2023-09-06 19:17 ` Bjorn Helgaas
2023-09-06 19:56 ` Rafael J. Wysocki
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='CAJZ5v0iqn=Pj1k4=u5Mb9PyYeB471Efob5rUiEBchbUrJeL=rg@mail.gmail.com' \
--to=rafael@kernel.org \
--cc=Shyam-sundar.S-k@amd.com \
--cc=bhelgaas@google.com \
--cc=hdegoede@redhat.com \
--cc=iain@orangesquash.org.uk \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=platform-driver-x86@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).