diff mbox series

[F/Unstable/OEM-5.6,2/2] PCI: Avoid Pericom USB controller OHCI/EHCI PME# defect

Message ID 20200518131652.11545-3-kai.heng.feng@canonical.com
State New
Headers show
Series [F/Unstable/OEM-OSP1-B/OEM-5.6,1/2] serial: 8250_pci: Move Pericom IDs to pci_ids.h | expand

Commit Message

Kai-Heng Feng May 18, 2020, 1:16 p.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1879321

Both Pericom OHCI and EHCI devices advertise PME# support from all power
states:

  06:00.0 USB controller [0c03]: Pericom Semiconductor PI7C9X442SL USB OHCI Controller [12d8:400e] (rev 01) (prog-if 10 [OHCI])
    Subsystem: Pericom Semiconductor PI7C9X442SL USB OHCI Controller [12d8:400e]
    Capabilities: [80] Power Management version 3
      Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA PME(D0+,D1+,D2+,D3hot+,D3cold+)

  06:00.2 USB controller [0c03]: Pericom Semiconductor PI7C9X442SL USB EHCI Controller [12d8:400f] (rev 01) (prog-if 20 [EHCI])
    Subsystem: Pericom Semiconductor PI7C9X442SL USB EHCI Controller [12d8:400f]
    Capabilities: [80] Power Management version 3
      Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA PME(D0+,D1+,D2+,D3hot+,D3cold+)

But testing shows that it's unreliable: there is a 20% chance PME# won't be
asserted when a USB device is plugged.

Remove PME support for both devices to make USB plugging work reliably.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=205981
Link: https://lore.kernel.org/r/20200508065343.32751-2-kai.heng.feng@canonical.com
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: stable@vger.kernel.org
(backported from commit 68f5fc4ea9ddf9f77720d568144219c4e6452cde linux-next)
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/pci/quirks.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Comments

Stefan Bader May 20, 2020, 7:27 a.m. UTC | #1
On 18.05.20 15:16, Kai-Heng Feng wrote:
> BugLink: https://bugs.launchpad.net/bugs/1879321
> 
> Both Pericom OHCI and EHCI devices advertise PME# support from all power
> states:
> 
>   06:00.0 USB controller [0c03]: Pericom Semiconductor PI7C9X442SL USB OHCI Controller [12d8:400e] (rev 01) (prog-if 10 [OHCI])
>     Subsystem: Pericom Semiconductor PI7C9X442SL USB OHCI Controller [12d8:400e]
>     Capabilities: [80] Power Management version 3
>       Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
> 
>   06:00.2 USB controller [0c03]: Pericom Semiconductor PI7C9X442SL USB EHCI Controller [12d8:400f] (rev 01) (prog-if 20 [EHCI])
>     Subsystem: Pericom Semiconductor PI7C9X442SL USB EHCI Controller [12d8:400f]
>     Capabilities: [80] Power Management version 3
>       Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
> 
> But testing shows that it's unreliable: there is a 20% chance PME# won't be
> asserted when a USB device is plugged.
> 
> Remove PME support for both devices to make USB plugging work reliably.
> 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=205981
> Link: https://lore.kernel.org/r/20200508065343.32751-2-kai.heng.feng@canonical.com
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> Cc: stable@vger.kernel.org
> (backported from commit 68f5fc4ea9ddf9f77720d568144219c4e6452cde linux-next)
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> ---

The original patch just adds a new fixup function and declarations. Your
backport removes apex_pci_fixup_class() without a real explanation why.

-Stefan

