From: Mario Limonciello <mario.limonciello@amd.com>
To: <hdegoede@redhat.com>, <Shyam-sundar.S-k@amd.com>
Cc: <bhelgaas@google.com>, <platform-driver-x86@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <iain@orangesquash.org.uk>,
Mario Limonciello <mario.limonciello@amd.com>
Subject: [PATCH v15 2/2] platform/x86/amd: pmc: Don't let PCIe root ports go into D3
Date: Sun, 27 Aug 2023 23:28:19 -0500 [thread overview]
Message-ID: <20230828042819.47013-2-mario.limonciello@amd.com> (raw)
In-Reply-To: <20230828042819.47013-1-mario.limonciello@amd.com>
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>
---
drivers/platform/x86/amd/pmc/pmc.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/pmc/pmc.c
index eb2a4263814c..f7bfe704ce39 100644
--- a/drivers/platform/x86/amd/pmc/pmc.c
+++ b/drivers/platform/x86/amd/pmc/pmc.c
@@ -741,6 +741,21 @@ static int amd_pmc_czn_wa_irq1(struct amd_pmc_dev *pdev)
return 0;
}
+static int amd_pmc_rp_wa(struct amd_pmc_dev *pdev)
+{
+ struct pci_dev *pci_dev = NULL;
+
+ while ((pci_dev = pci_get_device(PCI_VENDOR_ID_AMD, PCI_ANY_ID, pci_dev))) {
+ if (!pci_is_pcie(pci_dev) ||
+ !(pci_pcie_type(pci_dev) == PCI_EXP_TYPE_ROOT_PORT))
+ continue;
+ pci_dev->bridge_d3 = 0;
+ dev_info_once(pdev->dev, "Disabling D3 for PCIe root ports\n");
+ }
+
+ return 0;
+}
+
static int amd_pmc_verify_czn_rtc(struct amd_pmc_dev *pdev, u32 *arg)
{
struct rtc_device *rtc_device;
@@ -893,6 +908,10 @@ static int amd_pmc_suspend_handler(struct device *dev)
case AMD_CPU_ID_CZN:
rc = amd_pmc_czn_wa_irq1(pdev);
break;
+ case AMD_CPU_ID_YC:
+ case AMD_CPU_ID_PS:
+ rc = amd_pmc_rp_wa(pdev);
+ break;
default:
break;
}
--
2.34.1
next prev parent reply other threads:[~2023-08-28 4:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-28 4:28 [PATCH v15 1/2] platform/x86/amd: pmc: Adjust workarounds to be part of a switch/case Mario Limonciello
2023-08-28 4:28 ` Mario Limonciello [this message]
2023-08-28 9:19 ` [PATCH v15 2/2] platform/x86/amd: pmc: Don't let PCIe root ports go into D3 Hans de Goede
2023-08-28 15:15 ` Mario Limonciello
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=20230828042819.47013-2-mario.limonciello@amd.com \
--to=mario.limonciello@amd.com \
--cc=Shyam-sundar.S-k@amd.com \
--cc=bhelgaas@google.com \
--cc=hdegoede@redhat.com \
--cc=iain@orangesquash.org.uk \
--cc=linux-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®