Re: [PATCH 1/2] PCI/ASPM: Cache Link Capabilities so quirks can override them
Shawn Lin <[email protected]> Fri, 7 Nov 2025 14:16:02 +0800
| Newsgroups | gmane.linux.kernel.pci,gmane.linux.ports.ppc64.devel,gmane.linux.debian.ports.powerpc,gmane.linux.kernel |
|---|---|
| Message-ID | <[email protected]> |
在 2025/11/07 星期五 14:03, Manivannan Sadhasivam 写道: > On Fri, Nov 07, 2025 at 09:17:09AM +0800, Shawn Lin wrote: >> 在 2025/11/07 星期五 2:36, Bjorn Helgaas 写道: >>> From: Bjorn Helgaas <[email protected]> >>> >>> Cache the PCIe Link Capabilities register in struct pci_dev so quirks can >>> remove features to avoid hardware defects. The idea is: >>> >>> - set_pcie_port_type() reads PCIe Link Capabilities and caches it in >>> dev->lnkcap >>> >>> - HEADER quirks can update the cached dev->lnkcap to remove advertised >>> features that don't work correctly >>> >>> - pcie_aspm_cap_init() relies on dev->lnkcap and ignores any features not >>> advertised there >>> >> >> Quick test with a NVMe shows it works. >> >> Before this patch, lspci -vvv dumps: >> >> LnkCap: Port #0, Speed 16GT/s, Width x4, ASPM L1, Exit Latency L1 <64us >> ClockPM+ Surprise- LLActRep- BwNot- ASPMOptComp+ >> LnkCtl: ASPM L1 Enabled; RCB 64 bytes, LnkDisable- CommClk+ >> >> >> Capabilities: [21c v1] L1 PM Substates >> L1SubCap: PCI-PM_L1.2+ PCI-PM_L1.1+ ASPM_L1.2+ ASPM_L1.1+ >> L1_PM_Substates+ >> PortCommonModeRestoreTime=10us PortTPowerOnTime=10us >> L1SubCtl1: PCI-PM_L1.2+ PCI-PM_L1.1+ ASPM_L1.2+ ASPM_L1.1+ >> T_CommonMode=0us LTR1.2_Threshold=26016ns >> >> After this patch + a local quirk patch like your patch 2, it shows: >> >> LnkCap: Port #0, Speed 16GT/s, Width x4, ASPM L1, Exit Latency L1 <64us >> ClockPM+ Surprise- LLActRep- BwNot- ASPMOptComp+ >> LnkCtl: ASPM Disabled; RCB 64 bytes, LnkDisable- CommClk- >> >> Capabilities: [21c v1] L1 PM Substates >> L1SubCap: PCI-PM_L1.2+ PCI-PM_L1.1+ ASPM_L1.2+ ASPM_L1.1+ >> L1_PM_Substates+ >> PortCommonModeRestoreTime=10us PortTPowerOnTime=10us >> L1SubCtl1: PCI-PM_L1.2- PCI-PM_L1.1- ASPM_L1.2- ASPM_L1.1- >> T_CommonMode=0us LTR1.2_Threshold=0ns >> >> >> >> One things I noticed is CommClk in LnkCtl is changed. > > That's not because of this series, but because of your quirk that disables L0s > and L1. Common Clock Configuration happens only when ASPM is enabled, if it is > disabled, PCI core will not configure it (the value remains untouched). That's > why it was enabled before your quirk and disabled afterwards. > Thanks for the detailed explanation, I have no more questions now. > This bit is also only used to report the L0s and L1 Exit latencies by the > devices. > > - Mani >