Skip to contentSkip to conversation

Show Lunar Lake S0ix blocker counter in PMC Core

PATCH In review Xi Pardee 2 participants 5 messages Apr 26, 2024 – Apr 29, 2024

Subsystems (2)
lore
Share & tools
lore

Xi Pardee

author maintainer
#0 lore raw

cover Show Lunar Lake S0ix blocker counter in PMC Core

This patch series adds support to show S0ix blocker counter values in debugfs and enables it in Lunar Lake platforms.

Xi Pardee (3):
platform/x86:intel/pmc: Update LNL signal status map platform/x86:intel/pmc: Add support to show S0ix blocker counter platform/x86:intel/pmc: Enable S0ix blocker show in Lunar Lake

 drivers/platform/x86/intel/pmc/core.c |  38 +++
 drivers/platform/x86/intel/pmc/core.h |   9 +
 drivers/platform/x86/intel/pmc/lnl.c  | 475 ++++++++++++++------------
 3 files changed, 311 insertions(+), 211 deletions(-)
Signature · 1 line
2.34.1
author maintainer
#1 lore raw

PATCH 1/3 platform/x86:intel/pmc: Update LNL signal status map

From: Xi Pardee <[email protected]>

Update Lunar Lake signal status map. This status map has been updated since the map was merged. This patch updates the signal status map to the lastest version.

---
 drivers/platform/x86/intel/pmc/core.h |  1 +
 drivers/platform/x86/intel/pmc/lnl.c  | 22 +++++++++++++++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)
drivers/platform/x86/intel/pmc/core.h +1 -0
index 83504c49a0e3..18ba4f901c10 100644
@@ -537,6 +537,7 @@ extern const struct pmc_bit_map lnl_vnn_misc_status_map[];
 extern const struct pmc_bit_map *lnl_lpm_maps[];
 extern const struct pmc_bit_map lnl_pfear_map[];
 extern const struct pmc_bit_map *ext_lnl_pfear_map[];
+extern const struct pmc_bit_map lnl_signal_status_map[];
 
 /* ARL */
 extern const struct pmc_bit_map arl_socs_ltr_show_map[];
drivers/platform/x86/intel/pmc/lnl.c +21 -1
index ec89e7dda103..82c881653f86 100644
@@ -317,6 +317,26 @@ const struct pmc_bit_map lnl_clocksource_status_map[] = {
 	{}
 };
 
+const struct pmc_bit_map lnl_signal_status_map[] = {
+	{"LSX_Wake0_STS",                BIT(0)},
+	{"LSX_Wake1_STS",                BIT(1)},
+	{"LSX_Wake2_STS",                BIT(2)},
+	{"LSX_Wake3_STS",                BIT(3)},
+	{"LSX_Wake4_STS",                BIT(4)},
+	{"LSX_Wake5_STS",                BIT(5)},
+	{"LSX_Wake6_STS",                BIT(6)},
+	{"LSX_Wake7_STS",                BIT(7)},
+	{"LPSS_Wake0_STS",               BIT(8)},
+	{"LPSS_Wake1_STS",               BIT(9)},
+	{"Int_Timer_SS_Wake0_STS",       BIT(10)},
+	{"Int_Timer_SS_Wake1_STS",       BIT(11)},
+	{"Int_Timer_SS_Wake2_STS",       BIT(12)},
+	{"Int_Timer_SS_Wake3_STS",       BIT(13)},
+	{"Int_Timer_SS_Wake4_STS",       BIT(14)},
+	{"Int_Timer_SS_Wake5_STS",       BIT(15)},
+	{}
+};
+
 const struct pmc_bit_map *lnl_lpm_maps[] = {
 	lnl_clocksource_status_map,
 	lnl_power_gating_status_0_map,
@@ -331,7 +351,7 @@ const struct pmc_bit_map *lnl_lpm_maps[] = {
 	lnl_vnn_req_status_2_map,
 	lnl_vnn_req_status_3_map,
 	lnl_vnn_misc_status_map,
-	mtl_socm_signal_status_map,
+	lnl_signal_status_map,
 	NULL
 };
 
Signature · 1 line
2.34.1
author maintainer
#2 lore raw

PATCH 2/3 platform/x86:intel/pmc: Add support to show S0ix blocker counter

In reply to Xi Pardee

From: Xi Pardee <[email protected]>

S0ix blocker counter is available in PWRM space. Add support to read and show S0ix blocker counter value through debugfs.

---
 drivers/platform/x86/intel/pmc/core.c | 38 +++++++++++++++++++++++++++
 drivers/platform/x86/intel/pmc/core.h |  6 +++++
 2 files changed, 44 insertions(+)
drivers/platform/x86/intel/pmc/core.c +38 -0
index 10c96c1a850a..2ad2f8753e5d 100644
@@ -678,6 +678,41 @@ static int pmc_core_ltr_show(struct seq_file *s, void *unused)
 }
 DEFINE_SHOW_ATTRIBUTE(pmc_core_ltr);
 
