]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
platform/x86/intel/pmc: Retrieve PMC info only for available PMCs
authorXi Pardee <xi.pardee@linux.intel.com>
Tue, 5 May 2026 04:33:37 +0000 (21:33 -0700)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Fri, 8 May 2026 18:38:51 +0000 (21:38 +0300)
Update the Intel PMC Core driver to fetch PMC information only for
available PMCs. Previously, the driver attempted to retrieve PMC info
even when the corresponding PMC was not present.

This change aligns with recent updates to the Intel SSRAM Telemetry
driver. Starting with NVL, the SSRAM Telemetry driver is probed for
each individual SSRAM device. The prior implementation could not
differentiate between an unavailable PMC and one that had not yet
completed information retrieval. To resolve this, the PMC Core driver
now skips obtaining PMC info for unavailable PMCs.

Signed-off-by: Xi Pardee <xi.pardee@linux.intel.com>
Link: https://patch.msgid.link/20260505043342.2573556-7-xi.pardee@linux.intel.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/intel/pmc/arl.c
drivers/platform/x86/intel/pmc/core.c
drivers/platform/x86/intel/pmc/core.h
drivers/platform/x86/intel/pmc/lnl.c
drivers/platform/x86/intel/pmc/mtl.c
drivers/platform/x86/intel/pmc/ptl.c
drivers/platform/x86/intel/pmc/wcl.c

index 4d91ee010f6d0f7a85e01b2558be08f2becdc170..11609d593383b797dc85b0c1a53afe53144311af 100644 (file)
@@ -672,6 +672,9 @@ static struct pmc_info arl_pmc_info_list[] = {
        {}
 };
 
+static const u8 arl_pmc_list[] = {PMC_IDX_MAIN, PMC_IDX_IOE, PMC_IDX_PCH};
+static const u8 arl_h_pmc_list[] = {PMC_IDX_MAIN, PMC_IDX_IOE};
+
 #define ARL_NPU_PCI_DEV                        0xad1d
 #define ARL_GNA_PCI_DEV                        0xae4c
 #define ARL_H_NPU_PCI_DEV              0x7d1d
