diff options
author | Dan Williams <dan.j.williams@intel.com> | 2023-06-25 17:53:18 -0700 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2023-06-25 17:53:18 -0700 |
commit | d2f9fe695313b1e50028c1ec4cd09bea67152a60 (patch) | |
tree | 4677c0f61ea1192a782ea3c31e4df88b4d12d04d /drivers/cxl/pci.c | |
parent | e2c18eb50c7bb191d1ebfed973c2ec3e0066ad37 (diff) | |
parent | c2b34d442226b69e519eb0ba61939a74d91712d4 (diff) | |
download | lwn-d2f9fe695313b1e50028c1ec4cd09bea67152a60.tar.gz lwn-d2f9fe695313b1e50028c1ec4cd09bea67152a60.zip |
Merge branch 'for-6.5/cxl-perf' into for-6.5/cxl
Pick up initial support for the CXL 3.0 performance monitoring
definition. Small conflicts with the firmware update work as they both
placed their init code in the same location.
Diffstat (limited to 'drivers/cxl/pci.c')
-rw-r--r-- | drivers/cxl/pci.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c index 18cfb7ae17a3..270d63d11e17 100644 --- a/drivers/cxl/pci.c +++ b/drivers/cxl/pci.c @@ -13,6 +13,7 @@ #include "cxlmem.h" #include "cxlpci.h" #include "cxl.h" +#include "pmu.h" /** * DOC: cxl pci @@ -825,7 +826,7 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) struct cxl_dev_state *cxlds; struct cxl_register_map map; struct cxl_memdev *cxlmd; - int rc; + int i, rc, pmu_count; /* * Double check the anonymous union trickery in struct cxl_regs @@ -919,6 +920,29 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (rc) return rc; + pmu_count = cxl_count_regblock(pdev, CXL_REGLOC_RBI_PMU); + for (i = 0; i < pmu_count; i++) { + struct cxl_pmu_regs pmu_regs; + + rc = cxl_find_regblock_instance(pdev, CXL_REGLOC_RBI_PMU, &map, i); + if (rc) { + dev_dbg(&pdev->dev, "Could not find PMU regblock\n"); + break; + } + + rc = cxl_map_pmu_regs(pdev, &pmu_regs, &map); + if (rc) { + dev_dbg(&pdev->dev, "Could not map PMU regs\n"); + break; + } + + rc = devm_cxl_pmu_add(cxlds->dev, &pmu_regs, cxlmd->id, i, CXL_PMU_MEMDEV); + if (rc) { + dev_dbg(&pdev->dev, "Could not add PMU instance\n"); + break; + } + } + rc = cxl_event_config(host_bridge, mds); if (rc) return rc; |