From: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
To: Maciej Wieczor-Retman <m.wieczorretman@pm.me>,
hansg@kernel.org, ilpo.jarvinen@linux.intel.com
Cc: linux-kernel@vger.kernel.org,
platform-driver-x86@vger.kernel.org, dedekind1@gmail.com,
artem.bityutskiy@linux.intel.com,
Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
Subject: Re: [PATCH v2 2/2] platform/x86/intel-uncore-freq: Expose instance ID in the sysfs
Date: Tue, 07 Apr 2026 11:03:06 -0700 [thread overview]
Message-ID: <c40b5b4b63fbc9b757892aa5927f5c46655b94d5.camel@linux.intel.com> (raw)
In-Reply-To: <191ea429fcf60aa6612b89dc9357c6d452c50be4.1775159775.git.m.wieczorretman@pm.me>
On Thu, 2026-04-02 at 19:59 +0000, Maciej Wieczor-Retman wrote:
> From: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
>
> Insufficient data is exported to allow direct access to TPMI
> registers
> through MMIO. On non-partitioned systems domain_id can be used both
> for
> mapping CPUs to their compute die IDs and for mapping die indices to
> their MMIO memory blocks mapped
> into userspace.
not mapped. But presented to user space via TPMI debugfs.
> However on partitioned
> systems it can't be used for mapping MMIO blocks anymore.
Again not mapping.
> This is due to
> how TPMI partitioning influences domain_id calculation. The previous
> association is lost on partitioned systems in order to keep using
> domain_id for mapping CPUs to compute dies.
>
> Expose the instance ID in sysfs that's unique in the scope of one
> TPMI
> partition (and hence one TPMI device). It's a physical index into
> mapped
> MMIO blocks and can be used by userspace to figure out how to
> directly
> access TPMI registers.
>
> Signed-off-by: Maciej Wieczor-Retman
> <maciej.wieczor-retman@intel.com>
> ---
> Changelog v2:
> - Redo the patch message.
> - Redo the function comment that assigns instance_id.
> - Modify the documentation.
>
> .../pm/intel_uncore_frequency_scaling.rst | 7 +++++++
> .../uncore-frequency/uncore-frequency-common.c | 10 ++++++++++
> .../uncore-frequency/uncore-frequency-common.h | 6 +++++-
> .../uncore-frequency/uncore-frequency-tpmi.c | 15
> ++++++++++++++-
> 4 files changed, 36 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/admin-
> guide/pm/intel_uncore_frequency_scaling.rst b/Documentation/admin-
> guide/pm/intel_uncore_frequency_scaling.rst
> index d367ba4d744a..b43ad4d5e333 100644
> --- a/Documentation/admin-guide/pm/intel_uncore_frequency_scaling.rst
> +++ b/Documentation/admin-guide/pm/intel_uncore_frequency_scaling.rst
> @@ -88,8 +88,15 @@ and "fabric_cluster_id" in the directory.
>
> Attributes in each directory:
>
> +``instance_id``
> + This attribute is used to get die indices in userspace
> mapped MMIO
> + blocks. Indices are local to a single TPMI partition. Needed
> for direct
> + TPMI register access.
> +
> ``domain_id``
> This attribute is used to get the power domain id of this
> instance.
> + Indices are unique in all TPMI partitions on a given CPU
> package. Can be
> + used to map compute dies to corresponding CPUs.
>
> ``die_id``
> This attribute is used to get the Linux die id of this
> instance.
> diff --git a/drivers/platform/x86/intel/uncore-frequency/uncore-
> frequency-common.c b/drivers/platform/x86/intel/uncore-
> frequency/uncore-frequency-common.c
> index 25ab511ed8d2..7141544ee94b 100644
> --- a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-
> common.c
> +++ b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-
> common.c
> @@ -29,6 +29,13 @@ static ssize_t show_domain_id(struct kobject
> *kobj, struct kobj_attribute *attr,
> return sysfs_emit(buf, "%u\n", data->domain_id);
> }
>
> +static ssize_t show_instance_id(struct kobject *kobj, struct
> kobj_attribute *attr, char *buf)
> +{
> + struct uncore_data *data = container_of(attr, struct
> uncore_data, instance_id_kobj_attr);
> +
> + return sprintf(buf, "%u\n", data->instance_id);
> +}
> +
> static ssize_t show_fabric_cluster_id(struct kobject *kobj, struct
> kobj_attribute *attr, char *buf)
> {
> struct uncore_data *data = container_of(attr, struct
> uncore_data, fabric_cluster_id_kobj_attr);
> @@ -200,6 +207,9 @@ static int create_attr_group(struct uncore_data
> *data, char *name)
> if (data->domain_id != UNCORE_DOMAIN_ID_INVALID) {
> init_attribute_root_ro(domain_id);
> data->uncore_attrs[index++] = &data-
> >domain_id_kobj_attr.attr;
> + init_attribute_root_ro(instance_id);
> + data->uncore_attrs[index++] = &data-
> >instance_id_kobj_attr.attr;
> +
> init_attribute_root_ro(fabric_cluster_id);
> data->uncore_attrs[index++] = &data-
> >fabric_cluster_id_kobj_attr.attr;
> init_attribute_root_ro(package_id);
> diff --git a/drivers/platform/x86/intel/uncore-frequency/uncore-
> frequency-common.h b/drivers/platform/x86/intel/uncore-
> frequency/uncore-frequency-common.h
> index 0d5fd91ee0aa..e319448dc1a4 100644
> --- a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-
> common.h
> +++ b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-
> common.h
> @@ -36,6 +36,7 @@
> * @domain_id: Power domain id for this instance
> * @cluster_id: cluster id in a domain
> * @seqnum_id: Unique sequential id to append to directory
> name
> + * @instance_id: Die indices or feature instances for a
> single TPMI device
> * @name: Sysfs entry name for this instance
> * @agent_type_mask: Bit mask of all hardware agents for this
> domain
> * @uncore_attr_group: Attribute group storage
> @@ -56,6 +57,7 @@
> * @elc_floor_freq_khz_kobj_attr: Storage for kobject attribute
> elc_floor_freq_khz
> * @agent_types_kobj_attr: Storage for kobject attribute agent_type
> * @die_id_kobj_attr: Attribute storage for die_id information
> + * @instance_id_kobj_attr: Attribute storage for instance_id value
> * @uncore_attrs: Attribute storage for group creation
> *
> * This structure is used to encapsulate all data related to uncore
> sysfs
> @@ -72,6 +74,7 @@ struct uncore_data {
> int domain_id;
> int cluster_id;
> int seqnum_id;
> + int instance_id;
> char name[32];
> u16 agent_type_mask;
>
> @@ -90,7 +93,8 @@ struct uncore_data {
> struct kobj_attribute elc_floor_freq_khz_kobj_attr;
> struct kobj_attribute agent_types_kobj_attr;
> struct kobj_attribute die_id_kobj_attr;
> - struct attribute *uncore_attrs[15];
> + struct kobj_attribute instance_id_kobj_attr;
> + struct attribute *uncore_attrs[16];
> };
>
> #define UNCORE_DOMAIN_ID_INVALID -1
> diff --git a/drivers/platform/x86/intel/uncore-frequency/uncore-
> frequency-tpmi.c b/drivers/platform/x86/intel/uncore-
> frequency/uncore-frequency-tpmi.c
> index 1237d9570886..1676a2049aad 100644
> --- a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-
> tpmi.c
> +++ b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-
> tpmi.c
> @@ -385,7 +385,19 @@ static u8 io_die_index_next;
> /* Lock to protect io_die_start, io_die_index_next */
> static DEFINE_MUTEX(domain_lock);
>
> -static void set_domain_id(int id, int num_resources,
> +static void set_instance_id(int id, struct tpmi_uncore_cluster_info
> *cluster_info)
> +{
> + /*
> + * On non-partitioned systems domain_id can be used for
> mapping both
> + * CPUs to compute die IDs and physical die indexes to MMIO
> mapped
> + * memory. However on partitioned systems domain_id loses
> the second
> + * association. Therefore instance_id should be used for
> that instead,
> + * while domain_id should still be used to match CPUs to
> compute dies.
> + */
> + cluster_info->uncore_data.instance_id = id;
> +}
Do you need a function for single line assignment? Why not just assign
in the uncore_probe().
> +
> +static void set_domain_id(int id, int num_resources,
> struct oobmsm_plat_info *plat_info,
> struct tpmi_uncore_cluster_info
> *cluster_info)
> {
> @@ -686,6 +698,7 @@ static int uncore_probe(struct auxiliary_device
> *auxdev, const struct auxiliary_
> set_cdie_id(i, cluster_info, plat_info);
>
> set_domain_id(i, num_resources, plat_info,
> cluster_info);
> + set_instance_id(i, cluster_info);
>
> cluster_info->uncore_root = tpmi_uncore;
>
next prev parent reply other threads:[~2026-04-07 18:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-02 19:59 [PATCH v2 0/2] " Maciej Wieczor-Retman
2026-04-02 19:59 ` [PATCH v2 1/2] platform/x86/intel-uncore-freq: Rename instance_id Maciej Wieczor-Retman
2026-04-07 17:49 ` srinivas pandruvada
2026-04-02 19:59 ` [PATCH v2 2/2] platform/x86/intel-uncore-freq: Expose instance ID in the sysfs Maciej Wieczor-Retman
2026-04-07 18:03 ` srinivas pandruvada [this message]
2026-04-07 18:19 ` Maciej Wieczor-Retman
2026-04-07 20:37 ` srinivas pandruvada
2026-04-07 21:32 ` Maciej Wieczor-Retman
2026-04-07 17:45 ` [PATCH v2 0/2] " srinivas pandruvada
2026-04-07 18:13 ` Maciej Wieczor-Retman
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=c40b5b4b63fbc9b757892aa5927f5c46655b94d5.camel@linux.intel.com \
--to=srinivas.pandruvada@linux.intel.com \
--cc=artem.bityutskiy@linux.intel.com \
--cc=dedekind1@gmail.com \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=m.wieczorretman@pm.me \
--cc=maciej.wieczor-retman@intel.com \
--cc=platform-driver-x86@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome