From: "M K, Muralidhara" <muralimk@amd.com>
To: Mario Limonciello <mario.limonciello@amd.com>,
Muralidhara M K <muralidhara.mk@amd.com>,
ilpo.jarvinen@linux.intel.com
Cc: platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org, muthusamy.ramalingam@amd.com
Subject: Re: [PATCH 2/7] platform/x86/amd/hsmp: Route metric table through the client messages
Date: Thu, 30 Jul 2026 15:12:11 +0530 [thread overview]
Message-ID: <6536e0af-72bc-4b47-b3d8-65826a49bf5a@amd.com> (raw)
In-Reply-To: <2cc5bfc3-7da1-4efa-8af8-89192eee1314@amd.com>
On 7/30/2026 2:59 AM, Mario Limonciello wrote:
>
>
> On 7/29/26 11:40, Muralidhara M K wrote:
>> Wire the client metric table and metrics DRAM address messages into the
>> metric table read path for the Family 1Ah client platforms (Models
>> 80h-8Fh and E0h-E3h), and initialise the metric table on the platform
>> driver probe.
>>
>> 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 not
>> numbered alike in the two sets - 24h/25h on the server against 05h/06h
>> on the client - which is why they have to come from the descriptor
>> rather than a shared constant.
>>
>> Fetch the metric table on the client whatever interface version was
>> reported. That query is already non-fatal there, since some client SMU
>> builds reject it while the mailbox works, so hsmp_pdev->proto_ver cannot
>> gate the client metric table the way HSMP_PROTO_VER6 gates it on the
>> server.
>>
>> Signed-off-by: Muralidhara M K <muralidhara.mk@amd.com>
>> ---
>> drivers/platform/x86/amd/hsmp/hsmp.c | 16 ++++++++++++----
>> drivers/platform/x86/amd/hsmp/hsmp.h | 4 ++++
>> drivers/platform/x86/amd/hsmp/plat.c | 7 ++++++-
>> 3 files changed, 22 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/platform/x86/amd/hsmp/hsmp.c b/drivers/platform/
>> x86/amd/hsmp/hsmp.c
>> index 9b65dbd47965..2326506929a4 100644
>> --- a/drivers/platform/x86/amd/hsmp/hsmp.c
>> +++ b/drivers/platform/x86/amd/hsmp/hsmp.c
>> @@ -65,6 +65,10 @@ static const struct hsmp_mbaddr_info
>> hsmp_mbinfo_client = {
>> * are also the only ones the two message sets have in common.
>> Messages named
>> * by userspace in an ioctl need no entry here, as that path already
>> resolves
>> * the ID against the running platform's table.
>> + *
>> + * Being common does not mean being numbered alike. The test and
>> version
>> + * queries are 01h and 03h in both sets, but the two metric table
>> messages are
>> + * 24h/25h on the server against 05h/06h on the client.
>> */
>> static const struct hsmp_plat_desc hsmp_desc_server = {
>> .mbinfo = &hsmp_mbinfo_server,
>> @@ -72,6 +76,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 */
>> @@ -81,6 +87,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 = {
>> @@ -643,11 +651,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_pdev.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.
>> @@ -713,8 +721,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_pdev.desc->metric_dram_msg;
>> + msg.response_sz = get_msg_desc(msg.msg_id)->response_sz;
>> ret = hsmp_send_message_locked(&msg);
>> if (ret)
>> diff --git a/drivers/platform/x86/amd/hsmp/hsmp.h b/drivers/platform/
>> x86/amd/hsmp/hsmp.h
>> index b4bd9800dee1..c46d53dbcd43 100644
>> --- a/drivers/platform/x86/amd/hsmp/hsmp.h
>> +++ b/drivers/platform/x86/amd/hsmp/hsmp.h
>> @@ -103,6 +103,8 @@ struct hsmp_mbaddr_info {
>> * @test_msg: no-op message used to probe the mailbox. Also the
>> * lowest valid message ID, as ID 0 is reserved.
>> * @proto_ver_msg: returns the interface version.
>> + * @metric_tbl_msg: refills this socket's metric table in DRAM.
>> + * @metric_dram_msg: returns the DRAM address of the metric table.
>> */
>> struct hsmp_plat_desc {
>> const struct hsmp_mbaddr_info *mbinfo;
>> @@ -110,6 +112,8 @@ struct hsmp_plat_desc {
>> u32 num_msgs;
>> u32 test_msg;
>> u32 proto_ver_msg;
>> + u32 metric_tbl_msg;
>> + u32 metric_dram_msg;
>> };
>> struct hsmp_socket {
>> diff --git a/drivers/platform/x86/amd/hsmp/plat.c b/drivers/platform/
>> x86/amd/hsmp/plat.c
>> index 7423c98a7b3e..bc29b0ec18f7 100644
>> --- a/drivers/platform/x86/amd/hsmp/plat.c
>> +++ b/drivers/platform/x86/amd/hsmp/plat.c
>> @@ -185,7 +185,12 @@ static int init_platform_device(struct device *dev)
>> dev_warn(dev, "Interface version query unsupported on
>> client SMU; continuing\n");
>> }
>> - if (hsmp_pdev->proto_ver == HSMP_PROTO_VER6) {
>> + /*
>> + * On the client the metric table is fetched with
>> + * HSMP_CLIENT_GET_METRICS_TABLE_DRAM_ADDR whatever interface
>> + * version was reported, since that query may be unsupported.
>> + */
>
> What version was reported on client platforms? Since it's the first
> time client is being supported with HSMP, maybe it's best that client
> should be reporting 6.
>
> Then this part of the patch could get dropped later.
>
Currently client version is different than server. So it needs a
explicit condition for client programs.
But, I will check with the SMU team on this.
>> + if (is_client_platform() || hsmp_pdev->proto_ver ==
>> HSMP_PROTO_VER6) {
>> ret = hsmp_get_tbl_dram_base(i);
>> if (ret)
>> dev_info(dev, "Failed to init metric table\n");
>
next prev parent reply other threads:[~2026-07-30 9:42 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-29 16:40 [PATCH 0/7] platform/x86/amd/hsmp: Family 1Ah client support Muralidhara M K
2026-07-29 16:40 ` [PATCH 1/7] platform/x86/amd/hsmp: Add HSMP client support for Family 1Ah Muralidhara M K
2026-07-29 21:27 ` Mario Limonciello
2026-07-30 9:37 ` M K, Muralidhara
2026-07-30 16:43 ` Armin Wolf
2026-07-31 4:27 ` M K, Muralidhara
2026-07-31 7:00 ` Shyam Sundar S K
2026-07-31 10:29 ` Armin Wolf
2026-07-29 16:40 ` [PATCH 2/7] platform/x86/amd/hsmp: Route metric table through the client messages Muralidhara M K
2026-07-29 21:29 ` Mario Limonciello
2026-07-30 9:42 ` M K, Muralidhara [this message]
2026-07-29 16:40 ` [PATCH 3/7] platform/x86/amd/hsmp: Add ACPI client support via the SMNR method Muralidhara M K
2026-07-29 21:30 ` Mario Limonciello
2026-07-30 9:44 ` M K, Muralidhara
2026-07-29 16:40 ` [PATCH 4/7] platform/x86/amd/hsmp: Leave the hwmon power sensors off on client platforms Muralidhara M K
2026-07-29 21:35 ` Mario Limonciello
2026-07-30 10:01 ` M K, Muralidhara
2026-07-29 16:40 ` [PATCH 5/7] platform/x86/amd/hsmp: Add SMN read IOCTL support Muralidhara M K
2026-07-29 16:40 ` [PATCH 6/7] platform/x86/amd/hsmp: Add MSR " Muralidhara M K
2026-07-29 16:40 ` [PATCH 7/7] Documentation/arch/x86/amd_hsmp: Document the SMN and MSR IOCTLs Muralidhara M K
2026-07-29 21:41 ` Mario Limonciello
2026-07-30 10:05 ` M K, Muralidhara
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=6536e0af-72bc-4b47-b3d8-65826a49bf5a@amd.com \
--to=muralimk@amd.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=muralidhara.mk@amd.com \
--cc=muthusamy.ramalingam@amd.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
all inboxes | Powered by JetHome®