Skip to contentSkip to conversation

PCI: Add quirk to mask ACSViol on XHCI on iMac20,1 And iMac20,2

PATCH In review Atharva Tiwari 3 participants 4 messages Nov 16 – Nov 20

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: Add quirk to mask ACSViol on XHCI on iMac20,1 And iMac20,2

On iMac20,1 and iMac20,2 the Thunderbolt xHCI (8086:15ec) triggers an ACS Violation on its upstream port whenever it is runtime-resumed from D3hot, e.g. on suspend and shutdown:

  [  141.535310] pcieport 0000:00:1c.4: AER: Uncorrectable (Non-Fatal) Error message received from 0000:08:02.0
  [  141.535325] pcieport 0000:08:02.0: PCIe Bus Error: severity=Uncorrectable (Non-Fatal)
  [  141.535325] pcieport 0000:08:02.0:   device [8086:15ea] error status/mask=00200000/00000000
  [  141.535327] pcieport 0000:08:02.0:   [21] ACSViol           | Receiver    | Transaction Layer (First)
  [  141.535328] pcieport 0000:08:02.0: AER:   TLP Header: 0x34000000 0x00000010 0x00000000 0x00000000
  [  141.551637] xhci_hcd 0000:0a:00.0: AER: can't recover (no error_detected callback)
  [  141.551655] pcieport 0000:08:02.0: AER: device recovery failed

The violation is raised inside the 10 ms D3hot->D0 recovery window: the port's AER status is still clean right after the PM_CTRL write and set once the delay has elapsed,
before any config space has been restored.
The kernel cannot run anything in that window.
The ACPI _PS0 and _PS3 methods were also checked and have no effect on it.

This is most likely a hardware defect: the port correctly drops the message, and the same controller on MacBookPro16,1 is not affected. The error is unrecoverable noise, so mask ACSViol on the upstream port on these models. ACS stays enabled.

---
 arch/x86/pci/fixup.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
arch/x86/pci/fixup.c +20 -0
index 795d81c7a..b7c0de6c2 100644
@@ -1094,6 +1094,26 @@ static void asus_disable_nvme_d3cold(struct pci_dev *pdev)
 }
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x9a09, asus_disable_nvme_d3cold);
 
+#ifdef CONFIG_PCIEAER
+/*
+ * On iMac20,1 and iMac20,2 the XHCI controller gives ACSViolations
+ * When switching from D3Hot/D3cold to D0, and it happens because of
+ * the D0 write, so we mask ACSViol at boot on these devices.
+ */
+static void titan_ridge_xhci_mask_acsv(struct pci_dev *pdev)
+{
+	struct pci_dev *up = pci_upstream_bridge(pdev);
+
+	if (!dmi_match(DMI_PRODUCT_NAME, "iMac20,1") &&
+	    !dmi_match(DMI_PRODUCT_NAME, "iMac20,2"))
+		return;
+	if (up && up->aer_cap)
+		pci_clear_and_set_config_dword(up, up->aer_cap + PCI_ERR_UNCOR_MASK,
+					       0, PCI_ERR_UNC_ACSV);
+}
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x15ec, titan_ridge_xhci_mask_acsv);
+#endif /* CONFIG_PCIEAER */
+
 #ifdef CONFIG_SUSPEND
 /*
  * Root Ports on some AMD SoCs advertise PME_Support for D3hot and D3cold, but
Signature · 1 line
2.55.0
#1 lore raw
Sashiko has reviewed this patch and found no issues.
Quoted 19 lines

On iMac20,1 and iMac20,2 the Thunderbolt xHCI (8086:15ec) triggers an ACS Violation on its upstream port whenever it is runtime-resumed from D3hot, e.g. on suspend and shutdown:

  [  141.535310] pcieport 0000:00:1c.4: AER: Uncorrectable (Non-Fatal) Error message received from 0000:08:02.0
  [  141.535325] pcieport 0000:08:02.0: PCIe Bus Error: severity=Uncorrectable (Non-Fatal)
  [  141.535325] pcieport 0000:08:02.0:   device [8086:15ea] error status/mask=00200000/00000000
  [  141.535327] pcieport 0000:08:02.0:   [21] ACSViol           | Receiver    | Transaction Layer (First)
  [  141.535328] pcieport 0000:08:02.0: AER:   TLP Header: 0x34000000 0x00000010 0x00000000 0x00000000
  [  141.551637] xhci_hcd 0000:0a:00.0: AER: can't recover (no error_detected callback)
  [  141.551655] pcieport 0000:08:02.0: AER: device recovery failed

The violation is raised inside the 10 ms D3hot->D0 recovery window: the port's AER status is still clean right after the PM_CTRL write and set once the delay has elapsed,
before any config space has been restored.
The kernel cannot run anything in that window.
The ACPI _PS0 and _PS3 methods were also checked and have no effect on it.

Quoted 6 lines

This is most likely a hardware defect: the port correctly drops the message, and the same controller on MacBookPro16,1 is not affected. The error is unrecoverable noise, so mask ACSViol on the upstream port on these models. ACS stays enabled.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#2 lore raw
In reply to Atharva Tiwari
Quoted 3 lines · Atharva Tiwari

On iMac20,1 and iMac20,2 the Thunderbolt xHCI (8086:15ec) triggers an ACS Violation on its upstream port whenever it is runtime-resumed from D3hot, e.g. on suspend and shutdown:

[...]

Quoted 1 line

+++ b/arch/x86/pci/fixup.c

[...]

arch/x86/pci/fixup.c static void asus_disable_nvme_d3cold(struct pci_dev *pdev) · line 1113

Quoted 11 lines
arch/x86/pci/fixup.c +11 -0
+static void titan_ridge_xhci_mask_acsv(struct pci_dev *pdev)
+{
+	struct pci_dev *up = pci_upstream_bridge(pdev);
+
+	if (!dmi_match(DMI_PRODUCT_NAME, "iMac20,1") &&
+	    !dmi_match(DMI_PRODUCT_NAME, "iMac20,2"))
+		return;
+	if (up && up->aer_cap)
+		pci_clear_and_set_config_dword(up, up->aer_cap + PCI_ERR_UNCOR_MASK,
+					       0, PCI_ERR_UNC_ACSV);
+}

See this discussion:

https://lore.kernel.org/r/CAL0aDZ_HOq1Sof90GJoBDzPo7Gmr7P_rSnYJaN75QH4K+iodpw@mail.gmail.com/

It's an LTR message with a zero Requester ID. This needs to be fixed more generically, not with a model-specific quirk.

Thanks,

Lukas

#3 lore raw
Quoted 10 lines

See this discussion:

https://lore.kernel.org/r/CAL0aDZ_HOq1Sof90GJoBDzPo7Gmr7P_rSnYJaN75QH4K+iodpw@mail.gmail.com/

It's an LTR message with a zero Requester ID. This needs to be fixed more generically, not with a model-specific quirk.

Thanks,

Lukas

I also did not really like the patch tbh. it is now obsolete however the problem was in the thunderbolt controller, we are basically done fixing thunderbolt (all apple systems from alpine ridge to icelake) you can see the code here if you want to:

https://github.com/kaiT2en/KaiT2en-Fedora/blob/main/patches/runtime/thunderbolt/0001-thunderbolt-add-Titan-Ridge-and-Ice-Lake-RTD3-on-Apple-T2-Macs.patch

(this is not complete, some acpi methods like TRPE and SXFP are missing, we are trying to add that, and the code should be done)

Thanks,

Atharva