@@ -721,6 +724,8 @@ static int arl_h_core_init(struct pmc_dev *pmcdev, struct pmc_dev_info *pmc_dev_
 static u32 ARL_PMT_DMU_GUIDS[] = {ARL_PMT_DMU_GUID, 0x0};
 struct pmc_dev_info arl_pmc_dev = {
        .dmu_guids = ARL_PMT_DMU_GUIDS,
+       .num_pmcs = ARRAY_SIZE(arl_pmc_list),
+       .pmc_list = arl_pmc_list,
        .regmap_list = arl_pmc_info_list,
        .map = &arl_socs_reg_map,
        .sub_req_show = &pmc_core_substate_req_regs_fops,
@@ -735,6 +740,8 @@ struct pmc_dev_info arl_pmc_dev = {
 static u32 ARL_H_PMT_DMU_GUIDS[] = {ARL_PMT_DMU_GUID, ARL_H_PMT_DMU_GUID, 0x0};
 struct pmc_dev_info arl_h_pmc_dev = {
        .dmu_guids = ARL_H_PMT_DMU_GUIDS,
+       .num_pmcs = ARRAY_SIZE(arl_h_pmc_list),
+       .pmc_list = arl_h_pmc_list,
        .regmap_list = arl_pmc_info_list,
        .map = &mtl_socm_reg_map,
        .sub_req_show = &pmc_core_substate_req_regs_fops,
index 5d2e2681b0ebab886abf1da7384d471e135c393c..9c13a7554af96cd5cf4b01c1fb5dcd7ab3c3d19b 100644 (file)
@@ -1734,16 +1734,17 @@ static int pmc_core_pmc_add(struct pmc_dev *pmcdev, unsigned int pmc_idx)
        return 0;
 }
 
-static int pmc_core_ssram_get_reg_base(struct pmc_dev *pmcdev)
+static int pmc_core_ssram_get_reg_base(struct pmc_dev *pmcdev, u8 num_pmcs, const u8 *pmc_list)
 {
+       unsigned int i;
        int ret;
 
-       ret = pmc_core_pmc_add(pmcdev, PMC_IDX_MAIN);
-       if (ret)
-               return ret;
-
-       pmc_core_pmc_add(pmcdev, PMC_IDX_IOE);
-       pmc_core_pmc_add(pmcdev, PMC_IDX_PCH);
+       for (i = 0; i < num_pmcs; ++i) {
+               /* Non-MAIN PMCs are allowed to fail */
+               ret = pmc_core_pmc_add(pmcdev, pmc_list[i]);
+               if (ret && (pmc_list[i] == PMC_IDX_MAIN))
+                       return ret;
+       }
 
        return 0;
 }
@@ -1765,7 +1766,9 @@ int generic_core_init(struct pmc_dev *pmcdev, struct pmc_dev_info *pmc_dev_info)
        ssram = pmc_dev_info->regmap_list != NULL;
        if (ssram) {
                pmcdev->regmap_list = pmc_dev_info->regmap_list;
-               ret = pmc_core_ssram_get_reg_base(pmcdev);
+               ret = pmc_core_ssram_get_reg_base(pmcdev,
+                                                 pmc_dev_info->num_pmcs,
+                                                 pmc_dev_info->pmc_list);
                /*
                 * EAGAIN error code indicates Intel PMC SSRAM Telemetry driver
                 * has not finished probe and PMC info is not available yet. Try
index ef69de160ffbca66cfbd5845d477a37fa78bfff7..428b2e55864ab39fcbc0c42b5e021ab8c3d0b692 100644 (file)
@@ -501,6 +501,8 @@ enum pmc_index {
  * @pc_guid:           GUID for telemetry region to read PKGC blocker info
  * @pkgc_ltr_blocker_offset: Offset to PKGC LTR blockers in telemetry region
  * @pkgc_blocker_offset:Offset to PKGC blocker in telemetry region
+ * @num_pmcs:          Number of entries in @pmc_list
+ * @pmc_list:          Index list of available PMC
  * @regmap_list:       Pointer to a list of pmc_info structure that could be
  *                     available for the platform. When set, this field implies
  *                     SSRAM support.
@@ -521,6 +523,8 @@ struct pmc_dev_info {
        u32 pc_guid;
        u32 pkgc_ltr_blocker_offset;
        u32 pkgc_blocker_offset;
+       u8 num_pmcs;
+       const u8 *pmc_list;
        struct pmc_info *regmap_list;
        const struct pmc_reg_map *map;
        const struct file_operations *sub_req_show;
index 18f303af328e3175800e9a13b6f17ac42080d414..5ff4922825d913976e33c9215cdd93cdcd82a546 100644 (file)
@@ -544,6 +544,8 @@ static struct pmc_info lnl_pmc_info_list[] = {
        {}
 };
 
+static const u8 lnl_pmc_list[] = {PMC_IDX_MAIN};
+
 #define LNL_NPU_PCI_DEV                0x643e
 #define LNL_IPU_PCI_DEV                0x645d
 
@@ -571,6 +573,8 @@ static int lnl_core_init(struct pmc_dev *pmcdev, struct pmc_dev_info *pmc_dev_in
 }
 
 struct pmc_dev_info lnl_pmc_dev = {
+       .num_pmcs = ARRAY_SIZE(lnl_pmc_list),
+       .pmc_list = lnl_pmc_list,
        .regmap_list = lnl_pmc_info_list,
        .map = &lnl_socm_reg_map,
        .sub_req_show = &pmc_core_substate_req_regs_fops,
index b724dd8c34dba67708afa71489e774e6e135b32a..9abeabd3dbe276876dc32e6de1ffe4abb89b06e0 100644 (file)
@@ -965,6 +965,8 @@ static struct pmc_info mtl_pmc_info_list[] = {
        {}
 };
 
+static const u8 mtl_pmc_list[] = {PMC_IDX_MAIN, PMC_IDX_IOE};
+
 #define MTL_GNA_PCI_DEV        0x7e4c
 #define MTL_IPU_PCI_DEV        0x7d19
 #define MTL_VPU_PCI_DEV        0x7d1d
@@ -995,6 +997,8 @@ static int mtl_core_init(struct pmc_dev *pmcdev, struct pmc_dev_info *pmc_dev_in
 static u32 MTL_PMT_DMU_GUIDS[] = {MTL_PMT_DMU_GUID, 0x0};
 struct pmc_dev_info mtl_pmc_dev = {
        .dmu_guids = MTL_PMT_DMU_GUIDS,
+       .num_pmcs = ARRAY_SIZE(mtl_pmc_list),
+       .pmc_list = mtl_pmc_list,
        .regmap_list = mtl_pmc_info_list,
        .map = &mtl_socm_reg_map,
        .sub_req_show = &pmc_core_substate_req_regs_fops,
index 6c68772e738c8a53646773b9680c3ed43795805e..90fcd7900d9f9f66fa146a531f5f5778e74885a1 100644 (file)
@@ -543,6 +543,8 @@ static struct pmc_info ptl_pmc_info_list[] = {
        {}
 };
 
+static const u8 ptl_pmc_list[] = {PMC_IDX_MAIN};
+
 #define PTL_NPU_PCI_DEV                0xb03e
 #define PTL_IPU_PCI_DEV                0xb05d
 
@@ -569,6 +571,8 @@ static int ptl_core_init(struct pmc_dev *pmcdev, struct pmc_dev_info *pmc_dev_in
 }
 
 struct pmc_dev_info ptl_pmc_dev = {
+       .num_pmcs = ARRAY_SIZE(ptl_pmc_list),
+       .pmc_list = ptl_pmc_list,
        .regmap_list = ptl_pmc_info_list,
        .map = &ptl_pcdp_reg_map,
        .sub_req_show = &pmc_core_substate_blk_req_fops,
index b55069945e9e7aa741c68e107db9de820d618e80..d34ac916907dc3c511832e8ede3ed75dc8be5e7f 100644 (file)
@@ -469,6 +469,8 @@ static struct pmc_info wcl_pmc_info_list[] = {
        {}
 };
 
+static const u8 wcl_pmc_list[] = {PMC_IDX_MAIN};
+
 #define WCL_NPU_PCI_DEV                0xfd3e
 
 /*
@@ -494,6 +496,8 @@ static int wcl_core_init(struct pmc_dev *pmcdev, struct pmc_dev_info *pmc_dev_in
 
 struct pmc_dev_info wcl_pmc_dev = {
        .regmap_list = wcl_pmc_info_list,
+       .num_pmcs = ARRAY_SIZE(wcl_pmc_list),
+       .pmc_list = wcl_pmc_list,
        .map = &wcl_pcdn_reg_map,
        .sub_req_show = &pmc_core_substate_blk_req_fops,
        .suspend = cnl_suspend,