From 3deaf580d1fd31cf0a7ae35459a11a5f0062457a Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Apr 20 2023 11:00:59 +0000 Subject: x86/PCI: Add quirk for AMD XHCI controller that loses MSI-X state in D3hot (bsc#1012628). --- diff --git a/patches.kernel.org/6.2.12-114-x86-PCI-Add-quirk-for-AMD-XHCI-controller-that.patch b/patches.kernel.org/6.2.12-114-x86-PCI-Add-quirk-for-AMD-XHCI-controller-that.patch new file mode 100644 index 0000000..552e854 --- /dev/null +++ b/patches.kernel.org/6.2.12-114-x86-PCI-Add-quirk-for-AMD-XHCI-controller-that.patch @@ -0,0 +1,72 @@ +From: Basavaraj Natikar +Date: Wed, 29 Mar 2023 22:58:59 +0530 +Subject: [PATCH] x86/PCI: Add quirk for AMD XHCI controller that loses MSI-X + state in D3hot +References: bsc#1012628 +Patch-mainline: 6.2.12 +Git-commit: f195fc1e9715ba826c3b62d58038f760f66a4fe9 + +commit f195fc1e9715ba826c3b62d58038f760f66a4fe9 upstream. + +The AMD [1022:15b8] USB controller loses some internal functional MSI-X +context when transitioning from D0 to D3hot. BIOS normally traps D0->D3hot +and D3hot->D0 transitions so it can save and restore that internal context, +but some firmware in the field can't do this because it fails to clear the +AMD_15B8_RCC_DEV2_EPF0_STRAP2 NO_SOFT_RESET bit. + +Clear AMD_15B8_RCC_DEV2_EPF0_STRAP2 NO_SOFT_RESET bit before USB controller +initialization during boot. + +Link: https://lore.kernel.org/linux-usb/Y%2Fz9GdHjPyF2rNG3@glanzmann.de/T/#u +Link: https://lore.kernel.org/r/20230329172859.699743-1-Basavaraj.Natikar@amd.com +Reported-by: Thomas Glanzmann +Tested-by: Thomas Glanzmann +Signed-off-by: Basavaraj Natikar +Signed-off-by: Bjorn Helgaas +Reviewed-by: Mario Limonciello +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Jiri Slaby +--- + arch/x86/pci/fixup.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c +index 615a76d7..bf5161dc 100644 +--- a/arch/x86/pci/fixup.c ++++ b/arch/x86/pci/fixup.c +@@ -7,6 +7,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -824,3 +825,23 @@ static void rs690_fix_64bit_dma(struct pci_dev *pdev) + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7910, rs690_fix_64bit_dma); + + #endif ++ ++#ifdef CONFIG_AMD_NB ++ ++#define AMD_15B8_RCC_DEV2_EPF0_STRAP2 0x10136008 ++#define AMD_15B8_RCC_DEV2_EPF0_STRAP2_NO_SOFT_RESET_DEV2_F0_MASK 0x00000080L ++ ++static void quirk_clear_strap_no_soft_reset_dev2_f0(struct pci_dev *dev) ++{ ++ u32 data; ++ ++ if (!amd_smn_read(0, AMD_15B8_RCC_DEV2_EPF0_STRAP2, &data)) { ++ data &= ~AMD_15B8_RCC_DEV2_EPF0_STRAP2_NO_SOFT_RESET_DEV2_F0_MASK; ++ if (amd_smn_write(0, AMD_15B8_RCC_DEV2_EPF0_STRAP2, data)) ++ pci_err(dev, "Failed to write data 0x%x\n", data); ++ } else { ++ pci_err(dev, "Failed to read data\n"); ++ } ++} ++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x15b8, quirk_clear_strap_no_soft_reset_dev2_f0); ++#endif +-- +2.35.3 + diff --git a/series.conf b/series.conf index 45bd64d..736fd69 100644 --- a/series.conf +++ b/series.conf @@ -2341,6 +2341,7 @@ patches.kernel.org/6.2.12-111-drm-amd-pm-correct-the-pcie-link-state-check-f.patch patches.kernel.org/6.2.12-112-PCI-Fix-use-after-free-in-pci_bus_release_doma.patch patches.kernel.org/6.2.12-113-PCI-MSI-Provide-missing-stub-for-pci_msix_can_.patch + patches.kernel.org/6.2.12-114-x86-PCI-Add-quirk-for-AMD-XHCI-controller-that.patch ######################################################## # Build fixes that apply to the vanilla kernel too.