@@ -47,6 +47,9 @@ enum hsmp_message_ids {
4747 HSMP_SET_PCI_RATE , /* 20h Control link rate on PCIe devices */
4848 HSMP_SET_POWER_MODE , /* 21h Select power efficiency profile policy */
4949 HSMP_SET_PSTATE_MAX_MIN , /* 22h Set the max and min DF P-State */
50+ HSMP_GET_METRIC_TABLE_VER , /* 23h Get metrics table version */
51+ HSMP_GET_METRIC_TABLE , /* 24h Get metrics table */
52+ HSMP_GET_METRIC_TABLE_DRAM_ADDR ,/* 25h Get metrics table dram address */
5053 HSMP_MSG_ID_MAX ,
5154};
5255
@@ -64,6 +67,14 @@ enum hsmp_msg_type {
6467 HSMP_GET = 1 ,
6568};
6669
70+ enum hsmp_proto_versions {
71+ HSMP_PROTO_VER2 = 2 ,
72+ HSMP_PROTO_VER3 ,
73+ HSMP_PROTO_VER4 ,
74+ HSMP_PROTO_VER5 ,
75+ HSMP_PROTO_VER6
76+ };
77+
6778struct hsmp_msg_desc {
6879 int num_args ;
6980 int response_sz ;
@@ -295,6 +306,104 @@ static const struct hsmp_msg_desc hsmp_msg_desc_table[] = {
295306 * input: args[0] = min df pstate[15:8] + max df pstate[7:0]
296307 */
297308 {1 , 0 , HSMP_SET },
309+
310+ /*
311+ * HSMP_GET_METRIC_TABLE_VER, num_args = 0, response_sz = 1
312+ * output: args[0] = metrics table version
313+ */
314+ {0 , 1 , HSMP_GET },
315+
316+ /*
317+ * HSMP_GET_METRIC_TABLE, num_args = 0, response_sz = 0
318+ */
319+ {0 , 0 , HSMP_GET },
320+
321+ /*
322+ * HSMP_GET_METRIC_TABLE_DRAM_ADDR, num_args = 0, response_sz = 2
323+ * output: args[0] = lower 32 bits of the address
324+ * output: args[1] = upper 32 bits of the address
325+ */
326+ {0 , 2 , HSMP_GET },
327+ };
328+
329+ /* Metrics table (supported only with proto version 6) */
330+ struct hsmp_metric_table {
331+ __u32 accumulation_counter ;
332+
333+ /* TEMPERATURE */
334+ __u32 max_socket_temperature ;
335+ __u32 max_vr_temperature ;
336+ __u32 max_hbm_temperature ;
337+ __u64 max_socket_temperature_acc ;
338+ __u64 max_vr_temperature_acc ;
339+ __u64 max_hbm_temperature_acc ;
340+
341+ /* POWER */
342+ __u32 socket_power_limit ;
343+ __u32 max_socket_power_limit ;
344+ __u32 socket_power ;
345+
346+ /* ENERGY */
347+ __u64 timestamp ;
348+ __u64 socket_energy_acc ;
349+ __u64 ccd_energy_acc ;
350+ __u64 xcd_energy_acc ;
351+ __u64 aid_energy_acc ;
352+ __u64 hbm_energy_acc ;
353+
354+ /* FREQUENCY */
355+ __u32 cclk_frequency_limit ;
356+ __u32 gfxclk_frequency_limit ;
357+ __u32 fclk_frequency ;
358+ __u32 uclk_frequency ;
359+ __u32 socclk_frequency [4 ];
360+ __u32 vclk_frequency [4 ];
361+ __u32 dclk_frequency [4 ];
362+ __u32 lclk_frequency [4 ];
363+ __u64 gfxclk_frequency_acc [8 ];
364+ __u64 cclk_frequency_acc [96 ];
365+
366+ /* FREQUENCY RANGE */
367+ __u32 max_cclk_frequency ;
368+ __u32 min_cclk_frequency ;
369+ __u32 max_gfxclk_frequency ;
370+ __u32 min_gfxclk_frequency ;
371+ __u32 fclk_frequency_table [4 ];
372+ __u32 uclk_frequency_table [4 ];
373+ __u32 socclk_frequency_table [4 ];
374+ __u32 vclk_frequency_table [4 ];
375+ __u32 dclk_frequency_table [4 ];
376+ __u32 lclk_frequency_table [4 ];
377+ __u32 max_lclk_dpm_range ;
378+ __u32 min_lclk_dpm_range ;
379+
380+ /* XGMI */
381+ __u32 xgmi_width ;
382+ __u32 xgmi_bitrate ;
383+ __u64 xgmi_read_bandwidth_acc [8 ];
384+ __u64 xgmi_write_bandwidth_acc [8 ];
385+
386+ /* ACTIVITY */
387+ __u32 socket_c0_residency ;
388+ __u32 socket_gfx_busy ;
389+ __u32 dram_bandwidth_utilization ;
390+ __u64 socket_c0_residency_acc ;
391+ __u64 socket_gfx_busy_acc ;
392+ __u64 dram_bandwidth_acc ;
393+ __u32 max_dram_bandwidth ;
394+ __u64 dram_bandwidth_utilization_acc ;
395+ __u64 pcie_bandwidth_acc [4 ];
396+
397+ /* THROTTLERS */
398+ __u32 prochot_residency_acc ;
399+ __u32 ppt_residency_acc ;
400+ __u32 socket_thm_residency_acc ;
401+ __u32 vr_thm_residency_acc ;
402+ __u32 hbm_thm_residency_acc ;
403+ __u32 spare ;
404+
405+ /* New items at the end to maintain driver compatibility */
406+ __u32 gfxclk_frequency [8 ];
298407};
299408
300409/* Reset to default packing */
0 commit comments