>  drivers/pci/quirks.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index 8ee5e15445cc..423a6e76314c 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -5606,9 +5606,15 @@ static void pci_fixup_no_d0_pme(struct pci_dev *dev)
>  }
>  DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ASMEDIA, 0x2142, pci_fixup_no_d0_pme);
>  
> -static void apex_pci_fixup_class(struct pci_dev *pdev)
> +/*
> + * Device [12d8:0x400e] and [12d8:0x400f]
> + * These devices advertise PME# support in all power states but don't
> + * reliably assert it.
> + */
> +static void pci_fixup_no_pme(struct pci_dev *dev)
>  {
> -	pdev->class = (PCI_CLASS_SYSTEM_OTHER << 8) | pdev->class;
> +	pci_info(dev, "PME# is unreliable, disabling it\n");
> +	dev->pme_support = 0;
>  }
> -DECLARE_PCI_FIXUP_CLASS_HEADER(0x1ac1, 0x089a,
> -			       PCI_CLASS_NOT_DEFINED, 8, apex_pci_fixup_class);
> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_PERICOM, 0x400e, pci_fixup_no_pme);
> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_PERICOM, 0x400f, pci_fixup_no_pme);
>
Kai-Heng Feng May 20, 2020, 7:39 a.m. UTC | #2
> On May 20, 2020, at 15:27, Stefan Bader <stefan.bader@canonical.com> wrote:
> 
> On 18.05.20 15:16, Kai-Heng Feng wrote:
>> BugLink: https://bugs.launchpad.net/bugs/1879321
>> 
>> Both Pericom OHCI and EHCI devices advertise PME# support from all power
>> states:
>> 
>>  06:00.0 USB controller [0c03]: Pericom Semiconductor PI7C9X442SL USB OHCI Controller [12d8:400e] (rev 01) (prog-if 10 [OHCI])
>>    Subsystem: Pericom Semiconductor PI7C9X442SL USB OHCI Controller [12d8:400e]
>>    Capabilities: [80] Power Management version 3
>>      Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
>> 
>>  06:00.2 USB controller [0c03]: Pericom Semiconductor PI7C9X442SL USB EHCI Controller [12d8:400f] (rev 01) (prog-if 20 [EHCI])
>>    Subsystem: Pericom Semiconductor PI7C9X442SL USB EHCI Controller [12d8:400f]
>>    Capabilities: [80] Power Management version 3
>>      Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
>> 
>> But testing shows that it's unreliable: there is a 20% chance PME# won't be
>> asserted when a USB device is plugged.
>> 
>> Remove PME support for both devices to make USB plugging work reliably.
>> 
>> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=205981
>> Link: https://lore.kernel.org/r/20200508065343.32751-2-kai.heng.feng@canonical.com
>> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
>> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
>> Cc: stable@vger.kernel.org
>> (backported from commit 68f5fc4ea9ddf9f77720d568144219c4e6452cde linux-next)
>> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
>> ---
> 
> The original patch just adds a new fixup function and declarations. Your
> backport removes apex_pci_fixup_class() without a real explanation why.

Thanks for catching this up, I'll send v2.

Kai-Heng

> 
> -Stefan
> 
>> drivers/pci/quirks.c | 14 ++++++++++----
>> 1 file changed, 10 insertions(+), 4 deletions(-)
>> 
>> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
>> index 8ee5e15445cc..423a6e76314c 100644
>> --- a/drivers/pci/quirks.c
>> +++ b/drivers/pci/quirks.c
>> @@ -5606,9 +5606,15 @@ static void pci_fixup_no_d0_pme(struct pci_dev *dev)
>> }
>> DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ASMEDIA, 0x2142, pci_fixup_no_d0_pme);
>> 
>> -static void apex_pci_fixup_class(struct pci_dev *pdev)
>> +/*
>> + * Device [12d8:0x400e] and [12d8:0x400f]
>> + * These devices advertise PME# support in all power states but don't
>> + * reliably assert it.
>> + */
>> +static void pci_fixup_no_pme(struct pci_dev *dev)
>> {
>> -	pdev->class = (PCI_CLASS_SYSTEM_OTHER << 8) | pdev->class;
>> +	pci_info(dev, "PME# is unreliable, disabling it\n");
>> +	dev->pme_support = 0;
>> }
>> -DECLARE_PCI_FIXUP_CLASS_HEADER(0x1ac1, 0x089a,
>> -			       PCI_CLASS_NOT_DEFINED, 8, apex_pci_fixup_class);
>> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_PERICOM, 0x400e, pci_fixup_no_pme);
>> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_PERICOM, 0x400f, pci_fixup_no_pme);
>> 
> 
>
diff mbox series

Patch

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 8ee5e15445cc..423a6e76314c 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -5606,9 +5606,15 @@  static void pci_fixup_no_d0_pme(struct pci_dev *dev)
 }
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ASMEDIA, 0x2142, pci_fixup_no_d0_pme);
 
-static void apex_pci_fixup_class(struct pci_dev *pdev)
+/*
+ * Device [12d8:0x400e] and [12d8:0x400f]
+ * These devices advertise PME# support in all power states but don't
+ * reliably assert it.
+ */
+static void pci_fixup_no_pme(struct pci_dev *dev)
 {
-	pdev->class = (PCI_CLASS_SYSTEM_OTHER << 8) | pdev->class;
+	pci_info(dev, "PME# is unreliable, disabling it\n");
+	dev->pme_support = 0;
 }
-DECLARE_PCI_FIXUP_CLASS_HEADER(0x1ac1, 0x089a,
-			       PCI_CLASS_NOT_DEFINED, 8, apex_pci_fixup_class);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_PERICOM, 0x400e, pci_fixup_no_pme);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_PERICOM, 0x400f, pci_fixup_no_pme);