Enable SSRAM support in PTL and LNL
Subsystems (2)
Xi Pardee
maintainerv4 cover Enable SSRAM support in PTL and LNL
This series enables SSRAM support, including achieving PMC information, low power mode substate requirements in Lunar Lake and Panther Lake platforms for Intel PMC Core driver. This patch series will not modify the functionality of Intel PMC Core driver in previous platforms.
The first patch enables SSRAM support for Lunar Lake platforms. The next three patches introduces a new table in telemetry region to get substate requirement information for platforms starting from Panther Lake. The last patch enables SSRAM support for Panther Lake platforms.
---v4->v3:
- Drop the patch to show device and function number. This patch will be sent separately.
- Add a comma in enum definition.
- Use %u for unsigned variables.
- Remove unneeded variables.
- Remove unneeded empty lines.
v3->v2:
- Add a patch to show device and function number.
- Use function pointer in struct pmc_dev_info to determine which substate requirement table to achieve and which show operation to use.
- Fix alignment.
- Move variable declarations to appropriate locations.
- Replace char pointer with enum as function parameter.
v2->v1:
- Change to only check ret variable value when getting substate data in pmc_core_get_telem_info().
- Return immediately when devm_kcalloc() fails.
- Return 0 instead of ret when succeeding in pmc_core_pmt_get_blk_sub_req().
- Replace devm_kzalloc() with devm_kcalloc().
- Add telem_info field of arl_pmc_dev variable.
Xi Pardee (5):
platform/x86:intel/pmc: Enable SSRAM support for Lunar Lake platform/x86:intel/pmc: Move telemetry endpoint register handling platform/x86:intel/pmc: Improve function to show substate header platform/x86:intel/pmc: Show substate requirement for S0ix blockers platform/x86:intel/pmc: Enable SSRAM support for Panther Lake
drivers/platform/x86/intel/pmc/arl.c | 4 + drivers/platform/x86/intel/pmc/core.c | 182 +++++++++++++++++++++----- drivers/platform/x86/intel/pmc/core.h | 16 +++ drivers/platform/x86/intel/pmc/lnl.c | 18 +++ drivers/platform/x86/intel/pmc/mtl.c | 2 + drivers/platform/x86/intel/pmc/ptl.c | 31 +++++ 6 files changed, 217 insertions(+), 36 deletions(-)
Signature · 1 line
2.43.0
Xi Pardee
maintainerPATCH v4 1/5 platform/x86:intel/pmc: Enable SSRAM support for Lunar Lake
Enable Lunar Lake platforms to achieve PMC information from Intel PMC SSRAM Telemetry driver and substate requirements data from telemetry region.
--- drivers/platform/x86/intel/pmc/lnl.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/platform/x86/intel/pmc/lnl.c +16 -0
@@ -13,6 +13,10 @@#include "core.h" +#define SOCM_LPM_REQ_GUID 0x15099748 + +static const u8 LNL_LPM_REG_INDEX [] = {0 ,4 ,5 ,6 ,8 ,9 ,10 ,11 ,12 ,13 ,14 ,15 ,16 ,20 }; +static const struct pmc_bit_map lnl_ltr_show_map[] = { {"SOUTHPORT_A" ,CNP_PMC_LTR_SPA }, {"SOUTHPORT_B" ,CNP_PMC_LTR_SPB },
@@ -528,6 +532,16 @@ static const struct pmc_reg_map lnl_socm_reg_map = { .lpm_live_status_offset = MTL_LPM_LIVE_STATUS_OFFSET, .s0ix_blocker_maps = lnl_blk_maps, .s0ix_blocker_offset = LNL_S0IX_BLOCKER_OFFSET, + .lpm_reg_index = LNL_LPM_REG_INDEX, +}; + +static struct pmc_info lnl_pmc_info_list[] = { + { + .guid =SOCM_LPM_REQ_GUID , + .devid =PMC_DEVID_LNL_SOCM , + .map = &lnl_socm_reg_map, + }, + {} };#define LNL_NPU_PCI_DEV 0x643e
@@ -557,6 +571,8 @@ static int lnl_core_init(struct pmc_dev *pmcdev, struct pmc_dev_info *pmc_dev_in }struct pmc_dev_info lnl_pmc_dev = { + .pci_func =2 , + .regmap_list = lnl_pmc_info_list, .map = &lnl_socm_reg_map, .suspend = cnl_suspend, .resume = lnl_resume,
Signature · 1 line
2.43.0
Xi Pardee
maintainerPATCH v4 2/5 platform/x86:intel/pmc: Move telemetry endpoint register handling
In reply to Xi PardeeMove telemetry endpoint handling to pmc_core_get_telem_info(). This is a preparation patch to introduce a new table to obtain Low Power Mode substate requirement data for platforms starting from Panther Lake.
--- drivers/platform/x86/intel/pmc/core.c | 51 +++++++++++++-------------- 1 file changed, 25 insertions(+), 26 deletions(-)
drivers/platform/x86/intel/pmc/core.c +25 -26
@@ -1399,36 +1399,23 @@ static u32 pmc_core_find_guid(struct pmc_info *list, const struct pmc_reg_map *m* +----+---------------------------------------------------------+ * */ -static int pmc_core_get_lpm_req (struct pmc_dev *pmcdev,struct pmc *pmc,struct pci_dev *pcidev) +static int pmc_core_pmt_get_lpm_req (struct pmc_dev *pmcdev,struct pmc *pmc, +struct telem_endpoint *ep) { -struct telem_endpoint *ep;const u8 *lpm_indices;int num_maps, mode_offset =0 ;int ret, mode;int lpm_size; -u32 guid; lpm_indices = pmc->map->lpm_reg_index; num_maps = pmc->map->lpm_num_maps; lpm_size =LPM_MAX_NUM_MODES * num_maps; - guid =pmc_core_find_guid (pmcdev->regmap_list, pmc->map); -if (!guid) -return -ENXIO ; - - ep =pmt_telem_find_and_register_endpoint (pcidev, guid,0 ); -if (IS_ERR (ep)) { -dev_dbg (&pmcdev->pdev->dev,"couldn't get telem endpoint %pe" , ep); -return -EPROBE_DEFER ; - } - pmc->lpm_req_regs =devm_kzalloc (&pmcdev->pdev->dev, lpm_size *sizeof (u32),GFP_KERNEL ); -if (!pmc->lpm_req_regs) { - ret = -ENOMEM ; - goto unregister_ep; - } +if (!pmc->lpm_req_regs) +return -ENOMEM ; mode_offset =LPM_HEADER_OFFSET +LPM_MODE_OFFSET ;pmc_for_each_mode (mode, pmcdev) {
@@ -1442,23 +1429,21 @@ static int pmc_core_get_lpm_req(struct pmc_dev *pmcdev, struct pmc *pmc, structif (ret) {dev_err (&pmcdev->pdev->dev,"couldn't read Low Power Mode requirements: %d\n" , ret); - goto unregister_ep; +return ret; } ++req_offset; } mode_offset +=LPM_REG_COUNT +LPM_MODE_OFFSET ; } - -unregister_ep: -pmt_telem_unregister_endpoint (ep); -return ret; } -static int pmc_core_ssram_get_lpm_reqs (struct pmc_dev *pmcdev,int func) +static int pmc_core_get_telem_info (struct pmc_dev *pmcdev,int func) { struct pci_dev *pcidev __free(pci_dev_put) = NULL; +struct telem_endpoint *ep;unsigned int i; +u32 guid;int ret; pcidev =pci_get_domain_bus_and_slot (0 ,0 ,PCI_DEVFN (20 , func));
@@ -1466,10 +1451,24 @@ static int pmc_core_ssram_get_lpm_reqs(struct pmc_dev *pmcdev, int func)return -ENODEV ;for (i =0 ; i <ARRAY_SIZE (pmcdev->pmcs); ++i) { -if (!pmcdev->pmcs[i]) +struct pmc *pmc; + + pmc = pmcdev->pmcs[i]; +if (!pmc)continue ; - ret =pmc_core_get_lpm_req (pmcdev, pmcdev->pmcs[i], pcidev); + guid =pmc_core_find_guid (pmcdev->regmap_list, pmc->map); +if (!guid) +return -ENXIO ; + + ep =pmt_telem_find_and_register_endpoint (pcidev, guid,0 ); +if (IS_ERR (ep)) { +dev_dbg (&pmcdev->pdev->dev,"couldn't get telem endpoint %pe" , ep); +return -EPROBE_DEFER ; + } + + ret =pmc_core_pmt_get_lpm_req (pmcdev, pmc, ep); +pmt_telem_unregister_endpoint (ep);if (ret)return ret; }
@@ -1583,7 +1582,7 @@ int generic_core_init(struct pmc_dev *pmcdev, struct pmc_dev_info *pmc_dev_info)pmc_core_punit_pmt_init (pmcdev, pmc_dev_info->dmu_guid);if (ssram) { - ret =pmc_core_ssram_get_lpm_reqs (pmcdev, pmc_dev_info->pci_func); + ret =pmc_core_get_telem_info (pmcdev, pmc_dev_info->pci_func);if (ret) goto unmap_regbase; }
Signature · 1 line
2.43.0
Xi Pardee
maintainerPATCH v4 3/5 platform/x86:intel/pmc: Improve function to show substate header
In reply to Xi PardeeRefactor pmc_core_substate_req_header_show() to accept a new argument. This is a preparation patch to introduce a new way to show Low Power Mode substate requirement data for platforms starting from Panther Lake. Increased the size for the name column as the Low Power Mode requirement register name is longer in newer platforms.
--- drivers/platform/x86/intel/pmc/core.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
drivers/platform/x86/intel/pmc/core.c +16 -6
@@ -11,6 +11,11 @@#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +enum header_type { +HEADER_STATUS , +HEADER_VALUE , +}; +#include <linux/bitfield.h> #include <linux/debugfs.h> #include <linux/delay.h>
@@ -828,17 +833,22 @@ static int pmc_core_substate_l_sts_regs_show(struct seq_file *s, void *unused) }DEFINE_SHOW_ATTRIBUTE (pmc_core_substate_l_sts_regs); -static void pmc_core_substate_req_header_show (struct seq_file *s,int pmc_index) +static void pmc_core_substate_req_header_show (struct seq_file *s,int pmc_index, +enum header_type type) {struct pmc_dev *pmcdev = s->private;int mode; -seq_printf (s,"%30s |" ,"Element" ); +seq_printf (s,"%40s |" ,"Element" );pmc_for_each_mode (mode, pmcdev)seq_printf (s," %9s |" , pmc_lpm_modes[mode]); -seq_printf (s," %9s |" ,"Status" ); -seq_printf (s," %11s |\n" ,"Live Status" ); +if (type ==HEADER_STATUS ) { +seq_printf (s," %9s |" ,"Status" ); +seq_printf (s," %11s |\n" ,"Live Status" ); + }else { +seq_printf (s," %9s |\n" ,"Value" ); + } }static int pmc_core_substate_req_regs_show (struct seq_file *s,void *unused)
@@ -872,7 +882,7 @@ static int pmc_core_substate_req_regs_show(struct seq_file *s, void *unused)continue ;/* Display the header */ -pmc_core_substate_req_header_show (s, pmc_index); +pmc_core_substate_req_header_show (s, pmc_index,HEADER_STATUS );/* Loop over maps */ for (mp =0 ; mp < num_maps; mp++) {
@@ -910,7 +920,7 @@ static int pmc_core_substate_req_regs_show(struct seq_file *s, void *unused) }/* Display the element name in the first column */ -seq_printf (s,"pmc%d: %26s |" , pmc_index, map[i].name); +seq_printf (s,"pmc%d: %34s |" , pmc_index, map[i].name);/* Loop over the enabled states and display if required */ pmc_for_each_mode (mode, pmcdev) {
Signature · 1 line
2.43.0
Xi Pardee
maintainerPATCH v4 4/5 platform/x86:intel/pmc: Show substate requirement for S0ix blockers
In reply to Xi PardeeAdd support to read and show S0ix blocker substate requirements. Starting from Panther Lake, substate requirement data is provided based on S0ix blockers instead of all low power mode requirements. For platforms that support this new feature, add support to display substate requirements based on S0ix blockers.
Change the "substate_requirements" attribute of Intel PMC Core driver to show the substate requirements for each S0ix blocker and the corresponding S0ix blocker value.
--- drivers/platform/x86/intel/pmc/arl.c | 4 + drivers/platform/x86/intel/pmc/core.c | 121 +++++++++++++++++++++++--- drivers/platform/x86/intel/pmc/core.h | 14 +++ drivers/platform/x86/intel/pmc/lnl.c | 2 + drivers/platform/x86/intel/pmc/mtl.c | 2 + 5 files changed, 133 insertions(+), 10 deletions(-)
drivers/platform/x86/intel/pmc/arl.c +4 -0
@@ -725,9 +725,11 @@ struct pmc_dev_info arl_pmc_dev = { .dmu_guid = ARL_PMT_DMU_GUID, .regmap_list = arl_pmc_info_list, .map = &arl_socs_reg_map, + .sub_req_show = &pmc_core_substate_req_regs_fops, .suspend = cnl_suspend, .resume = arl_resume, .init = arl_core_init, + .sub_req = pmc_core_pmt_get_lpm_req, };struct pmc_dev_info arl_h_pmc_dev = {
@@ -735,7 +737,9 @@ struct pmc_dev_info arl_h_pmc_dev = { .dmu_guid = ARL_PMT_DMU_GUID, .regmap_list = arl_pmc_info_list, .map = &mtl_socm_reg_map, + .sub_req_show = &pmc_core_substate_req_regs_fops, .suspend = cnl_suspend, .resume = arl_h_resume, .init = arl_h_core_init, + .sub_req = pmc_core_pmt_get_lpm_req, };
drivers/platform/x86/intel/pmc/core.c +111 -10
181 lines not on this page · raw message
drivers/platform/x86/intel/pmc/core.h +14 -0
@@ -351,6 +351,8 @@ struct pmc_bit_map {* @pm_read_disable_bit: Bit index to read PMC_READ_DISABLE * @slps0_dbg_offset: PWRMBASE offset to SLP_S0_DEBUG_REG* * @s0ix_blocker_offset PWRMBASE offset to S0ix blocker counter +* @num_s0ix_blocker: Number of S0ix blockers +* @blocker_req_offset: Telemetry offset to S0ix blocker low power mode substate requirement table * * Each PCH has unique set of register offsets and bit indexes. This structure * captures them to have a common implementation.
@@ -376,6 +378,8 @@ struct pmc_reg_map {const u32 ltr_ignore_max;const u32 pm_vric1_offset;const u32 s0ix_blocker_offset; +const u32 num_s0ix_blocker; +const u32 blocker_req_offset;/* Low Power Mode registers */ const int lpm_num_maps;const int lpm_num_modes;
@@ -481,18 +485,22 @@ enum pmc_index {* SSRAM support. * @map: Pointer to a pmc_reg_map struct that contains platform * specific attributes of the primary PMC +* @sub_req_show: File operations to show substate requirements * @suspend: Function to perform platform specific suspend * @resume: Function to perform platform specific resume * @init: Function to perform platform specific init action +* @sub_req: Function to achieve low power mode substate requirements */ struct pmc_dev_info {u8 pci_func;u32 dmu_guid;struct pmc_info *regmap_list;const struct pmc_reg_map *map; +const struct file_operations *sub_req_show;void (*suspend)(struct pmc_dev *pmcdev);int (*resume)(struct pmc_dev *pmcdev);int (*init)(struct pmc_dev *pmcdev,struct pmc_dev_info *pmc_dev_info); +int (*sub_req)(struct pmc_dev *pmcdev,struct pmc *pmc,struct telem_endpoint *ep); };extern const struct pmc_bit_map msr_map[];
@@ -542,6 +550,12 @@ extern struct pmc_dev_info wcl_pmc_dev;void cnl_suspend (struct pmc_dev *pmcdev);int cnl_resume (struct pmc_dev *pmcdev); +int pmc_core_pmt_get_lpm_req (struct pmc_dev *pmcdev,struct pmc *pmc,struct telem_endpoint *ep); +int pmc_core_pmt_get_blk_sub_req (struct pmc_dev *pmcdev,struct pmc *pmc, +struct telem_endpoint *ep); + +extern const struct file_operations pmc_core_substate_req_regs_fops; +extern const struct file_operations pmc_core_substate_blk_req_fops;#define pmc_for_each_mode (mode, pmcdev) \ for (unsigned int __i = 0, __cond; \
drivers/platform/x86/intel/pmc/lnl.c +2 -0
@@ -574,7 +574,9 @@ struct pmc_dev_info lnl_pmc_dev = { .pci_func = 2, .regmap_list = lnl_pmc_info_list, .map = &lnl_socm_reg_map, + .sub_req_show = &pmc_core_substate_req_regs_fops, .suspend = cnl_suspend, .resume = lnl_resume, .init = lnl_core_init, + .sub_req = pmc_core_pmt_get_lpm_req, };
drivers/platform/x86/intel/pmc/mtl.c +2 -0
@@ -997,7 +997,9 @@ struct pmc_dev_info mtl_pmc_dev = { .dmu_guid = MTL_PMT_DMU_GUID, .regmap_list = mtl_pmc_info_list, .map = &mtl_socm_reg_map, + .sub_req_show = &pmc_core_substate_req_regs_fops, .suspend = cnl_suspend, .resume = mtl_resume, .init = mtl_core_init, + .sub_req = pmc_core_pmt_get_lpm_req, };
Signature · 1 line
2.43.0
Xi Pardee
maintainerPATCH v4 5/5 platform/x86:intel/pmc: Enable SSRAM support for Panther Lake
In reply to Xi PardeeEnable Panther Lake platforms to achieve PMC information from Intel PMC SSRAM Telemetry driver and substate requirements data from telemetry region.
--- drivers/platform/x86/intel/pmc/core.h | 2 ++ drivers/platform/x86/intel/pmc/ptl.c | 31 +++++++++++++++++++++++++++ 2 files changed, 33 insertions(+)
drivers/platform/x86/intel/pmc/core.h +2 -0
@@ -297,6 +297,8 @@ enum ppfear_regs {#define PTL_PMC_LTR_CUR_ASLT 0x1C28#define PTL_PMC_LTR_CUR_PLT 0x1C2C#define PTL_PCD_PMC_MMIO_REG_LEN 0x31A8 +#define PTL_NUM_S0IX_BLOCKER 106 +#define PTL_BLK_REQ_OFFSET 55/* Wildcat Lake */ #define WCL_PMC_LTR_RESERVED 0x1B64
drivers/platform/x86/intel/pmc/ptl.c +31 -0
@@ -10,6 +10,17 @@#include "core.h" +/* PMC SSRAM PMT Telemetry GUIDS */ +#define PCDP_LPM_REQ_GUID 0x47179370 + +/* +* Die Mapping to Product. +* Product PCDDie +* PTL-H PCD-H +* PTL-P PCD-P +* PTL-U PCD-P +*/ +static const struct pmc_bit_map ptl_pcdp_pfear_map[] = { {"PMC_0" ,BIT (0 )}, {"FUSE_OSSE" ,BIT (1 )},
@@ -515,6 +526,22 @@ static const struct pmc_reg_map ptl_pcdp_reg_map = { .lpm_live_status_offset = MTL_LPM_LIVE_STATUS_OFFSET, .s0ix_blocker_maps = ptl_pcdp_blk_maps, .s0ix_blocker_offset = LNL_S0IX_BLOCKER_OFFSET, + .num_s0ix_blocker = PTL_NUM_S0IX_BLOCKER, + .blocker_req_offset = PTL_BLK_REQ_OFFSET, +}; + +static struct pmc_info ptl_pmc_info_list[] = { + { + .guid =PCDP_LPM_REQ_GUID , + .devid =PMC_DEVID_PTL_PCDH , + .map = &ptl_pcdp_reg_map, + }, + { + .guid =PCDP_LPM_REQ_GUID , + .devid =PMC_DEVID_PTL_PCDP , + .map = &ptl_pcdp_reg_map, + }, + {} };#define PTL_NPU_PCI_DEV 0xb03e
@@ -543,8 +570,12 @@ static int ptl_core_init(struct pmc_dev *pmcdev, struct pmc_dev_info *pmc_dev_in }struct pmc_dev_info ptl_pmc_dev = { + .pci_func =2 , + .regmap_list = ptl_pmc_info_list, .map = &ptl_pcdp_reg_map, + .sub_req_show = &pmc_core_substate_blk_req_fops, .suspend = cnl_suspend, .resume = ptl_resume, .init = ptl_core_init, + .sub_req = pmc_core_pmt_get_blk_sub_req, };
Signature · 1 line
2.43.0
Ilpo Järvinen
maintainerQuoted 11 lines · Xi Pardee
This series enables SSRAM support, including achieving PMC information, low power mode substate requirements in Lunar Lake and Panther Lake platforms for Intel PMC Core driver. This patch series will not modify the functionality of Intel PMC Core driver in previous platforms.
The first patch enables SSRAM support for Lunar Lake platforms. The next three patches introduces a new table in telemetry region to get substate requirement information for platforms starting from Panther Lake. The last patch enables SSRAM support for Panther Lake platforms.
[...]
Thank you for your contribution, it has been applied to my local review-ilpo-next branch. Note it will show up in the public platform-drivers-x86/review-ilpo-next branch only once I've pushed my local branch there, which might take a while.
The list of commits applied:
[1/5] platform/x86:intel/pmc: Enable SSRAM support for Lunar Lake
commit: feae929d8e6cb4e8d78a930c8b75326229e6b921
[2/5] platform/x86:intel/pmc: Move telemetry endpoint register handling
commit: 1e508af6bc4b24a7924b619800f1b138281f0e82
[3/5] platform/x86:intel/pmc: Improve function to show substate header
commit: 612326e0a87a5c75d35146ee172eb46bcd09089a
[4/5] platform/x86:intel/pmc: Show substate requirement for S0ix blockers
commit: a22bc8643889ef5a3c032700f69001fdc457413c
[5/5] platform/x86:intel/pmc: Enable SSRAM support for Panther Lake
commit: 8e54e493c9926105e771873b151d5eba80fbb856--
i.