On Tue, Dec 10, 2024 at 08:04:17PM +0800, Shuai Xue wrote: > 在 2024/12/10 06:29, Bjorn Helgaas 写道: > > From: Bjorn Helgaas <bhelgaas@xxxxxxxxxx> > > > > PCI Vendor-Specific (VSEC) Capabilities are defined by each vendor. > > Devices from different vendors may advertise a VSEC Capability with the DWC > > RAS DES functionality, but the vendors may assign different VSEC IDs. > > > > Search for the DWC RAS DES Capability using the VSEC ID and VSEC Rev > > chosen by the vendor. > > - for (vid = dwc_pcie_vendor_ids; vid->vendor_id; vid++) { > > + for (vid = dwc_pcie_pmu_vsec_ids; vid->vendor_id; vid++) { > > How about checking the pdev->vendor with vid->vendor_id before > search the vesc cap? > > + if (pdev->vendor != vid->vendor_id) > + continue; Every user of VSEC needs to specify the (Vendor ID, VSEC ID) and verify that the Vendor ID matches the device Vendor ID, so pci_find_vsec_capability() does this check internally, so I don't think we need to do it here. > > vsec = pci_find_vsec_capability(pdev, vid->vendor_id, > > - DWC_PCIE_VSEC_RAS_DES_ID); > > - if (vsec) > > - break; > > + vid->vsec_id);