]> git.itanic.dy.fi Git - linux-stable/commitdiff
Merge branch 'for-6.5/cxl-perf' into for-6.5/cxl
authorDan Williams <dan.j.williams@intel.com>
Mon, 26 Jun 2023 00:53:18 +0000 (17:53 -0700)
committerDan Williams <dan.j.williams@intel.com>
Mon, 26 Jun 2023 00:53:18 +0000 (17:53 -0700)
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.

1  2 
MAINTAINERS
drivers/cxl/Kconfig
drivers/cxl/core/port.c
drivers/cxl/core/regs.c
drivers/cxl/cxl.h
drivers/cxl/pci.c
tools/testing/cxl/Kbuild

diff --cc MAINTAINERS
Simple merge
Simple merge
Simple merge
Simple merge
index d2bae6d68365c85c0d45c6a6eb355d1a74d8e9c3,496ca9be8f0b69732eafc88ce3faae8a8753b420..bc917a75333f60503168d60ae0a933d278c9fb3a
@@@ -262,12 -264,17 +272,17 @@@ void cxl_probe_component_regs(struct de
  void cxl_probe_device_regs(struct device *dev, void __iomem *base,
                           struct cxl_device_reg_map *map);
  int cxl_map_component_regs(struct device *dev, struct cxl_component_regs *regs,
 -                         struct cxl_register_map *map,
 +                         const struct cxl_register_map *map,
                           unsigned long map_mask);
  int cxl_map_device_regs(struct device *dev, struct cxl_device_regs *regs,
 -                      struct cxl_register_map *map);
 +                      const struct cxl_register_map *map);
+ int cxl_map_pmu_regs(struct pci_dev *pdev, struct cxl_pmu_regs *regs,
+                    struct cxl_register_map *map);
  
  enum cxl_regloc_type;
+ int cxl_count_regblock(struct pci_dev *pdev, enum cxl_regloc_type type);
+ int cxl_find_regblock_instance(struct pci_dev *pdev, enum cxl_regloc_type type,
+                              struct cxl_register_map *map, int index);
  int cxl_find_regblock(struct pci_dev *pdev, enum cxl_regloc_type type,
                      struct cxl_register_map *map);
  
index 18cfb7ae17a3782ff783a031e21d59dd30eb0fec,4c3bd20ec7c8a2c1567921f8c79cdd478f5c32f2..270d63d11e17dce786a8cec682e19b5dcdf5b7de
@@@ -821,11 -655,10 +822,11 @@@ static int cxl_event_config(struct pci_
  static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
  {
        struct pci_host_bridge *host_bridge = pci_find_host_bridge(pdev->bus);
 +      struct cxl_memdev_state *mds;
 +      struct cxl_dev_state *cxlds;
        struct cxl_register_map map;
        struct cxl_memdev *cxlmd;
-       int rc;
 -      struct cxl_dev_state *cxlds;
+       int i, rc, pmu_count;
  
        /*
         * Double check the anonymous union trickery in struct cxl_regs
        if (IS_ERR(cxlmd))
                return PTR_ERR(cxlmd);
  
 -      rc = cxl_event_config(host_bridge, cxlds);
 +      rc = cxl_memdev_setup_fw_upload(mds);
 +      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;
  
Simple merge