All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/PCI: Remove D0 PME capability on AMD FCH xHCI
@ 2019-09-02 14:52 Kai-Heng Feng
  2019-10-02  0:07 ` Bjorn Helgaas
  0 siblings, 1 reply; 4+ messages in thread
From: Kai-Heng Feng @ 2019-09-02 14:52 UTC (permalink / raw)
  To: bhelgaas; +Cc: linux-pci, linux-kernel, Kai-Heng Feng

There's an xHCI device that doesn't wake when a USB 2.0 device gets
plugged to its USB 3.0 port. The driver's own runtime suspend callback
was called, PME# signaling was enabled, but it stays at PCI D0:

00:10.0 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] FCH USB XHCI Controller [1022:7914] (rev 20) (prog-if 30 [XHCI])
        Subsystem: Dell FCH USB XHCI Controller [1028:087e]
        Control: I/O- Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Interrupt: pin A routed to IRQ 18
        Region 0: Memory at f0b68000 (64-bit, non-prefetchable) [size=8K]
        Capabilities: [50] Power Management version 3
                Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
                Status: D0 NoSoftRst+ PME-Enable+ DSel=0 DScale=0 PME-

A PCI device can be runtime suspended while still stays at D0 when it
supports D0 PME# and its ACPI _S0W method reports D0. Though plugging
USB 3.0 devices can wakeup the xHCI, it doesn't respond to USB 2.0
devices.

So let's disable D0 PME capability on this device to avoid the issue.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203673
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 arch/x86/pci/fixup.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index 527e69b12002..0851a05d092f 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -588,6 +588,17 @@ static void pci_fixup_amd_ehci_pme(struct pci_dev *dev)
 }
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x7808, pci_fixup_amd_ehci_pme);
 
+/*
+ * Device [1022:7914]
+ * D0 PME# doesn't get asserted when plugging USB 2.0 device.
+ */
+static void pci_fixup_amd_fch_xhci_pme(struct pci_dev *dev)
+{
+	dev_info(&dev->dev, "PME# does not work under D0, disabling it\n");
+	dev->pme_support &= ~(PCI_PM_CAP_PME_D0 >> PCI_PM_CAP_PME_SHIFT);
+}
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x7914, pci_fixup_amd_fch_xhci_pme);
+
 /*
  * Apple MacBook Pro: Avoid [mem 0x7fa00000-0x7fbfffff]
  *
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-02 16:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-02 14:52 [PATCH] x86/PCI: Remove D0 PME capability on AMD FCH xHCI Kai-Heng Feng
2019-10-02  0:07 ` Bjorn Helgaas
2019-10-02  5:32   ` Kai-Heng Feng
2019-10-02 16:55     ` Bjorn Helgaas

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.