From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: "Qinyun Tan" <qinyuntan@linux.alibaba.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Hans de Goede" <hansg@kernel.org>
Cc: platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org, xlpang@linux.alibaba.com
Subject: Re: [PATCH] platform/x86/intel/tpmi/plr: Fix CPU selection on partitioned systems
Date: Wed, 25 Nov 2026 09:49:19 -0800 [thread overview]
Message-ID: <39da5f7295537024b97eeca6b567720c117ee002.camel@linux.intel.com> (raw)
In-Reply-To: <20261125092244.3641945-1-qinyuntan@linux.alibaba.com>
On Wed, 2026-11-25 at 17:22 +0800, Qinyun Tan wrote:
> When a package has multiple TPMI partitions, PLR can report the same
> CPUs in more than one partition. For example, on a single-package
> system with 72 logical CPUs and two TPMI partitions, both partitions
> list CPUs 0-35 in their PLR status files. CPUs 36-71 are missing.
>
> Each partition numbers its PLR resources from zero. The driver
> compares
> that index with the CPU's power domain ID from MSR_PM_LOGICAL_ID,
> which
> is unique within the package. As a result, both partitions select the
> same CPUs. A mailbox read or clear on the second partition then uses
> a
> module ID taken from a CPU in the first partition.
>
> Use the partition's cdie_mask to map each PLR resource to its package
> power domain. For compatibility with older platforms, keep using the
> resource index for partition 0 when no mask is available. Skip per-
> CPU
> mailbox accesses if the resource has no valid CPU mapping.
>
> Fixes: 9e9397a41b7b ("platform/x86/intel/tpmi/plr: Add support for
> the plr mailbox")
> Signed-off-by: Qinyun Tan <qinyuntan@linux.alibaba.com>
Hi Tan,
Thank you for submitting this change, similar change was in our queue
waiting to test.
You have moved definition of MAX_POWER_DOMAINS to header file, but this
there is no description of that in the commit description.
If you happen to post update, add that.
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> ---
>
> Notes:
> Tested on a single-package system with 72 logical CPUs and two
> TPMI
> partitions. The PLR status files now list the CPUs belonging to
> each
> partition.
>
> drivers/platform/x86/intel/plr_tpmi.c | 31 ++++++++++++++++-
> --
> .../platform/x86/intel/tpmi_power_domains.c | 2 --
> .../platform/x86/intel/tpmi_power_domains.h | 2 ++
> 3 files changed, 29 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/platform/x86/intel/plr_tpmi.c
> b/drivers/platform/x86/intel/plr_tpmi.c
> index 785c279b4540..33066f4763ef 100644
> --- a/drivers/platform/x86/intel/plr_tpmi.c
> +++ b/drivers/platform/x86/intel/plr_tpmi.c
> @@ -51,7 +51,7 @@ struct tpmi_plr_die {
> void __iomem *base;
> struct mutex lock; /* Protect access to PLR mailbox */
> int package_id;
> - int die_id;
> + int power_domain_id;
> struct tpmi_plr *plr;
> };
>
> @@ -201,10 +201,13 @@ static int plr_status_show(struct seq_file *s,
> void *unused)
> seq_puts(s, "cpus");
> plr_print_bits(s, val, 32);
>
> + if (plr_die->power_domain_id < 0)
> + return 0;
> +
> guard(mutex)(&plr_die->lock);
>
> for (int cpu = 0; cpu < nr_cpu_ids; cpu++) {
> - if (plr_die->die_id !=
> tpmi_get_power_domain_id(cpu))
> + if (plr_die->power_domain_id !=
> tpmi_get_power_domain_id(cpu))
> continue;
>
> if (plr_die->package_id !=
> topology_physical_package_id(cpu))
> @@ -241,10 +244,13 @@ static ssize_t plr_status_write(struct file
> *filp, const char __user *ubuf,
>
> plr_write(0, plr_die, PLR_DIE_LEVEL);
>
> + if (plr_die->power_domain_id < 0)
> + return count;
> +
> guard(mutex)(&plr_die->lock);
>
> for (int cpu = 0; cpu < nr_cpu_ids; cpu++) {
> - if (plr_die->die_id !=
> tpmi_get_power_domain_id(cpu))
> + if (plr_die->power_domain_id !=
> tpmi_get_power_domain_id(cpu))
> continue;
>
> if (plr_die->package_id !=
> topology_physical_package_id(cpu))
> @@ -281,6 +287,23 @@ static void intel_plr_unregister_notifier(struct
> notifier_block *nb)
> tpmi_unregister_notifier(nb);
> }
>
> +static int plr_power_domain_id(const struct oobmsm_plat_info
> *plat_info, int index)
> +{
> + u16 mask = plat_info->cdie_mask;
> + int id = index;
> +
> + /* Resource indices are relative to the partition's first
> compute die. */
> + if (mask)
> + id += __ffs(mask);
> + else if (plat_info->partition)
> + return -ENODEV;
> +
> + if (id >= MAX_POWER_DOMAINS || (mask && !(mask & BIT(id))))
> + return -ENODEV;
> +
> + return id;
> +}
> +
> static int intel_plr_probe(struct auxiliary_device *auxdev, const
> struct auxiliary_device_id *id)
> {
> struct oobmsm_plat_info *plat_info;
> @@ -340,7 +363,7 @@ static int intel_plr_probe(struct
> auxiliary_device *auxdev, const struct auxilia
>
> plr->die_info[i].base = base;
> plr->die_info[i].package_id = plat_info->package_id;
> - plr->die_info[i].die_id = i;
> + plr->die_info[i].power_domain_id =
> plr_power_domain_id(plat_info, i);
> plr->die_info[i].plr = plr;
> mutex_init(&plr->die_info[i].lock);
>
> diff --git a/drivers/platform/x86/intel/tpmi_power_domains.c
> b/drivers/platform/x86/intel/tpmi_power_domains.c
> index ebe052c3bbe4..f6a46b4571ec 100644
> --- a/drivers/platform/x86/intel/tpmi_power_domains.c
> +++ b/drivers/platform/x86/intel/tpmi_power_domains.c
> @@ -70,8 +70,6 @@ static DEFINE_PER_CPU(struct tpmi_cpu_info,
> tpmi_cpu_info);
> /* The dynamically assigned cpu hotplug state to free later */
> static enum cpuhp_state tpmi_hp_state __read_mostly;
>
> -#define MAX_POWER_DOMAINS 8
> -
> static cpumask_t *tpmi_power_domain_mask;
>
> static u16 *domain_die_map;
> diff --git a/drivers/platform/x86/intel/tpmi_power_domains.h
> b/drivers/platform/x86/intel/tpmi_power_domains.h
> index 2fd0dd7afbd2..43a80b526133 100644
> --- a/drivers/platform/x86/intel/tpmi_power_domains.h
> +++ b/drivers/platform/x86/intel/tpmi_power_domains.h
> @@ -10,6 +10,8 @@
>
> #include <linux/cpumask.h>
>
> +#define MAX_POWER_DOMAINS 8
> +
> int tpmi_get_linux_cpu_number(int package_id, int die_id, int
> punit_core_id);
> int tpmi_get_punit_core_number(int cpu_no);
> int tpmi_get_power_domain_id(int cpu_no);
>
> base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
next prev parent reply other threads:[~2026-11-25 17:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 9:22 [PATCH] platform/x86/intel/tpmi/plr: Fix CPU selection on partitioned systems Qinyun Tan
2026-11-25 17:49 ` Srinivas Pandruvada [this message]
2026-11-26 2:00 ` Qinyun Tan
2026-11-27 5:00 ` Zhang, Rui
2026-11-27 11:59 ` Srinivas Pandruvada
2026-11-28 2:40 ` Zhang, Rui
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=39da5f7295537024b97eeca6b567720c117ee002.camel@linux.intel.com \
--to=srinivas.pandruvada@linux.intel.com \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=qinyuntan@linux.alibaba.com \
--cc=xlpang@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.