Re: [PATCH v10 4/5] drivers/perf: add DesignWare PCIe PMU driver

From: Ilkka Koskinen
Date: Thu Nov 16 2023 - 14:03:07 EST




On Thu, 16 Nov 2023, Shuai Xue wrote:
On 2023/11/16 11:50, Ilkka Koskinen wrote:
+static int dwc_pcie_pmu_probe(struct platform_device *plat_dev)
+{
+    struct pci_dev *pdev = plat_dev->dev.platform_data;
+    struct dwc_pcie_pmu *pcie_pmu;
+    char *name;
+    u32 bdf, val;
+    u16 vsec;
+    int ret;
+
+    vsec = pci_find_vsec_capability(pdev, PCI_VENDOR_ID_ALIBABA,
+                    DWC_PCIE_VSEC_RAS_DES_ID);

You nicely changed to use vendor list in this version but here the driver still tries to find Alibaba specific capability.

Sorry, I missed here.

I guess, you could search again using the vendor list. The other option would be to make dwc_pcie_match_des_cap() to return the vendor id, pass it to dwc_pcie_register_dev(), which would add it to device's platform data with
the pointer to the pci device.

The dwc_pcie_pmu_probe() is called by device which has DWC_PCIE_VSEC_RAS_DES_ID cap.
So I guess I can use pdev->vendor directly here, e.g?

pci_find_vsec_capability(pdev, pdev->vendor, DWC_PCIE_VSEC_RAS_DES_ID);


Oh, right. That seems correct.

Cheers, Ilkka


Best Regards,
Shuai