mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Muralidhara M K <muralidhara.mk@amd.com>
To: <ilpo.jarvinen@linux.intel.com>, <Mario.Limonciello@amd.com>
Cc: <platform-driver-x86@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	Muralidhara M K <muralidhara.mk@amd.com>,
	Mario Limonciello <superm1@kernel.org>
Subject: [PATCH v5 2/4] platform/x86/amd/hsmp: Route metric table through the client messages
Date: Tue, 1 Sep 2026 10:21:32 +0530	[thread overview]
Message-ID: <20260901045134.2833282-3-muralidhara.mk@amd.com> (raw)
In-Reply-To: <20260901045134.2833282-1-muralidhara.mk@amd.com>

Wire the client metric table and metrics DRAM address messages into the
metric table read path for the Family 1Ah client platforms.

The client reaches its metric table through the Ryzen Master SMC message
set, so add the two message IDs to struct hsmp_plat_desc and have
hsmp_metric_tbl_read_locked() and hsmp_get_tbl_dram_base() take them from
there. Unlike the test and version queries, these two are numbered
differently in the two sets (24h/25h server vs 05h/06h client), so they
must come from the descriptor rather than a shared constant.

Signed-off-by: Muralidhara M K <muralidhara.mk@amd.com>
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
---
 drivers/platform/x86/amd/hsmp/hsmp.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/x86/amd/hsmp/hsmp.c b/drivers/platform/x86/amd/hsmp/hsmp.c
index e8fac2d299f3..60889c1b1099 100644
--- a/drivers/platform/x86/amd/hsmp/hsmp.c
+++ b/drivers/platform/x86/amd/hsmp/hsmp.c
@@ -183,6 +183,8 @@ struct hsmp_plat_desc {
 	u32				num_msgs;
 	u32				test_msg;
 	u32				proto_ver_msg;
+	u32				metric_tbl_msg;
+	u32				metric_dram_msg;
 };
 
 static const struct hsmp_plat_desc hsmp_desc_server = {
@@ -190,6 +192,8 @@ static const struct hsmp_plat_desc hsmp_desc_server = {
 	.num_msgs		= HSMP_MSG_ID_MAX,
 	.test_msg		= HSMP_TEST,
 	.proto_ver_msg		= HSMP_GET_PROTO_VER,
+	.metric_tbl_msg		= HSMP_GET_METRIC_TABLE,
+	.metric_dram_msg	= HSMP_GET_METRIC_TABLE_DRAM_ADDR,
 };
 
 /* The client drives a different mailbox with the Ryzen Master SMC message set */
@@ -198,6 +202,8 @@ static const struct hsmp_plat_desc hsmp_desc_client = {
 	.num_msgs		= HSMP_CLIENT_MSG_ID_MAX,
 	.test_msg		= HSMP_CLIENT_TEST,
 	.proto_ver_msg		= HSMP_CLIENT_GET_INTERFACE_VER,
+	.metric_tbl_msg		= HSMP_CLIENT_GET_METRICS_TABLE,
+	.metric_dram_msg	= HSMP_CLIENT_GET_METRICS_TABLE_DRAM_ADDR,
 };
 
 static struct hsmp_plat_device hsmp_pdev;
@@ -759,11 +765,11 @@ static ssize_t hsmp_metric_tbl_read_locked(struct hsmp_socket *sock, char *buf,
 		return -EINVAL;
 	}
 
-	msg.msg_id	= HSMP_GET_METRIC_TABLE;
+	msg.msg_id	= hsmp_desc()->metric_tbl_msg;
 	msg.sock_ind	= sock->sock_ind;
 
 	/*
-	 * HSMP_GET_METRIC_TABLE makes firmware refill this socket's shared
+	 * The metric table message makes firmware refill this socket's shared
 	 * metric DRAM region, which is then copied out below.  Hold the
 	 * per-socket lock across the fill-and-copy so concurrent readers of the
 	 * same socket cannot return a torn snapshot.
@@ -829,8 +835,8 @@ int hsmp_get_tbl_dram_base(u16 sock_ind)
 	int ret;
 
 	msg.sock_ind	= sock_ind;
-	msg.response_sz	= hsmp_msg_desc_table[HSMP_GET_METRIC_TABLE_DRAM_ADDR].response_sz;
-	msg.msg_id	= HSMP_GET_METRIC_TABLE_DRAM_ADDR;
+	msg.msg_id	= hsmp_desc()->metric_dram_msg;
+	msg.response_sz	= get_msg_desc(msg.msg_id)->response_sz;
 
 	ret = hsmp_send_message_locked(&msg);
 	if (ret)
-- 
2.34.1


  parent reply	other threads:[~2026-09-01  4:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01  4:51 [PATCH v5 0/4] platform/x86/amd/hsmp: Family 1Ah client support Muralidhara M K
2026-09-01  4:51 ` [PATCH v5 1/4] platform/x86/amd/hsmp: Add HSMP client support for Family 1Ah Muralidhara M K
2026-09-18 11:34   ` Ilpo Järvinen
2026-09-19  5:32     ` M K, Muralidhara
2026-09-18 11:46   ` Ilpo Järvinen
2026-09-01  4:51 ` Muralidhara M K [this message]
2026-09-01  4:51 ` [PATCH v5 3/4] platform/x86/amd/hsmp: Add ACPI " Muralidhara M K
2026-09-18 11:39   ` Ilpo Järvinen
2026-09-19  5:30     ` M K, Muralidhara
2026-09-18 11:43   ` Ilpo Järvinen
2026-09-01  4:51 ` [PATCH v5 4/4] platform/x86/amd/hsmp: Document and expose client telemetry table in UAPI Muralidhara M K
2026-09-01 12:24 ` [PATCH v5 0/4] platform/x86/amd/hsmp: Family 1Ah client support Mario Limonciello

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=20260901045134.2833282-3-muralidhara.mk@amd.com \
    --to=muralidhara.mk@amd.com \
    --cc=Mario.Limonciello@amd.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=superm1@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

all inboxes | Powered by JetHome®