Re: [PATCH] perf/dwc_pcie: Qualify RAS DES VSEC Capability by Vendor, Revision

From: Shuai Xue
Date: Tue Dec 10 2024 - 20:24:25 EST




在 2024/12/10 22:53, Bjorn Helgaas 写道:
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.


I see. LGTM. Also, I quickly tested it on Yitian 710 and it works as expected.

Reviewed-and-tested-by: Shuai Xue <xueshuai@xxxxxxxxxxxxxxxxx>

Thanks.

Best Regards,
Shuai