platform/x86/amd/hsmp: move hsmp_msg_desc_table[] to hsmp.c
Subsystems (3)
PATCH v2 1/1 platform/x86/amd/hsmp: move hsmp_msg_desc_table[] to hsmp.c
From: Arnd Bergmann <[email protected]>
After the file got split, there are now W=1 warnings for users that include it without referencing hsmp_msg_desc_table:
In file included from arch/x86/include/asm/amd_hsmp.h:6,
from drivers/platform/x86/amd/hsmp/plat.c:12:
arch/x86/include/uapi/asm/amd_hsmp.h:91:35: error: 'hsmp_msg_desc_table' defined but not used [-Werror=unused-const-variable=]
91 | static const struct hsmp_msg_desc hsmp_msg_desc_table[] = {
| ^~~~~~~~~~~~~~~~~~~The array was never meant to be used by userspace code, but was left in the header as a reference for userspace programmers.
Move the contents of the array into the one file that actually needs it, and instead leave the URL of the new location in the uapi header in case anyone is looking for it.
--- arch/x86/include/uapi/asm/amd_hsmp.h | 255 ++------------------------- drivers/platform/x86/amd/hsmp/hsmp.c | 245 +++++++++++++++++++++++++ 2 files changed, 255 insertions(+), 245 deletions(-)
arch/x86/include/uapi/asm/amd_hsmp.h +10 -245
@@ -1,5 +1,15 @@/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* +* See hsmp_msg_desc_table[] in: +* https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/platform/x86/amd/hsmp.c +* +* for some information on number of input- and output arguments +* for the various functions. +* +* Please find the supported list of messages and message definition +* in the HSMP chapter of respective family/model PPR. +*/ #ifndef _UAPI_ASM_X86_AMD_HSMP_H_#define _UAPI_ASM_X86_AMD_HSMP_H_
@@ -81,251 +91,6 @@ struct hsmp_msg_desc {enum hsmp_msg_type type; }; -/* -* User may use these comments as reference, please find the -* supported list of messages and message definition in the -* HSMP chapter of respective family/model PPR. -* -* Not supported messages would return -ENOMSG. -*/ -static const struct hsmp_msg_desc hsmp_msg_desc_table[] = { -/* RESERVED */ - {0 ,0 ,HSMP_RSVD }, - -/* -* HSMP_TEST, num_args = 1, response_sz = 1 -* input: args[0] = xx -* output: args[0] = xx + 1 -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_SMU_VER, num_args = 0, response_sz = 1 -* output: args[0] = smu fw ver -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_PROTO_VER, num_args = 0, response_sz = 1 -* output: args[0] = proto version -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_SOCKET_POWER, num_args = 0, response_sz = 1 -* output: args[0] = socket power in mWatts -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_SET_SOCKET_POWER_LIMIT, num_args = 1, response_sz = 0 -* input: args[0] = power limit value in mWatts -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_GET_SOCKET_POWER_LIMIT, num_args = 0, response_sz = 1 -* output: args[0] = socket power limit value in mWatts -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_SOCKET_POWER_LIMIT_MAX, num_args = 0, response_sz = 1 -* output: args[0] = maximuam socket power limit in mWatts -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_SET_BOOST_LIMIT, num_args = 1, response_sz = 0 -* input: args[0] = apic id[31:16] + boost limit value in MHz[15:0] -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_SET_BOOST_LIMIT_SOCKET, num_args = 1, response_sz = 0 -* input: args[0] = boost limit value in MHz -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_GET_BOOST_LIMIT, num_args = 1, response_sz = 1 -* input: args[0] = apic id -* output: args[0] = boost limit value in MHz -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_PROC_HOT, num_args = 0, response_sz = 1 -* output: args[0] = proc hot status -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_SET_XGMI_LINK_WIDTH, num_args = 1, response_sz = 0 -* input: args[0] = min link width[15:8] + max link width[7:0] -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_SET_DF_PSTATE, num_args = 1, response_sz = 0 -* input: args[0] = df pstate[7:0] -*/ - {1 ,0 ,HSMP_SET }, - -/* HSMP_SET_AUTO_DF_PSTATE, num_args = 0, response_sz = 0 */ - {0 ,0 ,HSMP_SET }, - -/* -* HSMP_GET_FCLK_MCLK, num_args = 0, response_sz = 2 -* output: args[0] = fclk in MHz, args[1] = mclk in MHz -*/ - {0 ,2 ,HSMP_GET }, - -/* -* HSMP_GET_CCLK_THROTTLE_LIMIT, num_args = 0, response_sz = 1 -* output: args[0] = core clock in MHz -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_C0_PERCENT, num_args = 0, response_sz = 1 -* output: args[0] = average c0 residency -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_SET_NBIO_DPM_LEVEL, num_args = 1, response_sz = 0 -* input: args[0] = nbioid[23:16] + max dpm level[15:8] + min dpm level[7:0] -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_GET_NBIO_DPM_LEVEL, num_args = 1, response_sz = 1 -* input: args[0] = nbioid[23:16] -* output: args[0] = max dpm level[15:8] + min dpm level[7:0] -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_DDR_BANDWIDTH, num_args = 0, response_sz = 1 -* output: args[0] = max bw in Gbps[31:20] + utilised bw in Gbps[19:8] + -* bw in percentage[7:0] -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_TEMP_MONITOR, num_args = 0, response_sz = 1 -* output: args[0] = temperature in degree celsius. [15:8] integer part + -* [7:5] fractional part -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_DIMM_TEMP_RANGE, num_args = 1, response_sz = 1 -* input: args[0] = DIMM address[7:0] -* output: args[0] = refresh rate[3] + temperature range[2:0] -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_DIMM_POWER, num_args = 1, response_sz = 1 -* input: args[0] = DIMM address[7:0] -* output: args[0] = DIMM power in mW[31:17] + update rate in ms[16:8] + -* DIMM address[7:0] -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_DIMM_THERMAL, num_args = 1, response_sz = 1 -* input: args[0] = DIMM address[7:0] -* output: args[0] = temperature in degree celsius[31:21] + update rate in ms[16:8] + -* DIMM address[7:0] -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_SOCKET_FREQ_LIMIT, num_args = 0, response_sz = 1 -* output: args[0] = frequency in MHz[31:16] + frequency source[15:0] -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_CCLK_CORE_LIMIT, num_args = 1, response_sz = 1 -* input: args[0] = apic id [31:0] -* output: args[0] = frequency in MHz[31:0] -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_RAILS_SVI, num_args = 0, response_sz = 1 -* output: args[0] = power in mW[31:0] -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_SOCKET_FMAX_FMIN, num_args = 0, response_sz = 1 -* output: args[0] = fmax in MHz[31:16] + fmin in MHz[15:0] -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_IOLINK_BANDWITH, num_args = 1, response_sz = 1 -* input: args[0] = link id[15:8] + bw type[2:0] -* output: args[0] = io bandwidth in Mbps[31:0] -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_XGMI_BANDWITH, num_args = 1, response_sz = 1 -* input: args[0] = link id[15:8] + bw type[2:0] -* output: args[0] = xgmi bandwidth in Mbps[31:0] -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_SET_GMI3_WIDTH, num_args = 1, response_sz = 0 -* input: args[0] = min link width[15:8] + max link width[7:0] -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_SET_PCI_RATE, num_args = 1, response_sz = 1 -* input: args[0] = link rate control value -* output: args[0] = previous link rate control value -*/ - {1 ,1 ,HSMP_SET }, - -/* -* HSMP_SET_POWER_MODE, num_args = 1, response_sz = 0 -* input: args[0] = power efficiency mode[2:0] -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_SET_PSTATE_MAX_MIN, num_args = 1, response_sz = 0 -* input: args[0] = min df pstate[15:8] + max df pstate[7:0] -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_GET_METRIC_TABLE_VER, num_args = 0, response_sz = 1 -* output: args[0] = metrics table version -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_METRIC_TABLE, num_args = 0, response_sz = 0 -*/ - {0 ,0 ,HSMP_GET }, - -/* -* HSMP_GET_METRIC_TABLE_DRAM_ADDR, num_args = 0, response_sz = 2 -* output: args[0] = lower 32 bits of the address -* output: args[1] = upper 32 bits of the address -*/ - {0 ,2 ,HSMP_GET }, -}; -/* Metrics table (supported only with proto version 6) */ struct hsmp_metric_table {__u32 accumulation_counter;
drivers/platform/x86/amd/hsmp/hsmp.c +245 -0
251 lines not on this page · raw message
Signature · 1 line
2.39.5
Quoted 14 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
After the file got split, there are now W=1 warnings for users that include it without referencing
hsmp_msg_desc_table:In file included from
arch/x86/include/asm/amd_hsmp.h:6,from drivers/platform/x86/amd/hsmp/plat.c:12: arch/x86/include/uapi/asm/amd_hsmp.h:91:35: error: 'hsmp_msg_desc_table' defined but not used [-Werror=unused-const-variable=] 91 | static const struct hsmp_msg_desc hsmp_msg_desc_table[] = { | ^~~~~~~~~~~~~~~~~~~The array was never meant to be used by userspace code, but was left in the header as a reference for userspace programmers.
Quoted 8 lines
Move the contents of the array into the one file that actually needs it, and instead leave the URL of the new location in the uapi header in case anyone is looking for it.
Fixes e47c018a0ee6 ("platform/x86/amd/hsmp: Move platform device specific code to plat.c")Suggested-by Hans de Goede <[email protected]>Signed-off-by Arnd Bergmann <[email protected]>
I'll leave it into patchwork for a few days if somebody has some still unvoiced opinions on this.
--
i.
Quoted 534 lines
--- arch/x86/include/uapi/asm/amd_hsmp.h | 255 ++------------------------- drivers/platform/x86/amd/hsmp/hsmp.c | 245 +++++++++++++++++++++++++ 2 files changed, 255 insertions(+), 245 deletions(-)arch/x86/include/uapi/asm/amd_hsmp.h +10
-245@@ -1,5 +1,15 @@/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* +* See hsmp_msg_desc_table[] in: +* https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/platform/x86/amd/hsmp.c +* +* for some information on number of input- and output arguments +* for the various functions. +* +* Please find the supported list of messages and message definition +* in the HSMP chapter of respective family/model PPR. +*/ #ifndef _UAPI_ASM_X86_AMD_HSMP_H_#define _UAPI_ASM_X86_AMD_HSMP_H_@@ -81,251 +91,6 @@ struct hsmp_msg_desc {enum hsmp_msg_type type; }; -/* -* User may use these comments as reference, please find the -* supported list of messages and message definition in the -* HSMP chapter of respective family/model PPR. -* -* Not supported messages would return -ENOMSG. -*/ -static const struct hsmp_msg_desc hsmp_msg_desc_table[] = { -/* RESERVED */ - {0 ,0 ,HSMP_RSVD }, - -/* -* HSMP_TEST, num_args = 1, response_sz = 1 -* input: args[0] = xx -* output: args[0] = xx + 1 -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_SMU_VER, num_args = 0, response_sz = 1 -* output: args[0] = smu fw ver -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_PROTO_VER, num_args = 0, response_sz = 1 -* output: args[0] = proto version -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_SOCKET_POWER, num_args = 0, response_sz = 1 -* output: args[0] = socket power in mWatts -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_SET_SOCKET_POWER_LIMIT, num_args = 1, response_sz = 0 -* input: args[0] = power limit value in mWatts -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_GET_SOCKET_POWER_LIMIT, num_args = 0, response_sz = 1 -* output: args[0] = socket power limit value in mWatts -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_SOCKET_POWER_LIMIT_MAX, num_args = 0, response_sz = 1 -* output: args[0] = maximuam socket power limit in mWatts -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_SET_BOOST_LIMIT, num_args = 1, response_sz = 0 -* input: args[0] = apic id[31:16] + boost limit value in MHz[15:0] -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_SET_BOOST_LIMIT_SOCKET, num_args = 1, response_sz = 0 -* input: args[0] = boost limit value in MHz -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_GET_BOOST_LIMIT, num_args = 1, response_sz = 1 -* input: args[0] = apic id -* output: args[0] = boost limit value in MHz -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_PROC_HOT, num_args = 0, response_sz = 1 -* output: args[0] = proc hot status -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_SET_XGMI_LINK_WIDTH, num_args = 1, response_sz = 0 -* input: args[0] = min link width[15:8] + max link width[7:0] -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_SET_DF_PSTATE, num_args = 1, response_sz = 0 -* input: args[0] = df pstate[7:0] -*/ - {1 ,0 ,HSMP_SET }, - -/* HSMP_SET_AUTO_DF_PSTATE, num_args = 0, response_sz = 0 */ - {0 ,0 ,HSMP_SET }, - -/* -* HSMP_GET_FCLK_MCLK, num_args = 0, response_sz = 2 -* output: args[0] = fclk in MHz, args[1] = mclk in MHz -*/ - {0 ,2 ,HSMP_GET }, - -/* -* HSMP_GET_CCLK_THROTTLE_LIMIT, num_args = 0, response_sz = 1 -* output: args[0] = core clock in MHz -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_C0_PERCENT, num_args = 0, response_sz = 1 -* output: args[0] = average c0 residency -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_SET_NBIO_DPM_LEVEL, num_args = 1, response_sz = 0 -* input: args[0] = nbioid[23:16] + max dpm level[15:8] + min dpm level[7:0] -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_GET_NBIO_DPM_LEVEL, num_args = 1, response_sz = 1 -* input: args[0] = nbioid[23:16] -* output: args[0] = max dpm level[15:8] + min dpm level[7:0] -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_DDR_BANDWIDTH, num_args = 0, response_sz = 1 -* output: args[0] = max bw in Gbps[31:20] + utilised bw in Gbps[19:8] + -* bw in percentage[7:0] -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_TEMP_MONITOR, num_args = 0, response_sz = 1 -* output: args[0] = temperature in degree celsius. [15:8] integer part + -* [7:5] fractional part -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_DIMM_TEMP_RANGE, num_args = 1, response_sz = 1 -* input: args[0] = DIMM address[7:0] -* output: args[0] = refresh rate[3] + temperature range[2:0] -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_DIMM_POWER, num_args = 1, response_sz = 1 -* input: args[0] = DIMM address[7:0] -* output: args[0] = DIMM power in mW[31:17] + update rate in ms[16:8] + -* DIMM address[7:0] -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_DIMM_THERMAL, num_args = 1, response_sz = 1 -* input: args[0] = DIMM address[7:0] -* output: args[0] = temperature in degree celsius[31:21] + update rate in ms[16:8] + -* DIMM address[7:0] -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_SOCKET_FREQ_LIMIT, num_args = 0, response_sz = 1 -* output: args[0] = frequency in MHz[31:16] + frequency source[15:0] -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_CCLK_CORE_LIMIT, num_args = 1, response_sz = 1 -* input: args[0] = apic id [31:0] -* output: args[0] = frequency in MHz[31:0] -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_RAILS_SVI, num_args = 0, response_sz = 1 -* output: args[0] = power in mW[31:0] -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_SOCKET_FMAX_FMIN, num_args = 0, response_sz = 1 -* output: args[0] = fmax in MHz[31:16] + fmin in MHz[15:0] -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_IOLINK_BANDWITH, num_args = 1, response_sz = 1 -* input: args[0] = link id[15:8] + bw type[2:0] -* output: args[0] = io bandwidth in Mbps[31:0] -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_XGMI_BANDWITH, num_args = 1, response_sz = 1 -* input: args[0] = link id[15:8] + bw type[2:0] -* output: args[0] = xgmi bandwidth in Mbps[31:0] -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_SET_GMI3_WIDTH, num_args = 1, response_sz = 0 -* input: args[0] = min link width[15:8] + max link width[7:0] -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_SET_PCI_RATE, num_args = 1, response_sz = 1 -* input: args[0] = link rate control value -* output: args[0] = previous link rate control value -*/ - {1 ,1 ,HSMP_SET }, - -/* -* HSMP_SET_POWER_MODE, num_args = 1, response_sz = 0 -* input: args[0] = power efficiency mode[2:0] -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_SET_PSTATE_MAX_MIN, num_args = 1, response_sz = 0 -* input: args[0] = min df pstate[15:8] + max df pstate[7:0] -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_GET_METRIC_TABLE_VER, num_args = 0, response_sz = 1 -* output: args[0] = metrics table version -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_METRIC_TABLE, num_args = 0, response_sz = 0 -*/ - {0 ,0 ,HSMP_GET }, - -/* -* HSMP_GET_METRIC_TABLE_DRAM_ADDR, num_args = 0, response_sz = 2 -* output: args[0] = lower 32 bits of the address -* output: args[1] = upper 32 bits of the address -*/ - {0 ,2 ,HSMP_GET }, -}; -/* Metrics table (supported only with proto version 6) */ struct hsmp_metric_table {__u32 accumulation_counter;drivers/platform/x86/amd/hsmp/hsmp.c +245
-0@@ -37,6 +37,251 @@static struct hsmp_plat_device hsmp_pdev; +/* +* User may use these comments as reference, please find the +* supported list of messages and message definition in the +* HSMP chapter of respective family/model PPR. +* +* Not supported messages would return -ENOMSG. +*/ +static const struct hsmp_msg_desc hsmp_msg_desc_table[] = { +/* RESERVED */ + {0 ,0 ,HSMP_RSVD }, + +/* +* HSMP_TEST, num_args = 1, response_sz = 1 +* input: args[0] = xx +* output: args[0] = xx + 1 +*/ + {1 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_SMU_VER, num_args = 0, response_sz = 1 +* output: args[0] = smu fw ver +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_PROTO_VER, num_args = 0, response_sz = 1 +* output: args[0] = proto version +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_SOCKET_POWER, num_args = 0, response_sz = 1 +* output: args[0] = socket power in mWatts +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_SET_SOCKET_POWER_LIMIT, num_args = 1, response_sz = 0 +* input: args[0] = power limit value in mWatts +*/ + {1 ,0 ,HSMP_SET }, + +/* +* HSMP_GET_SOCKET_POWER_LIMIT, num_args = 0, response_sz = 1 +* output: args[0] = socket power limit value in mWatts +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_SOCKET_POWER_LIMIT_MAX, num_args = 0, response_sz = 1 +* output: args[0] = maximuam socket power limit in mWatts +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_SET_BOOST_LIMIT, num_args = 1, response_sz = 0 +* input: args[0] = apic id[31:16] + boost limit value in MHz[15:0] +*/ + {1 ,0 ,HSMP_SET }, + +/* +* HSMP_SET_BOOST_LIMIT_SOCKET, num_args = 1, response_sz = 0 +* input: args[0] = boost limit value in MHz +*/ + {1 ,0 ,HSMP_SET }, + +/* +* HSMP_GET_BOOST_LIMIT, num_args = 1, response_sz = 1 +* input: args[0] = apic id +* output: args[0] = boost limit value in MHz +*/ + {1 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_PROC_HOT, num_args = 0, response_sz = 1 +* output: args[0] = proc hot status +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_SET_XGMI_LINK_WIDTH, num_args = 1, response_sz = 0 +* input: args[0] = min link width[15:8] + max link width[7:0] +*/ + {1 ,0 ,HSMP_SET }, + +/* +* HSMP_SET_DF_PSTATE, num_args = 1, response_sz = 0 +* input: args[0] = df pstate[7:0] +*/ + {1 ,0 ,HSMP_SET }, + +/* HSMP_SET_AUTO_DF_PSTATE, num_args = 0, response_sz = 0 */ + {0 ,0 ,HSMP_SET }, + +/* +* HSMP_GET_FCLK_MCLK, num_args = 0, response_sz = 2 +* output: args[0] = fclk in MHz, args[1] = mclk in MHz +*/ + {0 ,2 ,HSMP_GET }, + +/* +* HSMP_GET_CCLK_THROTTLE_LIMIT, num_args = 0, response_sz = 1 +* output: args[0] = core clock in MHz +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_C0_PERCENT, num_args = 0, response_sz = 1 +* output: args[0] = average c0 residency +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_SET_NBIO_DPM_LEVEL, num_args = 1, response_sz = 0 +* input: args[0] = nbioid[23:16] + max dpm level[15:8] + min dpm level[7:0] +*/ + {1 ,0 ,HSMP_SET }, + +/* +* HSMP_GET_NBIO_DPM_LEVEL, num_args = 1, response_sz = 1 +* input: args[0] = nbioid[23:16] +* output: args[0] = max dpm level[15:8] + min dpm level[7:0] +*/ + {1 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_DDR_BANDWIDTH, num_args = 0, response_sz = 1 +* output: args[0] = max bw in Gbps[31:20] + utilised bw in Gbps[19:8] + +* bw in percentage[7:0] +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_TEMP_MONITOR, num_args = 0, response_sz = 1 +* output: args[0] = temperature in degree celsius. [15:8] integer part + +* [7:5] fractional part +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_DIMM_TEMP_RANGE, num_args = 1, response_sz = 1 +* input: args[0] = DIMM address[7:0] +* output: args[0] = refresh rate[3] + temperature range[2:0] +*/ + {1 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_DIMM_POWER, num_args = 1, response_sz = 1 +* input: args[0] = DIMM address[7:0] +* output: args[0] = DIMM power in mW[31:17] + update rate in ms[16:8] + +* DIMM address[7:0] +*/ + {1 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_DIMM_THERMAL, num_args = 1, response_sz = 1 +* input: args[0] = DIMM address[7:0] +* output: args[0] = temperature in degree celsius[31:21] + update rate in ms[16:8] + +* DIMM address[7:0] +*/ + {1 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_SOCKET_FREQ_LIMIT, num_args = 0, response_sz = 1 +* output: args[0] = frequency in MHz[31:16] + frequency source[15:0] +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_CCLK_CORE_LIMIT, num_args = 1, response_sz = 1 +* input: args[0] = apic id [31:0] +* output: args[0] = frequency in MHz[31:0] +*/ + {1 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_RAILS_SVI, num_args = 0, response_sz = 1 +* output: args[0] = power in mW[31:0] +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_SOCKET_FMAX_FMIN, num_args = 0, response_sz = 1 +* output: args[0] = fmax in MHz[31:16] + fmin in MHz[15:0] +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_IOLINK_BANDWITH, num_args = 1, response_sz = 1 +* input: args[0] = link id[15:8] + bw type[2:0] +* output: args[0] = io bandwidth in Mbps[31:0] +*/ + {1 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_XGMI_BANDWITH, num_args = 1, response_sz = 1 +* input: args[0] = link id[15:8] + bw type[2:0] +* output: args[0] = xgmi bandwidth in Mbps[31:0] +*/ + {1 ,1 ,HSMP_GET }, + +/* +* HSMP_SET_GMI3_WIDTH, num_args = 1, response_sz = 0 +* input: args[0] = min link width[15:8] + max link width[7:0] +*/ + {1 ,0 ,HSMP_SET }, + +/* +* HSMP_SET_PCI_RATE, num_args = 1, response_sz = 1 +* input: args[0] = link rate control value +* output: args[0] = previous link rate control value +*/ + {1 ,1 ,HSMP_SET }, + +/* +* HSMP_SET_POWER_MODE, num_args = 1, response_sz = 0 +* input: args[0] = power efficiency mode[2:0] +*/ + {1 ,0 ,HSMP_SET }, + +/* +* HSMP_SET_PSTATE_MAX_MIN, num_args = 1, response_sz = 0 +* input: args[0] = min df pstate[15:8] + max df pstate[7:0] +*/ + {1 ,0 ,HSMP_SET }, + +/* +* HSMP_GET_METRIC_TABLE_VER, num_args = 0, response_sz = 1 +* output: args[0] = metrics table version +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_METRIC_TABLE, num_args = 0, response_sz = 0 +*/ + {0 ,0 ,HSMP_GET }, + +/* +* HSMP_GET_METRIC_TABLE_DRAM_ADDR, num_args = 0, response_sz = 2 +* output: args[0] = lower 32 bits of the address +* output: args[1] = upper 32 bits of the address +*/ + {0 ,2 ,HSMP_GET }, +}; +/* * Send a message to the HSMP port via PCI-e config space registers * or by writing to MMIO space.
Hi,
Quoted 23 lines · Ilpo Järvinen
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
Quoted 18 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
After the file got split, there are now W=1 warnings for users that include it without referencing
hsmp_msg_desc_table:In file included from
arch/x86/include/asm/amd_hsmp.h:6,from drivers/platform/x86/amd/hsmp/plat.c:12: arch/x86/include/uapi/asm/amd_hsmp.h:91:35: error: 'hsmp_msg_desc_table' defined but not used [-Werror=unused-const-variable=] 91 | static const struct hsmp_msg_desc hsmp_msg_desc_table[] = { | ^~~~~~~~~~~~~~~~~~~The array was never meant to be used by userspace code, but was left in the header as a reference for userspace programmers.
Move the contents of the array into the one file that actually needs it, and instead leave the URL of the new location in the uapi header in case anyone is looking for it.
Quoted 8 lines
Quoted 4 lines
Fixes e47c018a0ee6 ("platform/x86/amd/hsmp: Move platform device specific code to plat.c")Suggested-by Hans de Goede <[email protected]>Signed-off-by Arnd Bergmann <[email protected]>Reviewed-by Ilpo Järvinen <[email protected]>I'll leave it into patchwork for a few days if somebody has some still unvoiced opinions on this.
AFAIK, Song Liu might be having some user space tool which makes use of this hsmp_msg_desc_table[].
Please refer https://lore.kernel.org/platform-driver-x86/[email protected]/T/#mb563e1e07183e6bb5f85ab2cba4afe0deca1d3c3
for the discussions on having this table in UAPI header.
@Song Liu, this table is moved to hsmp.c now. Please raise your concern here if any.
Quoted 528 lines
--
i.Quoted 525 lines
--- arch/x86/include/uapi/asm/amd_hsmp.h | 255 ++------------------------- drivers/platform/x86/amd/hsmp/hsmp.c | 245 +++++++++++++++++++++++++ 2 files changed, 255 insertions(+), 245 deletions(-)arch/x86/include/uapi/asm/amd_hsmp.h +10
-245@@ -1,5 +1,15 @@/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* +* See hsmp_msg_desc_table[] in: +* https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/platform/x86/amd/hsmp.c +* +* for some information on number of input- and output arguments +* for the various functions. +* +* Please find the supported list of messages and message definition +* in the HSMP chapter of respective family/model PPR. +*/ #ifndef _UAPI_ASM_X86_AMD_HSMP_H_#define _UAPI_ASM_X86_AMD_HSMP_H_@@ -81,251 +91,6 @@ struct hsmp_msg_desc {enum hsmp_msg_type type; }; -/* -* User may use these comments as reference, please find the -* supported list of messages and message definition in the -* HSMP chapter of respective family/model PPR. -* -* Not supported messages would return -ENOMSG. -*/ -static const struct hsmp_msg_desc hsmp_msg_desc_table[] = { -/* RESERVED */ - {0 ,0 ,HSMP_RSVD }, - -/* -* HSMP_TEST, num_args = 1, response_sz = 1 -* input: args[0] = xx -* output: args[0] = xx + 1 -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_SMU_VER, num_args = 0, response_sz = 1 -* output: args[0] = smu fw ver -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_PROTO_VER, num_args = 0, response_sz = 1 -* output: args[0] = proto version -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_SOCKET_POWER, num_args = 0, response_sz = 1 -* output: args[0] = socket power in mWatts -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_SET_SOCKET_POWER_LIMIT, num_args = 1, response_sz = 0 -* input: args[0] = power limit value in mWatts -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_GET_SOCKET_POWER_LIMIT, num_args = 0, response_sz = 1 -* output: args[0] = socket power limit value in mWatts -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_SOCKET_POWER_LIMIT_MAX, num_args = 0, response_sz = 1 -* output: args[0] = maximuam socket power limit in mWatts -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_SET_BOOST_LIMIT, num_args = 1, response_sz = 0 -* input: args[0] = apic id[31:16] + boost limit value in MHz[15:0] -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_SET_BOOST_LIMIT_SOCKET, num_args = 1, response_sz = 0 -* input: args[0] = boost limit value in MHz -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_GET_BOOST_LIMIT, num_args = 1, response_sz = 1 -* input: args[0] = apic id -* output: args[0] = boost limit value in MHz -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_PROC_HOT, num_args = 0, response_sz = 1 -* output: args[0] = proc hot status -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_SET_XGMI_LINK_WIDTH, num_args = 1, response_sz = 0 -* input: args[0] = min link width[15:8] + max link width[7:0] -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_SET_DF_PSTATE, num_args = 1, response_sz = 0 -* input: args[0] = df pstate[7:0] -*/ - {1 ,0 ,HSMP_SET }, - -/* HSMP_SET_AUTO_DF_PSTATE, num_args = 0, response_sz = 0 */ - {0 ,0 ,HSMP_SET }, - -/* -* HSMP_GET_FCLK_MCLK, num_args = 0, response_sz = 2 -* output: args[0] = fclk in MHz, args[1] = mclk in MHz -*/ - {0 ,2 ,HSMP_GET }, - -/* -* HSMP_GET_CCLK_THROTTLE_LIMIT, num_args = 0, response_sz = 1 -* output: args[0] = core clock in MHz -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_C0_PERCENT, num_args = 0, response_sz = 1 -* output: args[0] = average c0 residency -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_SET_NBIO_DPM_LEVEL, num_args = 1, response_sz = 0 -* input: args[0] = nbioid[23:16] + max dpm level[15:8] + min dpm level[7:0] -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_GET_NBIO_DPM_LEVEL, num_args = 1, response_sz = 1 -* input: args[0] = nbioid[23:16] -* output: args[0] = max dpm level[15:8] + min dpm level[7:0] -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_DDR_BANDWIDTH, num_args = 0, response_sz = 1 -* output: args[0] = max bw in Gbps[31:20] + utilised bw in Gbps[19:8] + -* bw in percentage[7:0] -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_TEMP_MONITOR, num_args = 0, response_sz = 1 -* output: args[0] = temperature in degree celsius. [15:8] integer part + -* [7:5] fractional part -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_DIMM_TEMP_RANGE, num_args = 1, response_sz = 1 -* input: args[0] = DIMM address[7:0] -* output: args[0] = refresh rate[3] + temperature range[2:0] -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_DIMM_POWER, num_args = 1, response_sz = 1 -* input: args[0] = DIMM address[7:0] -* output: args[0] = DIMM power in mW[31:17] + update rate in ms[16:8] + -* DIMM address[7:0] -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_DIMM_THERMAL, num_args = 1, response_sz = 1 -* input: args[0] = DIMM address[7:0] -* output: args[0] = temperature in degree celsius[31:21] + update rate in ms[16:8] + -* DIMM address[7:0] -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_SOCKET_FREQ_LIMIT, num_args = 0, response_sz = 1 -* output: args[0] = frequency in MHz[31:16] + frequency source[15:0] -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_CCLK_CORE_LIMIT, num_args = 1, response_sz = 1 -* input: args[0] = apic id [31:0] -* output: args[0] = frequency in MHz[31:0] -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_RAILS_SVI, num_args = 0, response_sz = 1 -* output: args[0] = power in mW[31:0] -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_SOCKET_FMAX_FMIN, num_args = 0, response_sz = 1 -* output: args[0] = fmax in MHz[31:16] + fmin in MHz[15:0] -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_IOLINK_BANDWITH, num_args = 1, response_sz = 1 -* input: args[0] = link id[15:8] + bw type[2:0] -* output: args[0] = io bandwidth in Mbps[31:0] -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_XGMI_BANDWITH, num_args = 1, response_sz = 1 -* input: args[0] = link id[15:8] + bw type[2:0] -* output: args[0] = xgmi bandwidth in Mbps[31:0] -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_SET_GMI3_WIDTH, num_args = 1, response_sz = 0 -* input: args[0] = min link width[15:8] + max link width[7:0] -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_SET_PCI_RATE, num_args = 1, response_sz = 1 -* input: args[0] = link rate control value -* output: args[0] = previous link rate control value -*/ - {1 ,1 ,HSMP_SET }, - -/* -* HSMP_SET_POWER_MODE, num_args = 1, response_sz = 0 -* input: args[0] = power efficiency mode[2:0] -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_SET_PSTATE_MAX_MIN, num_args = 1, response_sz = 0 -* input: args[0] = min df pstate[15:8] + max df pstate[7:0] -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_GET_METRIC_TABLE_VER, num_args = 0, response_sz = 1 -* output: args[0] = metrics table version -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_METRIC_TABLE, num_args = 0, response_sz = 0 -*/ - {0 ,0 ,HSMP_GET }, - -/* -* HSMP_GET_METRIC_TABLE_DRAM_ADDR, num_args = 0, response_sz = 2 -* output: args[0] = lower 32 bits of the address -* output: args[1] = upper 32 bits of the address -*/ - {0 ,2 ,HSMP_GET }, -}; -/* Metrics table (supported only with proto version 6) */ struct hsmp_metric_table {__u32 accumulation_counter;drivers/platform/x86/amd/hsmp/hsmp.c +240
-0@@ -37,6 +37,251 @@static struct hsmp_plat_device hsmp_pdev; +/* +* User may use these comments as reference, please find the +* supported list of messages and message definition in the +* HSMP chapter of respective family/model PPR. +* +* Not supported messages would return -ENOMSG. +*/ +static const struct hsmp_msg_desc hsmp_msg_desc_table[] = { +/* RESERVED */ + {0 ,0 ,HSMP_RSVD }, + +/* +* HSMP_TEST, num_args = 1, response_sz = 1 +* input: args[0] = xx +* output: args[0] = xx + 1 +*/ + {1 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_SMU_VER, num_args = 0, response_sz = 1 +* output: args[0] = smu fw ver +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_PROTO_VER, num_args = 0, response_sz = 1 +* output: args[0] = proto version +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_SOCKET_POWER, num_args = 0, response_sz = 1 +* output: args[0] = socket power in mWatts +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_SET_SOCKET_POWER_LIMIT, num_args = 1, response_sz = 0 +* input: args[0] = power limit value in mWatts +*/ + {1 ,0 ,HSMP_SET }, + +/* +* HSMP_GET_SOCKET_POWER_LIMIT, num_args = 0, response_sz = 1 +* output: args[0] = socket power limit value in mWatts +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_SOCKET_POWER_LIMIT_MAX, num_args = 0, response_sz = 1 +* output: args[0] = maximuam socket power limit in mWatts +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_SET_BOOST_LIMIT, num_args = 1, response_sz = 0 +* input: args[0] = apic id[31:16] + boost limit value in MHz[15:0] +*/ + {1 ,0 ,HSMP_SET }, + +/* +* HSMP_SET_BOOST_LIMIT_SOCKET, num_args = 1, response_sz = 0 +* input: args[0] = boost limit value in MHz +*/ + {1 ,0 ,HSMP_SET }, + +/* +* HSMP_GET_BOOST_LIMIT, num_args = 1, response_sz = 1 +* input: args[0] = apic id +* output: args[0] = boost limit value in MHz +*/ + {1 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_PROC_HOT, num_args = 0, response_sz = 1 +* output: args[0] = proc hot status +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_SET_XGMI_LINK_WIDTH, num_args = 1, response_sz = 0 +* input: args[0] = min link width[15:8] + max link width[7:0] +*/ + {1 ,0 ,HSMP_SET }, + +/* +* HSMP_SET_DF_PSTATE, num_args = 1, response_sz = 0 +* input: args[0] = df pstate[7:0] +*/ + {1 ,0 ,HSMP_SET }, + +/* HSMP_SET_AUTO_DF_PSTATE, num_args = 0, response_sz = 0 */ + {0 ,0 ,HSMP_SET }, + +/* +* HSMP_GET_FCLK_MCLK, num_args = 0, response_sz = 2 +* output: args[0] = fclk in MHz, args[1] = mclk in MHz +*/ + {0 ,2 ,HSMP_GET }, + +/* +* HSMP_GET_CCLK_THROTTLE_LIMIT, num_args = 0, response_sz = 1 +* output: args[0] = core clock in MHz +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_C0_PERCENT, num_args = 0, response_sz = 1 +* output: args[0] = average c0 residency +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_SET_NBIO_DPM_LEVEL, num_args = 1, response_sz = 0 +* input: args[0] = nbioid[23:16] + max dpm level[15:8] + min dpm level[7:0] +*/ + {1 ,0 ,HSMP_SET }, + +/* +* HSMP_GET_NBIO_DPM_LEVEL, num_args = 1, response_sz = 1 +* input: args[0] = nbioid[23:16] +* output: args[0] = max dpm level[15:8] + min dpm level[7:0] +*/ + {1 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_DDR_BANDWIDTH, num_args = 0, response_sz = 1 +* output: args[0] = max bw in Gbps[31:20] + utilised bw in Gbps[19:8] + +* bw in percentage[7:0] +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_TEMP_MONITOR, num_args = 0, response_sz = 1 +* output: args[0] = temperature in degree celsius. [15:8] integer part + +* [7:5] fractional part +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_DIMM_TEMP_RANGE, num_args = 1, response_sz = 1 +* input: args[0] = DIMM address[7:0] +* output: args[0] = refresh rate[3] + temperature range[2:0] +*/ + {1 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_DIMM_POWER, num_args = 1, response_sz = 1 +* input: args[0] = DIMM address[7:0] +* output: args[0] = DIMM power in mW[31:17] + update rate in ms[16:8] + +* DIMM address[7:0] +*/ + {1 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_DIMM_THERMAL, num_args = 1, response_sz = 1 +* input: args[0] = DIMM address[7:0] +* output: args[0] = temperature in degree celsius[31:21] + update rate in ms[16:8] + +* DIMM address[7:0] +*/ + {1 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_SOCKET_FREQ_LIMIT, num_args = 0, response_sz = 1 +* output: args[0] = frequency in MHz[31:16] + frequency source[15:0] +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_CCLK_CORE_LIMIT, num_args = 1, response_sz = 1 +* input: args[0] = apic id [31:0] +* output: args[0] = frequency in MHz[31:0] +*/ + {1 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_RAILS_SVI, num_args = 0, response_sz = 1 +* output: args[0] = power in mW[31:0] +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_SOCKET_FMAX_FMIN, num_args = 0, response_sz = 1 +* output: args[0] = fmax in MHz[31:16] + fmin in MHz[15:0] +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_IOLINK_BANDWITH, num_args = 1, response_sz = 1 +* input: args[0] = link id[15:8] + bw type[2:0] +* output: args[0] = io bandwidth in Mbps[31:0] +*/ + {1 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_XGMI_BANDWITH, num_args = 1, response_sz = 1 +* input: args[0] = link id[15:8] + bw type[2:0] +* output: args[0] = xgmi bandwidth in Mbps[31:0] +*/ + {1 ,1 ,HSMP_GET }, + +/* +* HSMP_SET_GMI3_WIDTH, num_args = 1, response_sz = 0 +* input: args[0] = min link width[15:8] + max link width[7:0] +*/ + {1 ,0 ,HSMP_SET }, + +/* +* HSMP_SET_PCI_RATE, num_args = 1, response_sz = 1 +* input: args[0] = link rate control value +* output: args[0] = previous link rate control value +*/ + {1 ,1 ,HSMP_SET }, + +/* +* HSMP_SET_POWER_MODE, num_args = 1, response_sz = 0 +* input: args[0] = power efficiency mode[2:0] +*/ + {1 ,0 ,HSMP_SET }, + +/* +* HSMP_SET_PSTATE_MAX_MIN, num_args = 1, response_sz = 0 +* input: args[0] = min df pstate[15:8] + max df pstate[7:0] +*/ + {1 ,0 ,HSMP_SET }, + +/* +* HSMP_GET_METRIC_TABLE_VER, num_args = 0, response_sz = 1 +* output: args[0] = metrics table version +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_METRIC_TABLE, num_args = 0, response_sz = 0 +*/ + {0 ,0 ,HSMP_GET }, + +/* +* HSMP_GET_METRIC_TABLE_DRAM_ADDR, num_args = 0, response_sz = 2 +* output: args[0] = lower 32 bits of the address
Quoted 8 lines
drivers/platform/x86/amd/hsmp/hsmp.c line 287
Quoted 8 lines
drivers/platform/x86/amd/hsmp/hsmp.c +5
-0+* output: args[1] = upper 32 bits of the address +*/ + {0, 2, HSMP_GET}, +}; +/* * Send a message to the HSMP port via PCI-e config space registers * or by writing to MMIO space.
Thanks and Regards,
Suma
Ilpo Järvinen
maintainerQuoted 42 lines · Suma Hegde
Hi,
Quoted 31 lines · Ilpo Järvinen
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
Quoted 19 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
After the file got split, there are now W=1 warnings for users that include it without referencing
hsmp_msg_desc_table:In file included from
arch/x86/include/asm/amd_hsmp.h:6,from drivers/platform/x86/amd/hsmp/plat.c:12: arch/x86/include/uapi/asm/amd_hsmp.h:91:35: error: 'hsmp_msg_desc_table' defined but not used [-Werror=unused-const-variable=] 91 | static const struct hsmp_msg_desc hsmp_msg_desc_table[] = { | ^~~~~~~~~~~~~~~~~~~The array was never meant to be used by userspace code, but was left in the header as a reference for userspace programmers.
Move the contents of the array into the one file that actually needs it, and instead leave the URL of the new location in the uapi header in case anyone is looking for it.
Quoted 6 lines
Fixes e47c018a0ee6 ("platform/x86/amd/hsmp: Move platform device specificcode to
plat.c")Suggested-by Hans de Goede <[email protected]>Link:
https://lore.kernel.org/lkml/[email protected]/Signed-off-by Arnd Bergmann <[email protected]>Quoted 4 lines
Reviewed-by Ilpo Järvinen <[email protected]>I'll leave it into patchwork for a few days if somebody has some still unvoiced opinions on this.
AFAIK, Song Liu might be having some user space tool which makes use of this hsmp_msg_desc_table[].
Quoted 7 lines
Please refer
https://lore.kernel.org/platform-driver-x86/[email protected]/T/#mb563e1e07183e6bb5f85ab2cba4afe0deca1d3c3for the discussions on having this table in UAPI header.
@Song Liu, this table is moved to
hsmp.cnow. Please raise your concern here if any.
Given what that thread says about tests, I've decided to take careful approach of v1 instead of v2.
I'd still appreciate if Song Liu could confirm if this is relevant for some tests or not. We can proceed with the move to .c file later if it turns out unused.
Signature · 1 line
i.
Quoted 552 lines
Quoted 539 lines
Quoted 539 lines
arch/x86/include/uapi/asm/amd_hsmp.h | 255 ++------------------------- drivers/platform/x86/amd/hsmp/hsmp.c | 245 +++++++++++++++++++++++++ 2 files changed, 255 insertions(+), 245 deletions(-)arch/x86/include/uapi/asm/amd_hsmp.h +3
-0@@ -1,5 +1,15 @@/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* +* See hsmp_msg_desc_table[] in: +* https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/platform/x86/amd/hsmp.c
+ *
+ * for some information on number of input- and output arguments
+ * for the various functions.
+ *
+ * Please find the supported list of messages and message definition
+ * in the HSMP chapter of respective family/model PPR.
+ */
#ifndef _UAPI_ASM_X86_AMD_HSMP_H_
#define _UAPI_ASM_X86_AMD_HSMP_H_arch/x86/include/uapi/asm/amd_hsmp.h +0
-115@@ -81,251 +91,6 @@ struct hsmp_msg_desc {enum hsmp_msg_type type; }; -/* -* User may use these comments as reference, please find the -* supported list of messages and message definition in the -* HSMP chapter of respective family/model PPR. -* -* Not supported messages would return -ENOMSG. -*/ -static const struct hsmp_msg_desc hsmp_msg_desc_table[] = { -/* RESERVED */ - {0 ,0 ,HSMP_RSVD }, - -/* -* HSMP_TEST, num_args = 1, response_sz = 1 -* input: args[0] = xx -* output: args[0] = xx + 1 -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_SMU_VER, num_args = 0, response_sz = 1 -* output: args[0] = smu fw ver -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_PROTO_VER, num_args = 0, response_sz = 1 -* output: args[0] = proto version -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_SOCKET_POWER, num_args = 0, response_sz = 1 -* output: args[0] = socket power in mWatts -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_SET_SOCKET_POWER_LIMIT, num_args = 1, response_sz = 0 -* input: args[0] = power limit value in mWatts -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_GET_SOCKET_POWER_LIMIT, num_args = 0, response_sz = 1 -* output: args[0] = socket power limit value in mWatts -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_SOCKET_POWER_LIMIT_MAX, num_args = 0, response_sz = 1 -* output: args[0] = maximuam socket power limit in mWatts -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_SET_BOOST_LIMIT, num_args = 1, response_sz = 0 -* input: args[0] = apic id[31:16] + boost limit value in MHz[15:0] -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_SET_BOOST_LIMIT_SOCKET, num_args = 1, response_sz = 0 -* input: args[0] = boost limit value in MHz -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_GET_BOOST_LIMIT, num_args = 1, response_sz = 1 -* input: args[0] = apic id -* output: args[0] = boost limit value in MHz -*/ - {1 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_PROC_HOT, num_args = 0, response_sz = 1 -* output: args[0] = proc hot status -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_SET_XGMI_LINK_WIDTH, num_args = 1, response_sz = 0 -* input: args[0] = min link width[15:8] + max link width[7:0] -*/ - {1 ,0 ,HSMP_SET }, - -/* -* HSMP_SET_DF_PSTATE, num_args = 1, response_sz = 0 -* input: args[0] = df pstate[7:0] -*/ - {1 ,0 ,HSMP_SET }, - -/* HSMP_SET_AUTO_DF_PSTATE, num_args = 0, response_sz = 0 */ - {0 ,0 ,HSMP_SET }, - -/* -* HSMP_GET_FCLK_MCLK, num_args = 0, response_sz = 2 -* output: args[0] = fclk in MHz, args[1] = mclk in MHz -*/ - {0 ,2 ,HSMP_GET }, - -/* -* HSMP_GET_CCLK_THROTTLE_LIMIT, num_args = 0, response_sz = 1 -* output: args[0] = core clock in MHz -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_GET_C0_PERCENT, num_args = 0, response_sz = 1 -* output: args[0] = average c0 residency -*/ - {0 ,1 ,HSMP_GET }, - -/* -* HSMP_SET_NBIO_DPM_LEVEL, num_args = 1, response_sz = 0 -* input: args[0] = nbioid[23:16] + max dpm level[15:8] + min dpm level[7:0]
arch/x86/include/uapi/asm/amd_hsmp.h +0
-13-*/ - {1, 0, HSMP_SET}, - -/* -* HSMP_GET_NBIO_DPM_LEVEL, num_args = 1, response_sz = 1 -* input: args[0] = nbioid[23:16] -* output: args[0] = max dpm level[15:8] + min dpm level[7:0] -*/ - {1, 1, HSMP_GET}, - -/* -* HSMP_GET_DDR_BANDWIDTH, num_args = 0, response_sz = 1 -* output: args[0] = max bw in Gbps[31:20] + utilised bw in Gbps[19:8] +
arch/x86/include/uapi/asm/amd_hsmp.h +0
-7-* bw in percentage[7:0] -*/ - {0, 1, HSMP_GET}, - -/* -* HSMP_GET_TEMP_MONITOR, num_args = 0, response_sz = 1 -* output: args[0] = temperature in degree celsius. [15:8] integer part +
arch/x86/include/uapi/asm/amd_hsmp.h +0
-15-* [7:5] fractional part -*/ - {0, 1, HSMP_GET}, - -/* -* HSMP_GET_DIMM_TEMP_RANGE, num_args = 1, response_sz = 1 -* input: args[0] = DIMM address[7:0] -* output: args[0] = refresh rate[3] + temperature range[2:0] -*/ - {1, 1, HSMP_GET}, - -/* -* HSMP_GET_DIMM_POWER, num_args = 1, response_sz = 1 -* input: args[0] = DIMM address[7:0] -* output: args[0] = DIMM power in mW[31:17] + update rate in ms[16:8] +
arch/x86/include/uapi/asm/amd_hsmp.h +0
-8-* DIMM address[7:0] -*/ - {1, 1, HSMP_GET}, - -/* -* HSMP_GET_DIMM_THERMAL, num_args = 1, response_sz = 1 -* input: args[0] = DIMM address[7:0] -* output: args[0] = temperature in degree celsius[31:21] + update rate in ms[16:8] +
arch/x86/include/uapi/asm/amd_hsmp.h +0
-7-* DIMM address[7:0] -*/ - {1, 1, HSMP_GET}, - -/* -* HSMP_GET_SOCKET_FREQ_LIMIT, num_args = 0, response_sz = 1 -* output: args[0] = frequency in MHz[31:16] + frequency source[15:0]
arch/x86/include/uapi/asm/amd_hsmp.h +0
-80-*/ - {0, 1, HSMP_GET}, - -/* -* HSMP_GET_CCLK_CORE_LIMIT, num_args = 1, response_sz = 1 -* input: args[0] = apic id [31:0] -* output: args[0] = frequency in MHz[31:0] -*/ - {1, 1, HSMP_GET}, - -/* -* HSMP_GET_RAILS_SVI, num_args = 0, response_sz = 1 -* output: args[0] = power in mW[31:0] -*/ - {0, 1, HSMP_GET}, - -/* -* HSMP_GET_SOCKET_FMAX_FMIN, num_args = 0, response_sz = 1 -* output: args[0] = fmax in MHz[31:16] + fmin in MHz[15:0] -*/ - {0, 1, HSMP_GET}, - -/* -* HSMP_GET_IOLINK_BANDWITH, num_args = 1, response_sz = 1 -* input: args[0] = link id[15:8] + bw type[2:0] -* output: args[0] = io bandwidth in Mbps[31:0] -*/ - {1, 1, HSMP_GET}, - -/* -* HSMP_GET_XGMI_BANDWITH, num_args = 1, response_sz = 1 -* input: args[0] = link id[15:8] + bw type[2:0] -* output: args[0] = xgmi bandwidth in Mbps[31:0] -*/ - {1, 1, HSMP_GET}, - -/* -* HSMP_SET_GMI3_WIDTH, num_args = 1, response_sz = 0 -* input: args[0] = min link width[15:8] + max link width[7:0] -*/ - {1, 0, HSMP_SET}, - -/* -* HSMP_SET_PCI_RATE, num_args = 1, response_sz = 1 -* input: args[0] = link rate control value -* output: args[0] = previous link rate control value -*/ - {1, 1, HSMP_SET}, - -/* -* HSMP_SET_POWER_MODE, num_args = 1, response_sz = 0 -* input: args[0] = power efficiency mode[2:0] -*/ - {1, 0, HSMP_SET}, - -/* -* HSMP_SET_PSTATE_MAX_MIN, num_args = 1, response_sz = 0 -* input: args[0] = min df pstate[15:8] + max df pstate[7:0] -*/ - {1, 0, HSMP_SET}, - -/* -* HSMP_GET_METRIC_TABLE_VER, num_args = 0, response_sz = 1 -* output: args[0] = metrics table version -*/ - {0, 1, HSMP_GET}, - -/* -* HSMP_GET_METRIC_TABLE, num_args = 0, response_sz = 0 -*/ - {0, 0, HSMP_GET}, - -/* -* HSMP_GET_METRIC_TABLE_DRAM_ADDR, num_args = 0, response_sz = 2 -* output: args[0] = lower 32 bits of the address -* output: args[1] = upper 32 bits of the address -*/ - {0, 2, HSMP_GET}, -}; -/* Metrics table (supported only with proto version 6) */ struct hsmp_metric_table {__u32 accumulation_counter;drivers/platform/x86/amd/hsmp/hsmp.c +115
-0@@ -37,6 +37,251 @@static struct hsmp_plat_device hsmp_pdev; +/* +* User may use these comments as reference, please find the +* supported list of messages and message definition in the +* HSMP chapter of respective family/model PPR. +* +* Not supported messages would return -ENOMSG. +*/ +static const struct hsmp_msg_desc hsmp_msg_desc_table[] = { +/* RESERVED */ + {0 ,0 ,HSMP_RSVD }, + +/* +* HSMP_TEST, num_args = 1, response_sz = 1 +* input: args[0] = xx +* output: args[0] = xx + 1 +*/ + {1 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_SMU_VER, num_args = 0, response_sz = 1 +* output: args[0] = smu fw ver +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_PROTO_VER, num_args = 0, response_sz = 1 +* output: args[0] = proto version +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_SOCKET_POWER, num_args = 0, response_sz = 1 +* output: args[0] = socket power in mWatts +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_SET_SOCKET_POWER_LIMIT, num_args = 1, response_sz = 0 +* input: args[0] = power limit value in mWatts +*/ + {1 ,0 ,HSMP_SET }, + +/* +* HSMP_GET_SOCKET_POWER_LIMIT, num_args = 0, response_sz = 1 +* output: args[0] = socket power limit value in mWatts +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_SOCKET_POWER_LIMIT_MAX, num_args = 0, response_sz = 1 +* output: args[0] = maximuam socket power limit in mWatts +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_SET_BOOST_LIMIT, num_args = 1, response_sz = 0 +* input: args[0] = apic id[31:16] + boost limit value in MHz[15:0] +*/ + {1 ,0 ,HSMP_SET }, + +/* +* HSMP_SET_BOOST_LIMIT_SOCKET, num_args = 1, response_sz = 0 +* input: args[0] = boost limit value in MHz +*/ + {1 ,0 ,HSMP_SET }, + +/* +* HSMP_GET_BOOST_LIMIT, num_args = 1, response_sz = 1 +* input: args[0] = apic id +* output: args[0] = boost limit value in MHz +*/ + {1 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_PROC_HOT, num_args = 0, response_sz = 1 +* output: args[0] = proc hot status +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_SET_XGMI_LINK_WIDTH, num_args = 1, response_sz = 0 +* input: args[0] = min link width[15:8] + max link width[7:0] +*/ + {1 ,0 ,HSMP_SET }, + +/* +* HSMP_SET_DF_PSTATE, num_args = 1, response_sz = 0 +* input: args[0] = df pstate[7:0] +*/ + {1 ,0 ,HSMP_SET }, + +/* HSMP_SET_AUTO_DF_PSTATE, num_args = 0, response_sz = 0 */ + {0 ,0 ,HSMP_SET }, + +/* +* HSMP_GET_FCLK_MCLK, num_args = 0, response_sz = 2 +* output: args[0] = fclk in MHz, args[1] = mclk in MHz +*/ + {0 ,2 ,HSMP_GET }, + +/* +* HSMP_GET_CCLK_THROTTLE_LIMIT, num_args = 0, response_sz = 1 +* output: args[0] = core clock in MHz +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_GET_C0_PERCENT, num_args = 0, response_sz = 1 +* output: args[0] = average c0 residency +*/ + {0 ,1 ,HSMP_GET }, + +/* +* HSMP_SET_NBIO_DPM_LEVEL, num_args = 1, response_sz = 0 +* input: args[0] = nbioid[23:16] + max dpm level[15:8] + min dpm level[7:0]
drivers/platform/x86/amd/hsmp/hsmp.c +13
-0+*/ + {1, 0, HSMP_SET}, + +/* +* HSMP_GET_NBIO_DPM_LEVEL, num_args = 1, response_sz = 1 +* input: args[0] = nbioid[23:16] +* output: args[0] = max dpm level[15:8] + min dpm level[7:0] +*/ + {1, 1, HSMP_GET}, + +/* +* HSMP_GET_DDR_BANDWIDTH, num_args = 0, response_sz = 1 +* output: args[0] = max bw in Gbps[31:20] + utilised bw in Gbps[19:8] +
drivers/platform/x86/amd/hsmp/hsmp.c +7
-0+* bw in percentage[7:0] +*/ + {0, 1, HSMP_GET}, + +/* +* HSMP_GET_TEMP_MONITOR, num_args = 0, response_sz = 1 +* output: args[0] = temperature in degree celsius. [15:8] integer part +
drivers/platform/x86/amd/hsmp/hsmp.c +15
-0+* [7:5] fractional part +*/ + {0, 1, HSMP_GET}, + +/* +* HSMP_GET_DIMM_TEMP_RANGE, num_args = 1, response_sz = 1 +* input: args[0] = DIMM address[7:0] +* output: args[0] = refresh rate[3] + temperature range[2:0] +*/ + {1, 1, HSMP_GET}, + +/* +* HSMP_GET_DIMM_POWER, num_args = 1, response_sz = 1 +* input: args[0] = DIMM address[7:0] +* output: args[0] = DIMM power in mW[31:17] + update rate in ms[16:8] +
drivers/platform/x86/amd/hsmp/hsmp.c +8
-0+* DIMM address[7:0] +*/ + {1, 1, HSMP_GET}, + +/* +* HSMP_GET_DIMM_THERMAL, num_args = 1, response_sz = 1 +* input: args[0] = DIMM address[7:0] +* output: args[0] = temperature in degree celsius[31:21] + update rate in ms[16:8] +
drivers/platform/x86/amd/hsmp/hsmp.c +7
-0+* DIMM address[7:0] +*/ + {1, 1, HSMP_GET}, + +/* +* HSMP_GET_SOCKET_FREQ_LIMIT, num_args = 0, response_sz = 1 +* output: args[0] = frequency in MHz[31:16] + frequency source[15:0]
drivers/platform/x86/amd/hsmp/hsmp.c +75
-0+*/ + {0, 1, HSMP_GET}, + +/* +* HSMP_GET_CCLK_CORE_LIMIT, num_args = 1, response_sz = 1 +* input: args[0] = apic id [31:0] +* output: args[0] = frequency in MHz[31:0] +*/ + {1, 1, HSMP_GET}, + +/* +* HSMP_GET_RAILS_SVI, num_args = 0, response_sz = 1 +* output: args[0] = power in mW[31:0] +*/ + {0, 1, HSMP_GET}, + +/* +* HSMP_GET_SOCKET_FMAX_FMIN, num_args = 0, response_sz = 1 +* output: args[0] = fmax in MHz[31:16] + fmin in MHz[15:0] +*/ + {0, 1, HSMP_GET}, + +/* +* HSMP_GET_IOLINK_BANDWITH, num_args = 1, response_sz = 1 +* input: args[0] = link id[15:8] + bw type[2:0] +* output: args[0] = io bandwidth in Mbps[31:0] +*/ + {1, 1, HSMP_GET}, + +/* +* HSMP_GET_XGMI_BANDWITH, num_args = 1, response_sz = 1 +* input: args[0] = link id[15:8] + bw type[2:0] +* output: args[0] = xgmi bandwidth in Mbps[31:0] +*/ + {1, 1, HSMP_GET}, + +/* +* HSMP_SET_GMI3_WIDTH, num_args = 1, response_sz = 0 +* input: args[0] = min link width[15:8] + max link width[7:0] +*/ + {1, 0, HSMP_SET}, + +/* +* HSMP_SET_PCI_RATE, num_args = 1, response_sz = 1 +* input: args[0] = link rate control value +* output: args[0] = previous link rate control value +*/ + {1, 1, HSMP_SET}, + +/* +* HSMP_SET_POWER_MODE, num_args = 1, response_sz = 0 +* input: args[0] = power efficiency mode[2:0] +*/ + {1, 0, HSMP_SET}, + +/* +* HSMP_SET_PSTATE_MAX_MIN, num_args = 1, response_sz = 0 +* input: args[0] = min df pstate[15:8] + max df pstate[7:0] +*/ + {1, 0, HSMP_SET}, + +/* +* HSMP_GET_METRIC_TABLE_VER, num_args = 0, response_sz = 1 +* output: args[0] = metrics table version +*/ + {0, 1, HSMP_GET}, + +/* +* HSMP_GET_METRIC_TABLE, num_args = 0, response_sz = 0 +*/ + {0, 0, HSMP_GET}, + +/* +* HSMP_GET_METRIC_TABLE_DRAM_ADDR, num_args = 0, response_sz = 2 +* output: args[0] = lower 32 bits of the address Quoted 8 lines
drivers/platform/x86/amd/hsmp/hsmp.c line 287
Quoted 8 lines
drivers/platform/x86/amd/hsmp/hsmp.c +5
-0+* output: args[1] = upper 32 bits of the address +*/ + {0, 2, HSMP_GET}, +}; +/* * Send a message to the HSMP port via PCI-e config space registers * or by writing to MMIO space. Thanks and Regards,
Suma