From nobody Sat Feb 7 17:54:40 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 807DF35966; Thu, 8 Jan 2026 22:31:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767911509; cv=none; b=bZeX30UFrTJEafDcXtpDOVXMfrwUgatb81Rg04zeadmXyYheaFE23y/IHSt2UcESel1/XQmrO/IALds0Zkv62X0WuHRZkiQ/skbVLade6nZgw2v5zOeHFQLG2kZ9aKgjwOI5KVSSYBLqZgDm9RLuJ4yg6CYi8QiQuzwU0HEaF4A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767911509; c=relaxed/simple; bh=+cpqOpKKayvNELwmB46zus2fqxt9ZvIEwZvPVnAPvZM=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=o9E1ZPc2EiJZlhFhYl8iD5rT896JX0yrnXbZKjETMaOiO3YFc64AuSDswHvdLtaFnXfDSsxYwbi4Hflty7+Ccs7og+lxvuZ0xnvKBXwMwkr1ZVVUMcVjtETiMQU2WqsUdtaz1a0ckVp8vpudnmOqznRvxX2yXwhiin74YKGDAPU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=eftQSMiz; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="eftQSMiz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1767911508; x=1799447508; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=+cpqOpKKayvNELwmB46zus2fqxt9ZvIEwZvPVnAPvZM=; b=eftQSMizrEUa+WCHgvSlNuxS7pducxpri1UlMyvGPhqQFggdJ3L7rx9n GgqPnyQWvUUzWW+Dztjgwhr86RkM561ZSSmEMAARIhft+L/eigg13WR+4 FC025gsthqHTjwaGZi42QdPJfAxt3/3jbJhYNKT60w8CzWMaa5XcugN6V I1eCmco082ePerxzFLsYsBvKm5kRxnxthN7r+zHFLeYd+qEREcvBtCpd1 nKYC4NkZgtslWLWgA2sCOtHGpsSWUxYwjUHeMUTzsp2P3Y0htx40zOHaK 8MX49EfJJxmN5lLGAcGrrxYKcDVmNoHrleMGQwu5Ak2KWz5mIZGpafwVY Q==; X-CSE-ConnectionGUID: gGrqI3WgQaS0XqpSdkxnDQ== X-CSE-MsgGUID: BmrAa9ktQfaVl/eUFB1vvg== X-IronPort-AV: E=McAfee;i="6800,10657,11665"; a="69349134" X-IronPort-AV: E=Sophos;i="6.21,211,1763452800"; d="scan'208";a="69349134" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2026 14:31:47 -0800 X-CSE-ConnectionGUID: azXCWjoNT8S30FrFDwY1xA== X-CSE-MsgGUID: f1oHu6qQQ8uabjgMWh4TTg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,211,1763452800"; d="scan'208";a="207797171" Received: from msatwood-mobl.amr.corp.intel.com (HELO xpardee-desk.lan) ([10.125.109.238]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2026 14:31:47 -0800 From: Xi Pardee To: xi.pardee@linux.intel.com, irenic.rajneesh@gmail.com, david.e.box@linux.intel.com, ilpo.jarvinen@linux.intel.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v2 1/4] platform/x86/intel/pmc: Change LPM mode fields to u8 Date: Thu, 8 Jan 2026 14:31:39 -0800 Message-ID: <20260108223144.504267-2-xi.pardee@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260108223144.504267-1-xi.pardee@linux.intel.com> References: <20260108223144.504267-1-xi.pardee@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Change the datatypes of num_lpm_modes and lpm_en_modes[] from int to u8. The u8 type is more appropriate and improves the readability and maintainability of the code. Signed-off-by: Xi Pardee --- drivers/platform/x86/intel/pmc/core.c | 23 +++++++++++++---------- drivers/platform/x86/intel/pmc/core.h | 4 ++-- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/i= ntel/pmc/core.c index 7d7ae8a40b0ec..c55149f226671 100644 --- a/drivers/platform/x86/intel/pmc/core.c +++ b/drivers/platform/x86/intel/pmc/core.c @@ -779,7 +779,7 @@ static int pmc_core_substate_res_show(struct seq_file *= s, void *unused) struct pmc *pmc =3D pmcdev->pmcs[PMC_IDX_MAIN]; const int lpm_adj_x2 =3D pmc->map->lpm_res_counter_step_x2; u32 offset =3D pmc->map->lpm_residency_offset; - int mode; + u8 mode; =20 seq_printf(s, "%-10s %-15s\n", "Substate", "Residency"); =20 @@ -838,7 +838,7 @@ static void pmc_core_substate_req_header_show(struct se= q_file *s, int pmc_index, enum header_type type) { struct pmc_dev *pmcdev =3D s->private; - int mode; + u8 mode; =20 seq_printf(s, "%40s |", "Element"); pmc_for_each_mode(mode, pmcdev) @@ -880,7 +880,7 @@ static int pmc_core_substate_blk_req_show(struct seq_fi= le *s, void *unused) const struct pmc_bit_map *map; =20 for (map =3D maps[r_idx]; map->name; map++) { - int mode; + u8 mode; =20 if (!map->blk) continue; @@ -953,7 +953,8 @@ static int pmc_core_substate_req_regs_show(struct seq_f= ile *s, void *unused) u32 lpm_status; u32 lpm_status_live; const struct pmc_bit_map *map; - int mode, i, len =3D 32; + int i, len =3D 32; + u8 mode; =20 /* * Capture the requirements and create a mask so that we only @@ -1065,7 +1066,7 @@ static int pmc_core_lpm_latch_mode_show(struct seq_fi= le *s, void *unused) struct pmc *pmc =3D pmcdev->pmcs[PMC_IDX_MAIN]; bool c10; u32 reg; - int mode; + u8 mode; =20 reg =3D pmc_core_reg_read(pmc, pmc->map->lpm_sts_latch_en_offset); if (reg & LPM_STS_LATCH_MODE) { @@ -1097,8 +1098,9 @@ static ssize_t pmc_core_lpm_latch_mode_write(struct f= ile *file, struct pmc *pmc =3D pmcdev->pmcs[PMC_IDX_MAIN]; bool clear =3D false, c10 =3D false; unsigned char buf[8]; - int m, mode; + int mode; u32 reg; + u8 m; =20 if (count > sizeof(buf) - 1) return -EINVAL; @@ -1218,8 +1220,9 @@ void pmc_core_get_low_power_modes(struct pmc_dev *pmc= dev) u8 mode_order[LPM_MAX_NUM_MODES]; u32 lpm_pri; u32 lpm_en; + u8 mode; unsigned int i; - int mode, p; + int p; =20 /* Use LPM Maps to indicate support for substates */ if (!pmc->map->lpm_num_maps) @@ -1254,7 +1257,7 @@ void pmc_core_get_low_power_modes(struct pmc_dev *pmc= dev) */ i =3D 0; for (p =3D LPM_MAX_NUM_MODES - 1; p >=3D 0; p--) { - int mode =3D pri_order[p]; + u8 mode =3D pri_order[p]; =20 if (!(BIT(mode) & lpm_en)) continue; @@ -1490,8 +1493,8 @@ int pmc_core_pmt_get_lpm_req(struct pmc_dev *pmcdev, = struct pmc *pmc, struct tel { const u8 *lpm_indices; int num_maps, mode_offset =3D 0; - int ret, mode; - int lpm_size; + int ret, lpm_size; + u8 mode; =20 lpm_indices =3D pmc->map->lpm_reg_index; num_maps =3D pmc->map->lpm_num_maps; diff --git a/drivers/platform/x86/intel/pmc/core.h b/drivers/platform/x86/i= ntel/pmc/core.h index 272fb4f57f346..ead2f33ed3ed5 100644 --- a/drivers/platform/x86/intel/pmc/core.h +++ b/drivers/platform/x86/intel/pmc/core.h @@ -462,8 +462,8 @@ struct pmc_dev { struct mutex lock; /* generic mutex lock for PMC Core */ =20 u64 s0ix_counter; - int num_lpm_modes; - int lpm_en_modes[LPM_MAX_NUM_MODES]; + u8 num_lpm_modes; + u8 lpm_en_modes[LPM_MAX_NUM_MODES]; void (*suspend)(struct pmc_dev *pmcdev); int (*resume)(struct pmc_dev *pmcdev); =20 --=20 2.43.0 From nobody Sat Feb 7 17:54:40 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 222772E973F; Thu, 8 Jan 2026 22:31:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767911510; cv=none; b=Rkujc3oX8Yfd69+S+t+VykbR4Yj9n/x38ByVQsWDjNpVoeqVDjBZVDSCWx+bQHeTlO7rqisQynpnL2C+Aey7B5raDQr4bVNXpYAOC7XZRwzElmkP4XltAIniIs8Tx7QLe24k/xnn03DWsfwoIBJs3Om3Bb90azb3z1HppTXnIHI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767911510; c=relaxed/simple; bh=yXdkyC8ZjhsGMWMvsZyF6u/4aSt8tGYQfJlG06s5240=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t/rHalZFe6FqMokcweTEkkTIOMMFZS1WWeRnWaCSASBlgeJ6jjuz5gzGwmFLwxtbIdzpFygOt+kF8zM2azjjvBhozwbMVUoCKHAMx8g3WmXDHKN49NS0LLD6vBPfaeefJDYi1ALVVNxTwCe7sDGmPuHq7ltH29lusepMPDCl/9k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=nlel49vv; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="nlel49vv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1767911509; x=1799447509; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=yXdkyC8ZjhsGMWMvsZyF6u/4aSt8tGYQfJlG06s5240=; b=nlel49vvJBHX+VDkDQQ3lInTCGBWgQv0ofFsD6IzVgZWzuix28LYoFVI /huei02OkV8qIcRnnMweYNs5GHtzpRRTF/vn9yUqt/x7NYI5oc8gB6Vsw pUYoJfSnh9/YJmUXdb9wxvyDt5CyzH4Ml8NNuqY/T0g8wKvPuDvts2OyM xG+VzKz4Yf5qWV3cueYLr2S25hZINvnaL3gD9yoR+uMb0H5KL6H3LF3YK RyGGEo0uE3ELQ0ahUxUvyGsVA0o4FX9ML1Yy/T9tq189g/LGPGYhkGYN0 76uNhgEr8wLSB5sIlY+H6xwJmj1xN3YQW1rOqi9hRQcmUlPw68IfH1Ce3 Q==; X-CSE-ConnectionGUID: 1CDT8+weTHa7ToW247kDlQ== X-CSE-MsgGUID: 4quApq1qTwy80MAL9M6eJA== X-IronPort-AV: E=McAfee;i="6800,10657,11665"; a="69349136" X-IronPort-AV: E=Sophos;i="6.21,211,1763452800"; d="scan'208";a="69349136" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2026 14:31:48 -0800 X-CSE-ConnectionGUID: kpt9VBKyScuTB2BLa8Kzgw== X-CSE-MsgGUID: iwibe7sGRquERPJdV+F2HA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,211,1763452800"; d="scan'208";a="207797172" Received: from msatwood-mobl.amr.corp.intel.com (HELO xpardee-desk.lan) ([10.125.109.238]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2026 14:31:47 -0800 From: Xi Pardee To: xi.pardee@linux.intel.com, irenic.rajneesh@gmail.com, david.e.box@linux.intel.com, ilpo.jarvinen@linux.intel.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v2 2/4] platform/x86/intel/pmc: Move LPM mode attributes to PMC Date: Thu, 8 Jan 2026 14:31:40 -0800 Message-ID: <20260108223144.504267-3-xi.pardee@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260108223144.504267-1-xi.pardee@linux.intel.com> References: <20260108223144.504267-1-xi.pardee@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Move LPM modes attributes from the pmc_dev to the pmc structure. LPM modes are PMC-specific and should be stored within the pmc structure. After the change, LPM mode information will be retrieved and stored per PMC. The substate_requirements attribute in debugfs will display the requirements for each enabled LPM substate. Signed-off-by: Xi Pardee --- drivers/platform/x86/intel/pmc/core.c | 39 ++++++++++++++++++--------- drivers/platform/x86/intel/pmc/core.h | 15 +++++------ 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/i= ntel/pmc/core.c index c55149f226671..c76934ad7bf1d 100644 --- a/drivers/platform/x86/intel/pmc/core.c +++ b/drivers/platform/x86/intel/pmc/core.c @@ -783,7 +783,7 @@ static int pmc_core_substate_res_show(struct seq_file *= s, void *unused) =20 seq_printf(s, "%-10s %-15s\n", "Substate", "Residency"); =20 - pmc_for_each_mode(mode, pmcdev) { + pmc_for_each_mode(mode, pmc) { seq_printf(s, "%-10s %-15llu\n", pmc_lpm_modes[mode], adjust_lpm_residency(pmc, offset + (4 * mode), lpm_adj_x2)); } @@ -838,10 +838,11 @@ static void pmc_core_substate_req_header_show(struct = seq_file *s, int pmc_index, enum header_type type) { struct pmc_dev *pmcdev =3D s->private; + struct pmc *pmc =3D pmcdev->pmcs[pmc_index]; u8 mode; =20 seq_printf(s, "%40s |", "Element"); - pmc_for_each_mode(mode, pmcdev) + pmc_for_each_mode(mode, pmc) seq_printf(s, " %9s |", pmc_lpm_modes[mode]); =20 if (type =3D=3D HEADER_STATUS) { @@ -887,7 +888,7 @@ static int pmc_core_substate_blk_req_show(struct seq_fi= le *s, void *unused) =20 counter =3D pmc_core_reg_read(pmc, offset); seq_printf(s, "pmc%u: %34s |", pmc_idx, map->name); - pmc_for_each_mode(mode, pmcdev) { + pmc_for_each_mode(mode, pmc) { bool required =3D *lpm_req_regs & BIT(mode); =20 seq_printf(s, " %9s |", required ? "Required" : " "); @@ -961,7 +962,7 @@ static int pmc_core_substate_req_regs_show(struct seq_f= ile *s, void *unused) * show an element if it's required for at least one of the * enabled low power modes */ - pmc_for_each_mode(mode, pmcdev) + pmc_for_each_mode(mode, pmc) req_mask |=3D lpm_req_regs[mp + (mode * num_maps)]; =20 /* Get the last latched status for this map */ @@ -987,7 +988,7 @@ static int pmc_core_substate_req_regs_show(struct seq_f= ile *s, void *unused) seq_printf(s, "pmc%d: %34s |", pmc_idx, map[i].name); =20 /* Loop over the enabled states and display if required */ - pmc_for_each_mode(mode, pmcdev) { + pmc_for_each_mode(mode, pmc) { bool required =3D lpm_req_regs[mp + (mode * num_maps)] & bit_mask; seq_printf(s, " %9s |", required ? "Required" : " "); @@ -1077,7 +1078,7 @@ static int pmc_core_lpm_latch_mode_show(struct seq_fi= le *s, void *unused) c10 =3D true; } =20 - pmc_for_each_mode(mode, pmcdev) { + pmc_for_each_mode(mode, pmc) { if ((BIT(mode) & reg) && !c10) seq_printf(s, " [%s]", pmc_lpm_modes[mode]); else @@ -1117,7 +1118,7 @@ static ssize_t pmc_core_lpm_latch_mode_write(struct f= ile *file, mode =3D sysfs_match_string(pmc_lpm_modes, buf); =20 /* Check string matches enabled mode */ - pmc_for_each_mode(m, pmcdev) + pmc_for_each_mode(m, pmc) if (mode =3D=3D m) break; =20 @@ -1213,9 +1214,8 @@ static bool pmc_core_pri_verify(u32 lpm_pri, u8 *mode= _order) return true; } =20 -void pmc_core_get_low_power_modes(struct pmc_dev *pmcdev) +static void pmc_core_pmc_get_low_power_modes(struct pmc_dev *pmcdev, struc= t pmc *pmc) { - struct pmc *pmc =3D pmcdev->pmcs[PMC_IDX_MAIN]; u8 pri_order[LPM_MAX_NUM_MODES] =3D LPM_DEFAULT_PRI; u8 mode_order[LPM_MAX_NUM_MODES]; u32 lpm_pri; @@ -1233,7 +1233,7 @@ void pmc_core_get_low_power_modes(struct pmc_dev *pmc= dev) * Lower byte is enough to cover the number of lpm modes for all * platforms and hence mask the upper 3 bytes. */ - pmcdev->num_lpm_modes =3D hweight32(lpm_en & 0xFF); + pmc->num_lpm_modes =3D hweight32(lpm_en & 0xFF); =20 /* Read 32 bit LPM_PRI register */ lpm_pri =3D pmc_core_reg_read(pmc, pmc->map->lpm_priority_offset); @@ -1262,7 +1262,22 @@ void pmc_core_get_low_power_modes(struct pmc_dev *pm= cdev) if (!(BIT(mode) & lpm_en)) continue; =20 - pmcdev->lpm_en_modes[i++] =3D mode; + pmc->lpm_en_modes[i++] =3D mode; + } +} + +static void pmc_core_get_low_power_modes(struct pmc_dev *pmcdev) +{ + unsigned int pmc_idx; + + for (pmc_idx =3D 0; pmc_idx < ARRAY_SIZE(pmcdev->pmcs); pmc_idx++) { + struct pmc *pmc; + + pmc =3D pmcdev->pmcs[pmc_idx]; + if (!pmc) + continue; + + pmc_core_pmc_get_low_power_modes(pmcdev, pmc); } } =20 @@ -1507,7 +1522,7 @@ int pmc_core_pmt_get_lpm_req(struct pmc_dev *pmcdev, = struct pmc *pmc, struct tel return -ENOMEM; =20 mode_offset =3D LPM_HEADER_OFFSET + LPM_MODE_OFFSET; - pmc_for_each_mode(mode, pmcdev) { + pmc_for_each_mode(mode, pmc) { u32 *req_offset =3D pmc->lpm_req_regs + (mode * num_maps); int m; =20 diff --git a/drivers/platform/x86/intel/pmc/core.h b/drivers/platform/x86/i= ntel/pmc/core.h index ead2f33ed3ed5..118c8740ad3aa 100644 --- a/drivers/platform/x86/intel/pmc/core.h +++ b/drivers/platform/x86/intel/pmc/core.h @@ -423,6 +423,8 @@ struct pmc_info { * specific attributes * @lpm_req_regs: List of substate requirements * @ltr_ign: Holds LTR ignore data while suspended + * @num_lpm_modes: Count of enabled modes + * @lpm_en_modes: Array of enabled modes from lowest to highest priority * * pmc contains info about one power management controller device. */ @@ -432,6 +434,8 @@ struct pmc { const struct pmc_reg_map *map; u32 *lpm_req_regs; u32 ltr_ign; + u8 num_lpm_modes; + u8 lpm_en_modes[LPM_MAX_NUM_MODES]; }; =20 /** @@ -446,8 +450,6 @@ struct pmc { * @pkgc_res_cnt: Array of PKGC residency counters * @num_of_pkgc: Number of PKGC * @s0ix_counter: S0ix residency (step adjusted) - * @num_lpm_modes: Count of enabled modes - * @lpm_en_modes: Array of enabled modes from lowest to highest priority * @suspend: Function to perform platform specific suspend * @resume: Function to perform platform specific resume * @@ -462,8 +464,6 @@ struct pmc_dev { struct mutex lock; /* generic mutex lock for PMC Core */ =20 u64 s0ix_counter; - u8 num_lpm_modes; - u8 lpm_en_modes[LPM_MAX_NUM_MODES]; void (*suspend)(struct pmc_dev *pmcdev); int (*resume)(struct pmc_dev *pmcdev); =20 @@ -535,7 +535,6 @@ int pmc_core_send_ltr_ignore(struct pmc_dev *pmcdev, u3= 2 value, int ignore); =20 int pmc_core_resume_common(struct pmc_dev *pmcdev); int get_primary_reg_base(struct pmc *pmc); -void pmc_core_get_low_power_modes(struct pmc_dev *pmcdev); void pmc_core_punit_pmt_init(struct pmc_dev *pmcdev, u32 *guids); void pmc_core_set_device_d3(unsigned int device); =20 @@ -563,10 +562,10 @@ int pmc_core_pmt_get_blk_sub_req(struct pmc_dev *pmcd= ev, struct pmc *pmc, extern const struct file_operations pmc_core_substate_req_regs_fops; extern const struct file_operations pmc_core_substate_blk_req_fops; =20 -#define pmc_for_each_mode(mode, pmcdev) \ +#define pmc_for_each_mode(mode, pmc) \ for (unsigned int __i =3D 0, __cond; \ - __cond =3D __i < (pmcdev)->num_lpm_modes, \ - __cond && ((mode) =3D (pmcdev)->lpm_en_modes[__i]), \ + __cond =3D __i < (pmc)->num_lpm_modes, \ + __cond && ((mode) =3D (pmc)->lpm_en_modes[__i]), \ __cond; \ __i++) =20 --=20 2.43.0 From nobody Sat Feb 7 17:54:40 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C7543328B47; Thu, 8 Jan 2026 22:31:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767911517; cv=none; b=LZ7LkeAgypcCNLoakonmyRcZDA71qYmwxWTm6ABA9VM2a9tkBi8HtXAdvVNL+KDgod1nX3teRhLi4BCU687sX2ubZGaa9SygN6TdD8Af1ZGT6R8WyVv2YdskluHA3VkdKYRD76MnFKG4f6k54ILqWrW0U0AgUmCPgmXE2b3ePOU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767911517; c=relaxed/simple; bh=0lBEK4teYjecOWHdNu31/h/DoDfdjToKVpoAzDUe6g8=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=i+nLqjdZyJYMXZFc/2l+4W0WSQMt8UnH37o4o6f6Ck7pBJM9FY/VjpiIaOES7PGgvp5lZw8otc97rAQPc3aNcj6RHTKIk0Mch2dkq7l9HvUpWZJd/cbtUC0KLvH63vCEWfLnY+W3EyAOGtnQLlY11qeIaOIH4YoP8Dk5vWWj1HA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=S1hVunBA; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="S1hVunBA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1767911509; x=1799447509; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=0lBEK4teYjecOWHdNu31/h/DoDfdjToKVpoAzDUe6g8=; b=S1hVunBA0CHrcMSHoAoC35eRlnvGhDCePeISzf2uc33heGo05aiUMbNd QPeaTKpTZFRRuPwdWTWbA9I3g7k7krw8BUvR+TR0xW+wRqKiN4z3dhVWN q3q+ZhRSZIaxJuri/yXlI/sTRCkdG9oE4IoyNEkBRKdLq+OHSIrjIQtTB utkl/4Ga5HDRG4d9MWDj4X3W72PPD4SupZuDedgKo7hVMd+pzuYXHTxDt 96E6QSY8bu69BEVz5HMeUqXvtrQ3F8RbFFK+BAvqHRaJraTN3Yy72VnTg PpHxI4pPHKRKcvsPd+PDcFDBlGIOKiMA4/xkAVFPthOktj6bF8qJ+v7zy w==; X-CSE-ConnectionGUID: Kx17tRxrS/WOINhqcL97sA== X-CSE-MsgGUID: 6CyF9u/kSp6ZAtnPw+gj7A== X-IronPort-AV: E=McAfee;i="6800,10657,11665"; a="69349138" X-IronPort-AV: E=Sophos;i="6.21,211,1763452800"; d="scan'208";a="69349138" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2026 14:31:48 -0800 X-CSE-ConnectionGUID: Qtq3saRGT92ESmSln7rsjQ== X-CSE-MsgGUID: tA4wN3dISQGUDVuG3805jg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,211,1763452800"; d="scan'208";a="207797173" Received: from msatwood-mobl.amr.corp.intel.com (HELO xpardee-desk.lan) ([10.125.109.238]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2026 14:31:48 -0800 From: Xi Pardee To: xi.pardee@linux.intel.com, irenic.rajneesh@gmail.com, david.e.box@linux.intel.com, ilpo.jarvinen@linux.intel.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v2 3/4] platform/x86/intel/pmc: Enable substate residencies for multiple PMCs Date: Thu, 8 Jan 2026 14:31:41 -0800 Message-ID: <20260108223144.504267-4-xi.pardee@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260108223144.504267-1-xi.pardee@linux.intel.com> References: <20260108223144.504267-1-xi.pardee@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Enable substate residencies support for multiple PMCs. Previously substate residencies were shown only for the primary PMC. This change enables substate residencies for all available PMCs. The output of substate_residencies with this patch will be similar to this: pmc0 Substate Residency S0i2.0 0 S0i2.1 0 S0i2.2 0 pmc1 Substate Residency S0i2.0 0 S0i2.1 0 S0i2.2 0 pmc2 Substate Residency S0i2.0 0 Signed-off-by: Xi Pardee --- drivers/platform/x86/intel/pmc/core.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/i= ntel/pmc/core.c index c76934ad7bf1d..e16f9630b908c 100644 --- a/drivers/platform/x86/intel/pmc/core.c +++ b/drivers/platform/x86/intel/pmc/core.c @@ -776,16 +776,26 @@ static inline u64 adjust_lpm_residency(struct pmc *pm= c, u32 offset, static int pmc_core_substate_res_show(struct seq_file *s, void *unused) { struct pmc_dev *pmcdev =3D s->private; - struct pmc *pmc =3D pmcdev->pmcs[PMC_IDX_MAIN]; - const int lpm_adj_x2 =3D pmc->map->lpm_res_counter_step_x2; - u32 offset =3D pmc->map->lpm_residency_offset; - u8 mode; + unsigned int pmc_idx; + + for (pmc_idx =3D 0; pmc_idx < ARRAY_SIZE(pmcdev->pmcs); ++pmc_idx) { + int lpm_adj_x2; + struct pmc *pmc; + u32 offset; + u8 mode; =20 - seq_printf(s, "%-10s %-15s\n", "Substate", "Residency"); + pmc =3D pmcdev->pmcs[pmc_idx]; + if (!pmc) + continue; =20 - pmc_for_each_mode(mode, pmc) { - seq_printf(s, "%-10s %-15llu\n", pmc_lpm_modes[mode], - adjust_lpm_residency(pmc, offset + (4 * mode), lpm_adj_x2)); + lpm_adj_x2 =3D pmc->map->lpm_res_counter_step_x2; + offset =3D pmc->map->lpm_residency_offset; + + seq_printf(s, "pmc%u %10s %15s\n", pmc_idx, "Substate", "Residency"); + pmc_for_each_mode(mode, pmc) { + seq_printf(s, "%15s %15llu\n", pmc_lpm_modes[mode], + adjust_lpm_residency(pmc, offset + (4 * mode), lpm_adj_x2)); + } } =20 return 0; --=20 2.43.0 From nobody Sat Feb 7 17:54:40 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 01C2432B990; Thu, 8 Jan 2026 22:31:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767911518; cv=none; b=f8w0akDfEHZ0d7lNVV75IWDEjSuZwGA1TQFBxWEQZ/DO64Tk2tYWIA6uDhqopr5HM9rNtRHWhFmWSYlh1fT4xr9UkRR03iJi29IpLUoq1yglA5TM5ZVYMqg72QPGQCtSw2FZ/XOQ+EWU/R4EZzRSjgxTJhTAbv82vylzb0Rv0o0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767911518; c=relaxed/simple; bh=MKd68gLvofFlcm/e7KLTW6rtgDAnj+NN2mRzNd+Vn4U=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qxv4HU/udicN3X8w8SQig3Oesrs/gTdg+PioxpGXFYUz027xZ3L5eyAGWGD5CzTpPJYxOcYlLePAMWPAcWLQjqU9jbVGXfwGAqeCrh3OQTifVPhRgx2Ulv3moesF28MzdDgi/yYuVcd1luIFyZ2PulkRk2QykAIrMve/PmHgaaY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Zw6lJFAg; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Zw6lJFAg" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1767911510; x=1799447510; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=MKd68gLvofFlcm/e7KLTW6rtgDAnj+NN2mRzNd+Vn4U=; b=Zw6lJFAg5wI/T6hGR70eBIyDiEYfkgMIaxBGMs0JfwyhHO0Di/FdBLz+ s1moDaKPQKRfCNyBuQZ/GsPV0wyhVRzjhISFbRixQ/gzxmS6BUhLgNiHG LN0Hyz9L0yCTq9SzfyPqdnohZaBE/We+mUshd8kYKaIk8i5T9jFhy6/9x wav0ExtmZKZ1WyjBjdeoCoEWz6iuVLq647kusyLU4oezbomlzh8acPkGg 1Qhd0TD7QSjQzHnhK91O0Q8I99WGk0yMc+lGJDXGaX1ixE3UQoeoNPXKM leyjYxv0+nGrPMFdsw+3a+xfcgGnAy1zdcc+wnaLyyWl0tjy4uAJEEbUM A==; X-CSE-ConnectionGUID: 69o5a7laSFeRJjNB+HLMBQ== X-CSE-MsgGUID: mlwQMg7SS8ejFSUQLo76ig== X-IronPort-AV: E=McAfee;i="6800,10657,11665"; a="69349140" X-IronPort-AV: E=Sophos;i="6.21,211,1763452800"; d="scan'208";a="69349140" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2026 14:31:49 -0800 X-CSE-ConnectionGUID: 00AdFt2NRES7fI5w5tFiPg== X-CSE-MsgGUID: 43u1hqYWRqS0BQhlD9RxDA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,211,1763452800"; d="scan'208";a="207797175" Received: from msatwood-mobl.amr.corp.intel.com (HELO xpardee-desk.lan) ([10.125.109.238]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2026 14:31:49 -0800 From: Xi Pardee To: xi.pardee@linux.intel.com, irenic.rajneesh@gmail.com, david.e.box@linux.intel.com, ilpo.jarvinen@linux.intel.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v2 4/4] platform/x86/intel/pmc: Remove double empty line Date: Thu, 8 Jan 2026 14:31:42 -0800 Message-ID: <20260108223144.504267-5-xi.pardee@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260108223144.504267-1-xi.pardee@linux.intel.com> References: <20260108223144.504267-1-xi.pardee@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Remove double empty line to improve readability. Signed-off-by: Xi Pardee --- drivers/platform/x86/intel/pmc/core.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/i= ntel/pmc/core.c index e16f9630b908c..02b303418d185 100644 --- a/drivers/platform/x86/intel/pmc/core.c +++ b/drivers/platform/x86/intel/pmc/core.c @@ -1248,7 +1248,6 @@ static void pmc_core_pmc_get_low_power_modes(struct p= mc_dev *pmcdev, struct pmc /* Read 32 bit LPM_PRI register */ lpm_pri =3D pmc_core_reg_read(pmc, pmc->map->lpm_priority_offset); =20 - /* * If lpm_pri value passes verification, then override the default * modes here. Otherwise stick with the default. --=20 2.43.0