+static int pmc_core_s0ix_blocker_show(struct seq_file *s, void *unused)
+{
+	struct pmc_dev *pmcdev = s->private;
+	unsigned int pmcidx;
+
+	for (pmcidx = 0; pmcidx < ARRAY_SIZE(pmcdev->pmcs); pmcidx++) {
+		const struct pmc_bit_map **maps;
+		unsigned int arr_size, r_idx;
+		u32 offset, counter;
+		struct pmc *pmc;
+
+		pmc = pmcdev->pmcs[pmcidx];
+		if (!pmc)
+			continue;
+		maps = pmc->map->s0ix_blocker_maps;
+		offset = pmc->map->s0ix_blocker_offset;
+		arr_size = pmc_core_lpm_get_arr_size(maps);
+
+		for (r_idx = 0; r_idx < arr_size; r_idx++) {
+			const struct pmc_bit_map *map;
+
+			for (map = maps[r_idx]; map->name; map++) {
+				if (!map->blk)
+					continue;
+				counter = pmc_core_reg_read(pmc, offset);
+				seq_printf(s, "PMC%d:%-30s %-30d\n", pmcidx,
+					   map->name, counter);
+				offset += map->blk * S0IX_BLK_SIZE;
+			}
+		}
+	}
+	return 0;
+}
+DEFINE_SHOW_ATTRIBUTE(pmc_core_s0ix_blocker);
+
 static inline u64 adjust_lpm_residency(struct pmc *pmc, u32 offset,
 				       const int lpm_adj_x2)
 {
@@ -1197,6 +1232,9 @@ static void pmc_core_dbgfs_register(struct pmc_dev *pmcdev)
 
 	debugfs_create_file("ltr_show", 0444, dir, pmcdev, &pmc_core_ltr_fops);
 
+	if (primary_pmc->map->s0ix_blocker_maps)
+		debugfs_create_file("s0ix_blocker", 0444, dir, pmcdev, &pmc_core_s0ix_blocker_fops);
+
 	debugfs_create_file("package_cstate_show", 0444, dir, primary_pmc,
 			    &pmc_core_pkgc_fops);
 
drivers/platform/x86/intel/pmc/core.h +6 -0
index 18ba4f901c10..88acfa801b5a 100644
@@ -22,6 +22,7 @@ struct telem_endpoint;
 
 #define PMC_BASE_ADDR_DEFAULT			0xFE000000
 #define MAX_NUM_PMC			3
+#define S0IX_BLK_SIZE			4
 
 /* Sunrise Point Power Management Controller PCI Device ID */
 #define SPT_PMC_PCI_DEVICE_ID			0x9d21
@@ -288,6 +289,7 @@ extern const char *pmc_lpm_modes[];
 struct pmc_bit_map {
 	const char *name;
 	u32 bit_mask;
+	u8 blk;
 };
 
 /**
@@ -298,6 +300,7 @@ struct pmc_bit_map {
  * @pll_sts:		Maps name of PLL to corresponding bit status
  * @slps0_dbg_maps:	Array of SLP_S0_DBG* registers containing debug info
  * @ltr_show_sts:	Maps PCH IP Names to their MMIO register offsets
+ * @s0ix_blocker_maps:	Maps name of IP block to S0ix blocker counter
  * @slp_s0_offset:	PWRMBASE offset to read SLP_S0 residency
  * @ltr_ignore_offset:	PWRMBASE offset to read/write LTR ignore bit
  * @regmap_length:	Length of memory to map from PWRMBASE address to access
@@ -307,6 +310,7 @@ struct pmc_bit_map {
  * @pm_cfg_offset:	PWRMBASE offset to PM_CFG register
  * @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
  *
  * Each PCH has unique set of register offsets and bit indexes. This structure
  * captures them to have a common implementation.
@@ -319,6 +323,7 @@ struct pmc_reg_map {
 	const struct pmc_bit_map *ltr_show_sts;
 	const struct pmc_bit_map *msr_sts;
 	const struct pmc_bit_map **lpm_sts;
+	const struct pmc_bit_map **s0ix_blocker_maps;
 	const u32 slp_s0_offset;
 	const int slp_s0_res_counter_step;
 	const u32 ltr_ignore_offset;
@@ -330,6 +335,7 @@ struct pmc_reg_map {
 	const u32 slps0_dbg_offset;
 	const u32 ltr_ignore_max;
 	const u32 pm_vric1_offset;
+	const u32 s0ix_blocker_offset;
 	/* Low Power Mode registers */
 	const int lpm_num_maps;
 	const int lpm_num_modes;
Signature · 1 line
2.34.1
author maintainer
#3 lore raw

PATCH 3/3 platform/x86:intel/pmc: Enable S0ix blocker show in Lunar Lake

In reply to Xi Pardee

From: Xi Pardee <[email protected]>

Update Lunar Lake lpm maps to include S0ix blocker information. Add Lunar Lake blocker maps to enable S0ix blocker show in pmc core debugfs.

---
 drivers/platform/x86/intel/pmc/core.h |   2 +
 drivers/platform/x86/intel/pmc/lnl.c  | 485 ++++++++++++++------------
 2 files changed, 261 insertions(+), 226 deletions(-)
drivers/platform/x86/intel/pmc/core.h +2 -0
index 88acfa801b5a..ea04de7eb9e8 100644
@@ -283,6 +283,7 @@ enum ppfear_regs {
 #define LNL_PMC_LTR_OSSE			0x1B88
 #define LNL_NUM_IP_IGN_ALLOWED			27
 #define LNL_PPFEAR_NUM_ENTRIES			12
+#define LNL_S0IX_BLOCKER_OFFSET			0x2004
 
 extern const char *pmc_lpm_modes[];
 
@@ -541,6 +542,7 @@ extern const struct pmc_bit_map lnl_vnn_req_status_2_map[];
 extern const struct pmc_bit_map lnl_vnn_req_status_3_map[];
 extern const struct pmc_bit_map lnl_vnn_misc_status_map[];
 extern const struct pmc_bit_map *lnl_lpm_maps[];
+extern const struct pmc_bit_map *lnl_blk_maps[];
 extern const struct pmc_bit_map lnl_pfear_map[];
 extern const struct pmc_bit_map *ext_lnl_pfear_map[];
 extern const struct pmc_bit_map lnl_signal_status_map[];
drivers/platform/x86/intel/pmc/lnl.c +259 -226

555 lines not on this page · raw message

Signature · 1 line
2.34.1
#4 lore raw
In reply to Xi Pardee

Hi,

Quoted 7 lines · Xi Pardee

This patch series adds support to show S0ix blocker counter values in debugfs and enables it in Lunar Lake platforms.

Xi Pardee (3):
platform/x86:intel/pmc: Update LNL signal status map platform/x86:intel/pmc: Add support to show S0ix blocker counter platform/x86:intel/pmc: Enable S0ix blocker show in Lunar Lake

Thank you for your patch-series, I've applied the series to my review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be added to the platform-drivers-x86/for-next branch and eventually will be included in the pdx86 pull-request to Linus for the next merge-window.

Regards,

Hans

Quoted 6 lines
 drivers/platform/x86/intel/pmc/core.c |  38 +++
 drivers/platform/x86/intel/pmc/core.h |   9 +
 drivers/platform/x86/intel/pmc/lnl.c  | 475 ++++++++++++++------------
 3 files changed, 311 insertions(+), 211 deletions(-)