xhci-pci: Set runtime PM as default policy on all xHC 1.2 or later devices
authorMario Limonciello <mario.limonciello@amd.com>
Mon, 24 Oct 2022 14:27:19 +0000 (17:27 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Nov 2022 14:59:11 +0000 (23:59 +0900)
commit a611bf473d1f77b70f7188b5577542cb39b4701b upstream.

For optimal power consumption of USB4 routers the XHCI PCIe endpoint
used for tunneling must be in D3.  Historically this is accomplished
by a long list of PCIe IDs that correspond to these endpoints because
the xhci_hcd driver will not default to allowing runtime PM for all
devices.

As both AMD and Intel have released new products with new XHCI controllers
this list continues to grow. In reviewing the XHCI specification v1.2 on
page 607 there is already a requirement that the PCI power management
states D3hot and D3cold must be supported.

In the quirk list, use this to indicate that runtime PM should be allowed
on XHCI controllers. The following controllers are known to be xHC 1.2 and
dropped explicitly:
* AMD Yellow Carp
* Intel Alder Lake
* Intel Meteor Lake
* Intel Raptor Lake

[keep PCI ID for Alder Lake PCH for recently added quirk -Mathias]

Cc: stable@vger.kernel.org
Suggested-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://www.intel.com/content/dam/www/public/us/en/documents/technical-specifications/extensible-host-controler-interface-usb-xhci.pdf
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20221024142720.4122053-4-mathias.nyman@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-pci.c

index 62312e8..fdf0831 100644 (file)
 #define PCI_DEVICE_ID_INTEL_CML_XHCI                   0xa3af
 #define PCI_DEVICE_ID_INTEL_TIGER_LAKE_XHCI            0x9a13
 #define PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI           0x1138
-#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI            0x461e
-#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_XHCI          0x464e
-#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI        0x51ed
-#define PCI_DEVICE_ID_INTEL_RAPTOR_LAKE_XHCI           0xa71e
-#define PCI_DEVICE_ID_INTEL_METEOR_LAKE_XHCI           0x7ec0
+#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI                0x51ed
 
 #define PCI_DEVICE_ID_AMD_RENOIR_XHCI                  0x1639
 #define PCI_DEVICE_ID_AMD_PROMONTORYA_4                        0x43b9
 #define PCI_DEVICE_ID_AMD_PROMONTORYA_3                        0x43ba
 #define PCI_DEVICE_ID_AMD_PROMONTORYA_2                        0x43bb
 #define PCI_DEVICE_ID_AMD_PROMONTORYA_1                        0x43bc
-#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_1           0x161a
-#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_2           0x161b
-#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_3           0x161d
-#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_4           0x161e
-#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_5           0x15d6
-#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_6           0x15d7
-#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_7           0x161c
-#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_8           0x161f
 
 #define PCI_DEVICE_ID_ASMEDIA_1042_XHCI                        0x1042
 #define PCI_DEVICE_ID_ASMEDIA_1042A_XHCI               0x1142
@@ -273,12 +261,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
             pdev->device == PCI_DEVICE_ID_INTEL_TITAN_RIDGE_DD_XHCI ||
             pdev->device == PCI_DEVICE_ID_INTEL_ICE_LAKE_XHCI ||
             pdev->device == PCI_DEVICE_ID_INTEL_TIGER_LAKE_XHCI ||
-            pdev->device == PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI ||
-            pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI ||
-            pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_XHCI ||
-            pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI ||
-            pdev->device == PCI_DEVICE_ID_INTEL_RAPTOR_LAKE_XHCI ||
-            pdev->device == PCI_DEVICE_ID_INTEL_METEOR_LAKE_XHCI))
+            pdev->device == PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI))
                xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW;
 
        if (pdev->vendor == PCI_VENDOR_ID_ETRON &&
@@ -347,15 +330,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
             pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_4))
                xhci->quirks |= XHCI_NO_SOFT_RETRY;
 
-       if (pdev->vendor == PCI_VENDOR_ID_AMD &&
-           (pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_1 ||
-           pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_2 ||
-           pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_3 ||
-           pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_4 ||
-           pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_5 ||
-           pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_6 ||
-           pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_7 ||
-           pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_8))
+       /* xHC spec requires PCI devices to support D3hot and D3cold */
+       if (xhci->hci_version >= 0x120)
                xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW;
 
        if (xhci->quirks & XHCI_RESET_ON_RESUME)