Skip to content

Commit 7b8ae4f

Browse files
westerismb49
authored andcommitted
PCI/DPC: Quirk PIO log size for certain Intel Root Ports
BugLink: https://bugs.launchpad.net/bugs/2065435 [ Upstream commit 5459c0b ] Some Root Ports on Intel Tiger Lake and Alder Lake systems support the RP Extensions for DPC and the RP PIO Log registers but incorrectly advertise an RP PIO Log Size of zero. This means the kernel complains that: DPC: RP PIO log size 0 is invalid and if DPC is triggered, the DPC driver will not dump the RP PIO Log registers when it should. This is caused by a BIOS bug and should be fixed the BIOS for future CPUs. Add a quirk to set the correct RP PIO Log size for the affected Root Ports. Link: https://bugzilla.kernel.org/show_bug.cgi?id=209943 Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mika Westerberg <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Kuppuswamy Sathyanarayanan <[email protected]> Stable-dep-of: 627c6db ("PCI/DPC: Quirk PIO log size for Intel Raptor Lake Root Ports") Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Manuel Diewald <[email protected]> Signed-off-by: Roxana Nicolescu <[email protected]>
1 parent 3b86428 commit 7b8ae4f

File tree

2 files changed

+46
-5
lines changed

2 files changed

+46
-5
lines changed

drivers/pci/pcie/dpc.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -335,11 +335,16 @@ void pci_dpc_init(struct pci_dev *pdev)
335335
return;
336336

337337
pdev->dpc_rp_extensions = true;
338-
pdev->dpc_rp_log_size = (cap & PCI_EXP_DPC_RP_PIO_LOG_SIZE) >> 8;
339-
if (pdev->dpc_rp_log_size < 4 || pdev->dpc_rp_log_size > 9) {
340-
pci_err(pdev, "RP PIO log size %u is invalid\n",
341-
pdev->dpc_rp_log_size);
342-
pdev->dpc_rp_log_size = 0;
338+
339+
/* Quirks may set dpc_rp_log_size if device or firmware is buggy */
340+
if (!pdev->dpc_rp_log_size) {
341+
pdev->dpc_rp_log_size =
342+
(cap & PCI_EXP_DPC_RP_PIO_LOG_SIZE) >> 8;
343+
if (pdev->dpc_rp_log_size < 4 || pdev->dpc_rp_log_size > 9) {
344+
pci_err(pdev, "RP PIO log size %u is invalid\n",
345+
pdev->dpc_rp_log_size);
346+
pdev->dpc_rp_log_size = 0;
347+
}
343348
}
344349
}
345350

drivers/pci/quirks.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6065,3 +6065,39 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x56b1, aspm_l1_acceptable_latency
60656065
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x56c0, aspm_l1_acceptable_latency);
60666066
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x56c1, aspm_l1_acceptable_latency);
60676067
#endif
6068+
6069+
#ifdef CONFIG_PCIE_DPC
6070+
/*
6071+
* Intel Tiger Lake and Alder Lake BIOS has a bug that clears the DPC
6072+
* RP PIO Log Size of the integrated Thunderbolt PCIe Root Ports.
6073+
*/
6074+
static void dpc_log_size(struct pci_dev *dev)
6075+
{
6076+
u16 dpc, val;
6077+
6078+
dpc = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_DPC);
6079+
if (!dpc)
6080+
return;
6081+
6082+
pci_read_config_word(dev, dpc + PCI_EXP_DPC_CAP, &val);
6083+
if (!(val & PCI_EXP_DPC_CAP_RP_EXT))
6084+
return;
6085+
6086+
if (!((val & PCI_EXP_DPC_RP_PIO_LOG_SIZE) >> 8)) {
6087+
pci_info(dev, "Overriding RP PIO Log Size to 4\n");
6088+
dev->dpc_rp_log_size = 4;
6089+
}
6090+
}
6091+
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x461f, dpc_log_size);
6092+
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x462f, dpc_log_size);
6093+
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x463f, dpc_log_size);
6094+
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x466e, dpc_log_size);
6095+
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x9a23, dpc_log_size);
6096+
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x9a25, dpc_log_size);
6097+
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x9a27, dpc_log_size);
6098+
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x9a29, dpc_log_size);
6099+
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x9a2b, dpc_log_size);
6100+
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x9a2d, dpc_log_size);
6101+
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x9a2f, dpc_log_size);
6102+
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x9a31, dpc_log_size);
6103+
#endif

0 commit comments

Comments
 (0)