Re: [PATCH] platform/x86/intel/tpmi/plr: Fix CPU selection on partitioned systems
From: Zhang, Rui
Date: Fri Nov 27 2026 - 21:40:28 EST
On Fri, 2026-11-27 at 03:59 -0800, Srinivas Pandruvada wrote:
> On Fri, 2026-11-27 at 05:00 +0000, Zhang, Rui wrote:
> > 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@xxxxxxxxxxxxxxxxx>
> >
> > I have reproduced this issue and verified that this patch can fix
> > it.
> >
> > Tested-by: Zhang Rui <rui.zhang@xxxxxxxxx>
> >
> > but one minor comment below,
> > >
> > > +static int plr_power_domain_id(const struct oobmsm_plat_info
> > > *plat_info, int index)
> > > +{
> > > + u16 mask = plat_info->cdie_mask;
> >
> > This cdie_mask is a bitmask, its Nth bit means hardware cpu die N,
> > which IMO equals the punit/power domain id N.
> >
> > > + int id = index;
> > > +
> > > + /* Resource indices are relative to the partition's
> > > first
> > > compute die. */
> > > + if (mask)
> > > + id += __ffs(mask);
> >
> > here we want to get the power domain id for PLR domain 0/1 because
> > we
> > use that for cpu to plr/power_domain mapping.
> > The above code generated correct results for the platform being
> > tested,
> > but with the assumption that the cdie_mask cannot be sparse.
> >
> > how about something like
> > id = fns(mask, index);
>
> With recent update in spec cdie_mask can't be sparse.
>
Then the patch LGTM. thanks.
-rui
> Thanks,
> Srinivas
>
>
> >
> > thanks,
> > rui
> >
> >
> > > + else if (plat_info->partition)
> > > + return -ENODEV;
> > > +
> > > + if (id >= MAX_POWER_DOMAINS || (mask && !(mask &
> > > BIT(id))))
> > > + return -ENODEV;
> > > +
> > > + return id;
> > > +}
> > > +
> > >