The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Suma Hegde <Suma.Hegde@amd.com>
To: Muralidhara M K <muralidhara.mk@amd.com>,
	ilpo.jarvinen@linux.intel.com, gregkh@linuxfoundation.org,
	rafael@kernel.org
Cc: platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org, driver-core@lists.linux.dev,
	Muthusamy Ramalingam <muthusamy.ramalingam@amd.com>
Subject: Re: [PATCH v2 2/7] platform/x86/amd/hsmp: Add metrics table support for Family 1Ah Model 50h-5Fh
Date: Fri, 8 May 2026 10:42:21 +0530	[thread overview]
Message-ID: <b9a9968a-eef3-47af-9f0c-9b7b6e71cfba@amd.com> (raw)
In-Reply-To: <20260427155129.545327-3-muralidhara.mk@amd.com>


Reviewed-by: Suma Hegde <suma.hegde@amd.com>

On 4/27/2026 9:21 PM, Muralidhara M K wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> Define the UAPI structures hsmp_metric_table_zen6_iod,
> hsmp_metric_table_zen6_ccd and the top-level hsmp_metric_table_zen6
> to describe the per-IOD and per-CCD metrics layout for AMD Family 1Ah
> Model 50h-5Fh processors (HSMP protocol version 7).  These structures
> allow userspace tools to interpret the raw metric table binary exposed
> via sysfs.
>
> Widen the ACPI driver protocol version checks from
> == HSMP_PROTO_VER6 to >= HSMP_PROTO_VER6 so the metric table
> sysfs binary attribute is also created for protocol version 7 and
> future versions.
>
> Co-developed-by: Muthusamy Ramalingam <muthusamy.ramalingam@amd.com>
> Signed-off-by: Muthusamy Ramalingam <muthusamy.ramalingam@amd.com>
> Signed-off-by: Muralidhara M K <muralidhara.mk@amd.com>
> ---
> Changes v1->v2:
> Split the change
>
>   arch/x86/include/uapi/asm/amd_hsmp.h | 88 ++++++++++++++++++++++++++++
>   drivers/platform/x86/amd/hsmp/acpi.c |  4 +-
>   2 files changed, 90 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/include/uapi/asm/amd_hsmp.h b/arch/x86/include/uapi/asm/amd_hsmp.h
> index 603d62f8d4da..da3e3bbfa33e 100644
> --- a/arch/x86/include/uapi/asm/amd_hsmp.h
> +++ b/arch/x86/include/uapi/asm/amd_hsmp.h
> @@ -575,6 +575,94 @@ struct hsmp_metric_table {
>          __u32 gfxclk_frequency[8];
>   };
>
> +#define F1A_M50_M5F_MAX_CORES_PER_CCD_32       32
> +#define F1A_M50_M5F_MAX_FREQ_TABLE_SIZE                4
> +#define F1A_M50_M5F_MAX_XGMI                   8
> +#define F1A_M50_M5F_MAX_PCIE                   8
> +#define F1A_M50_M5F_MAX_CCD                    8
> +
> +/* Metrics table (supported only with proto version 7) */
> +struct hsmp_metric_table_zen6_iod {
> +       __u32 num_active_ccds;
> +       __u32 accumulation_counter;
> +
> +       /* TEMPERATURE */
> +       __u64 max_socket_temperature_acc;
> +
> +       /* POWER */
> +       __u32 socket_power_limit;
> +       __u32 max_socket_power_limit;
> +       __u64 socket_power_acc;
> +       __u64 core_power_acc;
> +       __u64 uncore_power_acc;
> +
> +       /* ENERGY */
> +       __u64 timestamp;
> +       __u64 socket_energy_acc;
> +       __u64 core_energy_acc;
> +       __u64 uncore_energy_acc;
> +
> +       /* FREQUENCY */
> +       __u64 fclk_frequency_acc;
> +       __u64 uclk_frequency_acc;
> +       __u64 ddr_rate_acc;
> +       __u64 lclk_frequency_acc[F1A_M50_M5F_MAX_FREQ_TABLE_SIZE];
> +
> +       /* FREQUENCY RANGE */
> +       __u32 fclk_frequency_table[F1A_M50_M5F_MAX_FREQ_TABLE_SIZE];
> +       __u32 uclk_frequency_table[F1A_M50_M5F_MAX_FREQ_TABLE_SIZE];
> +       __u32 ddr_rate_table[F1A_M50_M5F_MAX_FREQ_TABLE_SIZE];
> +       __u32 max_df_pstate_range;
> +       __u32 min_df_pstate_range;
> +       __u32 lclk_frequency_table[F1A_M50_M5F_MAX_FREQ_TABLE_SIZE];
> +       __u32 max_lclk_dpm_range;
> +       __u32 min_lclk_dpm_range;
> +
> +       /* XGMI */
> +       __u64 xgmi_bit_rate[F1A_M50_M5F_MAX_XGMI];
> +       __u64 xgmi_read_bandwidth[F1A_M50_M5F_MAX_XGMI];
> +       __u64 xgmi_write_bandwidth[F1A_M50_M5F_MAX_XGMI];
> +
> +       /* ACTIVITY */
> +       __u64 socket_c0_residency_acc;
> +       __u64 socket_df_cstate_residency_acc;
> +       __u64 dram_read_bandwidth_acc;
> +       __u64 dram_write_bandwidth_acc;
> +       __u32 max_dram_bandwidth;
> +       __u64 pcie_bandwidth_acc[F1A_M50_M5F_MAX_PCIE];
> +
> +       /* THROTTLERS */
> +       __u32 prochot_residency_acc;
> +       __u32 ppt_residency_acc;
> +       __u32 thm_residency_acc;
> +       __u32 vrhot_residency_acc;
> +       __u32 cpu_tdc_residency_acc;
> +       __u32 soc_tdc_residency_acc;
> +       __u32 io_mem_tdc_residency_acc;
> +       __u32 fit_residency_acc;
> +};
> +
> +struct hsmp_metric_table_zen6_ccd {
> +       __u32 core_apicid_of_thread0[F1A_M50_M5F_MAX_CORES_PER_CCD_32];
> +       __u64 core_c0[F1A_M50_M5F_MAX_CORES_PER_CCD_32];
> +       __u64 core_cc1[F1A_M50_M5F_MAX_CORES_PER_CCD_32];
> +       __u64 core_cc6[F1A_M50_M5F_MAX_CORES_PER_CCD_32];
> +       __u64 core_frequency[F1A_M50_M5F_MAX_CORES_PER_CCD_32];
> +       __u64 core_frequency_effective[F1A_M50_M5F_MAX_CORES_PER_CCD_32];
> +       __u64 core_power[F1A_M50_M5F_MAX_CORES_PER_CCD_32];
> +};
> +
> +/*
> + * Metrics table for Family 0x1A, Models 0x50 to 0x5F, table version 0x00700000
> + *
> + * Future processors within the same family and model may support a
> + * variable number of CCDs and cores
> + */
> +struct hsmp_metric_table_zen6 {
> +       struct hsmp_metric_table_zen6_iod iod;
> +       struct hsmp_metric_table_zen6_ccd ccd[F1A_M50_M5F_MAX_CCD];
> +};
> +
>   /* Reset to default packing */
>   #pragma pack()
>
> diff --git a/drivers/platform/x86/amd/hsmp/acpi.c b/drivers/platform/x86/amd/hsmp/acpi.c
> index 97ed71593bdf..8044df862275 100644
> --- a/drivers/platform/x86/amd/hsmp/acpi.c
> +++ b/drivers/platform/x86/amd/hsmp/acpi.c
> @@ -244,7 +244,7 @@ static ssize_t hsmp_metric_tbl_acpi_read(struct file *filp, struct kobject *kobj
>   static umode_t hsmp_is_sock_attr_visible(struct kobject *kobj,
>                                           const struct bin_attribute *battr, int id)
>   {
> -       if (hsmp_pdev->proto_ver == HSMP_PROTO_VER6)
> +       if (hsmp_pdev->proto_ver >= HSMP_PROTO_VER6)
>                  return battr->attr.mode;
>
>          return 0;
> @@ -491,7 +491,7 @@ static int init_acpi(struct device *dev)
>                  return ret;
>          }
>
> -       if (hsmp_pdev->proto_ver == HSMP_PROTO_VER6) {
> +       if (hsmp_pdev->proto_ver >= HSMP_PROTO_VER6) {
>                  ret = hsmp_get_tbl_dram_base(sock_ind);
>                  if (ret)
>                          dev_info(dev, "Failed to init metric table\n");
> --
> 2.34.1
>
>

  parent reply	other threads:[~2026-05-08  5:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260427155129.545327-1-muralidhara.mk@amd.com>
     [not found] ` <20260427155129.545327-4-muralidhara.mk@amd.com>
2026-05-08  5:13   ` [PATCH v2 3/7] platform/x86/amd/hsmp: Unify response_sz validation to an upper-bound check Suma Hegde
2026-05-11 11:20 ` [PATCH v2 0/7] AMD HSMP: metrics table improvements and Family 1Ah Model 50h-5Fh support M K, Muralidhara
     [not found] ` <20260427155129.545327-7-muralidhara.mk@amd.com>
2026-05-11 17:27   ` [PATCH v2 6/7] platform/x86/amd/hsmp: Make metric table read locking use guard(mutex) Ilpo Järvinen
     [not found] ` <20260427155129.545327-2-muralidhara.mk@amd.com>
2026-05-11 17:35   ` [PATCH v2 1/7] platform/x86/amd/hsmp: Add new HSMP messages for Family 1Ah, Model 50h-5Fh Ilpo Järvinen
     [not found] ` <20260427155129.545327-3-muralidhara.mk@amd.com>
2026-05-08  5:12   ` Suma Hegde [this message]
2026-05-11 17:38   ` [PATCH v2 2/7] platform/x86/amd/hsmp: Add metrics table support for Family 1Ah " Ilpo Järvinen

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=b9a9968a-eef3-47af-9f0c-9b7b6e71cfba@amd.com \
    --to=suma.hegde@amd.com \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=muralidhara.mk@amd.com \
    --cc=muthusamy.ramalingam@amd.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rafael@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