Skip to content

Commit f195fc1

Browse files
basuamdbjorn-helgaas
authored andcommitted
x86/PCI: Add quirk for AMD XHCI controller that loses MSI-X state in D3hot
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%[email protected]/T/#u Link: https://lore.kernel.org/r/[email protected] Reported-by: Thomas Glanzmann <[email protected]> Tested-by: Thomas Glanzmann <[email protected]> Signed-off-by: Basavaraj Natikar <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Mario Limonciello <[email protected]> Cc: [email protected]
1 parent 195d8e5 commit f195fc1

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

arch/x86/pci/fixup.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <linux/dmi.h>
88
#include <linux/pci.h>
99
#include <linux/vgaarb.h>
10+
#include <asm/amd_nb.h>
1011
#include <asm/hpet.h>
1112
#include <asm/pci_x86.h>
1213

@@ -824,3 +825,23 @@ static void rs690_fix_64bit_dma(struct pci_dev *pdev)
824825
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7910, rs690_fix_64bit_dma);
825826

826827
#endif
828+
829+
#ifdef CONFIG_AMD_NB
830+
831+
#define AMD_15B8_RCC_DEV2_EPF0_STRAP2 0x10136008
832+
#define AMD_15B8_RCC_DEV2_EPF0_STRAP2_NO_SOFT_RESET_DEV2_F0_MASK 0x00000080L
833+
834+
static void quirk_clear_strap_no_soft_reset_dev2_f0(struct pci_dev *dev)
835+
{
836+
u32 data;
837+
838+
if (!amd_smn_read(0, AMD_15B8_RCC_DEV2_EPF0_STRAP2, &data)) {
839+
data &= ~AMD_15B8_RCC_DEV2_EPF0_STRAP2_NO_SOFT_RESET_DEV2_F0_MASK;
840+
if (amd_smn_write(0, AMD_15B8_RCC_DEV2_EPF0_STRAP2, data))
841+
pci_err(dev, "Failed to write data 0x%x\n", data);
842+
} else {
843+
pci_err(dev, "Failed to read data\n");
844+
}
845+
}
846+
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x15b8, quirk_clear_strap_no_soft_reset_dev2_f0);
847+
#endif

0 commit comments

Comments
 (0)