kgd_pp_interface.h 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261
  1. /*
  2. * Copyright 2017 Advanced Micro Devices, Inc.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. * OTHER DEALINGS IN THE SOFTWARE.
  21. *
  22. */
  23. #ifndef __KGD_PP_INTERFACE_H__
  24. #define __KGD_PP_INTERFACE_H__
  25. extern const struct amdgpu_ip_block_version pp_smu_ip_block;
  26. extern const struct amdgpu_ip_block_version smu_v11_0_ip_block;
  27. extern const struct amdgpu_ip_block_version smu_v12_0_ip_block;
  28. extern const struct amdgpu_ip_block_version smu_v13_0_ip_block;
  29. extern const struct amdgpu_ip_block_version smu_v14_0_ip_block;
  30. enum smu_event_type {
  31. SMU_EVENT_RESET_COMPLETE = 0,
  32. };
  33. struct amd_vce_state {
  34. /* vce clocks */
  35. u32 evclk;
  36. u32 ecclk;
  37. /* gpu clocks */
  38. u32 sclk;
  39. u32 mclk;
  40. u8 clk_idx;
  41. u8 pstate;
  42. };
  43. enum amd_dpm_forced_level {
  44. AMD_DPM_FORCED_LEVEL_AUTO = 0x1,
  45. AMD_DPM_FORCED_LEVEL_MANUAL = 0x2,
  46. AMD_DPM_FORCED_LEVEL_LOW = 0x4,
  47. AMD_DPM_FORCED_LEVEL_HIGH = 0x8,
  48. AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD = 0x10,
  49. AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK = 0x20,
  50. AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK = 0x40,
  51. AMD_DPM_FORCED_LEVEL_PROFILE_PEAK = 0x80,
  52. AMD_DPM_FORCED_LEVEL_PROFILE_EXIT = 0x100,
  53. AMD_DPM_FORCED_LEVEL_PERF_DETERMINISM = 0x200,
  54. };
  55. enum amd_pm_state_type {
  56. /* not used for dpm */
  57. POWER_STATE_TYPE_DEFAULT,
  58. POWER_STATE_TYPE_POWERSAVE,
  59. /* user selectable states */
  60. POWER_STATE_TYPE_BATTERY,
  61. POWER_STATE_TYPE_BALANCED,
  62. POWER_STATE_TYPE_PERFORMANCE,
  63. /* internal states */
  64. POWER_STATE_TYPE_INTERNAL_UVD,
  65. POWER_STATE_TYPE_INTERNAL_UVD_SD,
  66. POWER_STATE_TYPE_INTERNAL_UVD_HD,
  67. POWER_STATE_TYPE_INTERNAL_UVD_HD2,
  68. POWER_STATE_TYPE_INTERNAL_UVD_MVC,
  69. POWER_STATE_TYPE_INTERNAL_BOOT,
  70. POWER_STATE_TYPE_INTERNAL_THERMAL,
  71. POWER_STATE_TYPE_INTERNAL_ACPI,
  72. POWER_STATE_TYPE_INTERNAL_ULV,
  73. POWER_STATE_TYPE_INTERNAL_3DPERF,
  74. };
  75. #define AMD_MAX_VCE_LEVELS 6
  76. enum amd_vce_level {
  77. AMD_VCE_LEVEL_AC_ALL = 0, /* AC, All cases */
  78. AMD_VCE_LEVEL_DC_EE = 1, /* DC, entropy encoding */
  79. AMD_VCE_LEVEL_DC_LL_LOW = 2, /* DC, low latency queue, res <= 720 */
  80. AMD_VCE_LEVEL_DC_LL_HIGH = 3, /* DC, low latency queue, 1080 >= res > 720 */
  81. AMD_VCE_LEVEL_DC_GP_LOW = 4, /* DC, general purpose queue, res <= 720 */
  82. AMD_VCE_LEVEL_DC_GP_HIGH = 5, /* DC, general purpose queue, 1080 >= res > 720 */
  83. };
  84. enum amd_fan_ctrl_mode {
  85. AMD_FAN_CTRL_NONE = 0,
  86. AMD_FAN_CTRL_MANUAL = 1,
  87. AMD_FAN_CTRL_AUTO = 2,
  88. };
  89. enum pp_clock_type {
  90. PP_SCLK,
  91. PP_MCLK,
  92. PP_PCIE,
  93. PP_SOCCLK,
  94. PP_FCLK,
  95. PP_DCEFCLK,
  96. PP_VCLK,
  97. PP_VCLK1,
  98. PP_DCLK,
  99. PP_DCLK1,
  100. OD_SCLK,
  101. OD_MCLK,
  102. OD_VDDC_CURVE,
  103. OD_RANGE,
  104. OD_VDDGFX_OFFSET,
  105. OD_CCLK,
  106. OD_FAN_CURVE,
  107. OD_ACOUSTIC_LIMIT,
  108. OD_ACOUSTIC_TARGET,
  109. OD_FAN_TARGET_TEMPERATURE,
  110. OD_FAN_MINIMUM_PWM,
  111. };
  112. enum amd_pp_sensors {
  113. AMDGPU_PP_SENSOR_GFX_SCLK = 0,
  114. AMDGPU_PP_SENSOR_CPU_CLK,
  115. AMDGPU_PP_SENSOR_VDDNB,
  116. AMDGPU_PP_SENSOR_VDDGFX,
  117. AMDGPU_PP_SENSOR_UVD_VCLK,
  118. AMDGPU_PP_SENSOR_UVD_DCLK,
  119. AMDGPU_PP_SENSOR_VCE_ECCLK,
  120. AMDGPU_PP_SENSOR_GPU_LOAD,
  121. AMDGPU_PP_SENSOR_MEM_LOAD,
  122. AMDGPU_PP_SENSOR_GFX_MCLK,
  123. AMDGPU_PP_SENSOR_GPU_TEMP,
  124. AMDGPU_PP_SENSOR_EDGE_TEMP = AMDGPU_PP_SENSOR_GPU_TEMP,
  125. AMDGPU_PP_SENSOR_HOTSPOT_TEMP,
  126. AMDGPU_PP_SENSOR_MEM_TEMP,
  127. AMDGPU_PP_SENSOR_VCE_POWER,
  128. AMDGPU_PP_SENSOR_UVD_POWER,
  129. AMDGPU_PP_SENSOR_GPU_AVG_POWER,
  130. AMDGPU_PP_SENSOR_GPU_INPUT_POWER,
  131. AMDGPU_PP_SENSOR_SS_APU_SHARE,
  132. AMDGPU_PP_SENSOR_SS_DGPU_SHARE,
  133. AMDGPU_PP_SENSOR_STABLE_PSTATE_SCLK,
  134. AMDGPU_PP_SENSOR_STABLE_PSTATE_MCLK,
  135. AMDGPU_PP_SENSOR_ENABLED_SMC_FEATURES_MASK,
  136. AMDGPU_PP_SENSOR_MIN_FAN_RPM,
  137. AMDGPU_PP_SENSOR_MAX_FAN_RPM,
  138. AMDGPU_PP_SENSOR_VCN_POWER_STATE,
  139. AMDGPU_PP_SENSOR_PEAK_PSTATE_SCLK,
  140. AMDGPU_PP_SENSOR_PEAK_PSTATE_MCLK,
  141. AMDGPU_PP_SENSOR_VCN_LOAD,
  142. };
  143. enum amd_pp_task {
  144. AMD_PP_TASK_DISPLAY_CONFIG_CHANGE,
  145. AMD_PP_TASK_ENABLE_USER_STATE,
  146. AMD_PP_TASK_READJUST_POWER_STATE,
  147. AMD_PP_TASK_COMPLETE_INIT,
  148. AMD_PP_TASK_MAX
  149. };
  150. enum PP_SMC_POWER_PROFILE {
  151. PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT = 0x0,
  152. PP_SMC_POWER_PROFILE_FULLSCREEN3D = 0x1,
  153. PP_SMC_POWER_PROFILE_POWERSAVING = 0x2,
  154. PP_SMC_POWER_PROFILE_VIDEO = 0x3,
  155. PP_SMC_POWER_PROFILE_VR = 0x4,
  156. PP_SMC_POWER_PROFILE_COMPUTE = 0x5,
  157. PP_SMC_POWER_PROFILE_CUSTOM = 0x6,
  158. PP_SMC_POWER_PROFILE_WINDOW3D = 0x7,
  159. PP_SMC_POWER_PROFILE_CAPPED = 0x8,
  160. PP_SMC_POWER_PROFILE_UNCAPPED = 0x9,
  161. PP_SMC_POWER_PROFILE_COUNT,
  162. };
  163. extern const char * const amdgpu_pp_profile_name[PP_SMC_POWER_PROFILE_COUNT];
  164. enum {
  165. PP_GROUP_UNKNOWN = 0,
  166. PP_GROUP_GFX = 1,
  167. PP_GROUP_SYS,
  168. PP_GROUP_MAX
  169. };
  170. enum PP_OD_DPM_TABLE_COMMAND {
  171. PP_OD_EDIT_SCLK_VDDC_TABLE,
  172. PP_OD_EDIT_MCLK_VDDC_TABLE,
  173. PP_OD_EDIT_CCLK_VDDC_TABLE,
  174. PP_OD_EDIT_VDDC_CURVE,
  175. PP_OD_RESTORE_DEFAULT_TABLE,
  176. PP_OD_COMMIT_DPM_TABLE,
  177. PP_OD_EDIT_VDDGFX_OFFSET,
  178. PP_OD_EDIT_FAN_CURVE,
  179. PP_OD_EDIT_ACOUSTIC_LIMIT,
  180. PP_OD_EDIT_ACOUSTIC_TARGET,
  181. PP_OD_EDIT_FAN_TARGET_TEMPERATURE,
  182. PP_OD_EDIT_FAN_MINIMUM_PWM,
  183. };
  184. struct pp_states_info {
  185. uint32_t nums;
  186. uint32_t states[16];
  187. };
  188. enum PP_HWMON_TEMP {
  189. PP_TEMP_EDGE = 0,
  190. PP_TEMP_JUNCTION,
  191. PP_TEMP_MEM,
  192. PP_TEMP_MAX
  193. };
  194. enum pp_mp1_state {
  195. PP_MP1_STATE_NONE,
  196. PP_MP1_STATE_SHUTDOWN,
  197. PP_MP1_STATE_UNLOAD,
  198. PP_MP1_STATE_RESET,
  199. PP_MP1_STATE_FLR,
  200. };
  201. enum pp_df_cstate {
  202. DF_CSTATE_DISALLOW = 0,
  203. DF_CSTATE_ALLOW,
  204. };
  205. /**
  206. * DOC: amdgpu_pp_power
  207. *
  208. * APU power is managed to system-level requirements through the PPT
  209. * (package power tracking) feature. PPT is intended to limit power to the
  210. * requirements of the power source and could be dynamically updated to
  211. * maximize APU performance within the system power budget.
  212. *
  213. * Two types of power measurement can be requested, where supported, with
  214. * :c:type:`enum pp_power_type <pp_power_type>`.
  215. */
  216. /**
  217. * enum pp_power_limit_level - Used to query the power limits
  218. *
  219. * @PP_PWR_LIMIT_MIN: Minimum Power Limit
  220. * @PP_PWR_LIMIT_CURRENT: Current Power Limit
  221. * @PP_PWR_LIMIT_DEFAULT: Default Power Limit
  222. * @PP_PWR_LIMIT_MAX: Maximum Power Limit
  223. */
  224. enum pp_power_limit_level {
  225. PP_PWR_LIMIT_MIN = -1,
  226. PP_PWR_LIMIT_CURRENT,
  227. PP_PWR_LIMIT_DEFAULT,
  228. PP_PWR_LIMIT_MAX,
  229. };
  230. /**
  231. * enum pp_power_type - Used to specify the type of the requested power
  232. *
  233. * @PP_PWR_TYPE_SUSTAINED: manages the configurable, thermally significant
  234. * moving average of APU power (default ~5000 ms).
  235. * @PP_PWR_TYPE_FAST: manages the ~10 ms moving average of APU power,
  236. * where supported.
  237. */
  238. enum pp_power_type {
  239. PP_PWR_TYPE_SUSTAINED,
  240. PP_PWR_TYPE_FAST,
  241. };
  242. enum pp_xgmi_plpd_mode {
  243. XGMI_PLPD_NONE = -1,
  244. XGMI_PLPD_DISALLOW,
  245. XGMI_PLPD_DEFAULT,
  246. XGMI_PLPD_OPTIMIZED,
  247. XGMI_PLPD_COUNT,
  248. };
  249. enum pp_pm_policy {
  250. PP_PM_POLICY_NONE = -1,
  251. PP_PM_POLICY_SOC_PSTATE = 0,
  252. PP_PM_POLICY_XGMI_PLPD,
  253. PP_PM_POLICY_NUM,
  254. };
  255. enum pp_policy_soc_pstate {
  256. SOC_PSTATE_DEFAULT = 0,
  257. SOC_PSTATE_0,
  258. SOC_PSTATE_1,
  259. SOC_PSTATE_2,
  260. SOC_PSTAT_COUNT,
  261. };
  262. #define PP_POLICY_MAX_LEVELS 5
  263. #define PP_GROUP_MASK 0xF0000000
  264. #define PP_GROUP_SHIFT 28
  265. #define PP_BLOCK_MASK 0x0FFFFF00
  266. #define PP_BLOCK_SHIFT 8
  267. #define PP_BLOCK_GFX_CG 0x01
  268. #define PP_BLOCK_GFX_MG 0x02
  269. #define PP_BLOCK_GFX_3D 0x04
  270. #define PP_BLOCK_GFX_RLC 0x08
  271. #define PP_BLOCK_GFX_CP 0x10
  272. #define PP_BLOCK_SYS_BIF 0x01
  273. #define PP_BLOCK_SYS_MC 0x02
  274. #define PP_BLOCK_SYS_ROM 0x04
  275. #define PP_BLOCK_SYS_DRM 0x08
  276. #define PP_BLOCK_SYS_HDP 0x10
  277. #define PP_BLOCK_SYS_SDMA 0x20
  278. #define PP_STATE_MASK 0x0000000F
  279. #define PP_STATE_SHIFT 0
  280. #define PP_STATE_SUPPORT_MASK 0x000000F0
  281. #define PP_STATE_SUPPORT_SHIFT 0
  282. #define PP_STATE_CG 0x01
  283. #define PP_STATE_LS 0x02
  284. #define PP_STATE_DS 0x04
  285. #define PP_STATE_SD 0x08
  286. #define PP_STATE_SUPPORT_CG 0x10
  287. #define PP_STATE_SUPPORT_LS 0x20
  288. #define PP_STATE_SUPPORT_DS 0x40
  289. #define PP_STATE_SUPPORT_SD 0x80
  290. #define PP_CG_MSG_ID(group, block, support, state) \
  291. ((group) << PP_GROUP_SHIFT | (block) << PP_BLOCK_SHIFT | \
  292. (support) << PP_STATE_SUPPORT_SHIFT | (state) << PP_STATE_SHIFT)
  293. #define XGMI_MODE_PSTATE_D3 0
  294. #define XGMI_MODE_PSTATE_D0 1
  295. #define NUM_HBM_INSTANCES 4
  296. #define NUM_XGMI_LINKS 8
  297. #define MAX_GFX_CLKS 8
  298. #define MAX_CLKS 4
  299. #define NUM_VCN 4
  300. #define NUM_JPEG_ENG 32
  301. struct seq_file;
  302. enum amd_pp_clock_type;
  303. struct amd_pp_simple_clock_info;
  304. struct amd_pp_display_configuration;
  305. struct amd_pp_clock_info;
  306. struct pp_display_clock_request;
  307. struct pp_clock_levels_with_voltage;
  308. struct pp_clock_levels_with_latency;
  309. struct amd_pp_clocks;
  310. struct pp_smu_wm_range_sets;
  311. struct pp_smu_nv_clock_table;
  312. struct dpm_clocks;
  313. struct amd_pm_funcs {
  314. /* export for dpm on ci and si */
  315. int (*pre_set_power_state)(void *handle);
  316. int (*set_power_state)(void *handle);
  317. void (*post_set_power_state)(void *handle);
  318. void (*display_configuration_changed)(void *handle);
  319. void (*print_power_state)(void *handle, void *ps);
  320. bool (*vblank_too_short)(void *handle);
  321. void (*enable_bapm)(void *handle, bool enable);
  322. int (*check_state_equal)(void *handle,
  323. void *cps,
  324. void *rps,
  325. bool *equal);
  326. /* export for sysfs */
  327. int (*set_fan_control_mode)(void *handle, u32 mode);
  328. int (*get_fan_control_mode)(void *handle, u32 *fan_mode);
  329. int (*set_fan_speed_pwm)(void *handle, u32 speed);
  330. int (*get_fan_speed_pwm)(void *handle, u32 *speed);
  331. int (*force_clock_level)(void *handle, enum pp_clock_type type, uint32_t mask);
  332. int (*print_clock_levels)(void *handle, enum pp_clock_type type, char *buf);
  333. int (*emit_clock_levels)(void *handle, enum pp_clock_type type, char *buf, int *offset);
  334. int (*force_performance_level)(void *handle, enum amd_dpm_forced_level level);
  335. int (*get_sclk_od)(void *handle);
  336. int (*set_sclk_od)(void *handle, uint32_t value);
  337. int (*get_mclk_od)(void *handle);
  338. int (*set_mclk_od)(void *handle, uint32_t value);
  339. int (*read_sensor)(void *handle, int idx, void *value, int *size);
  340. int (*get_apu_thermal_limit)(void *handle, uint32_t *limit);
  341. int (*set_apu_thermal_limit)(void *handle, uint32_t limit);
  342. enum amd_dpm_forced_level (*get_performance_level)(void *handle);
  343. enum amd_pm_state_type (*get_current_power_state)(void *handle);
  344. int (*get_fan_speed_rpm)(void *handle, uint32_t *rpm);
  345. int (*set_fan_speed_rpm)(void *handle, uint32_t rpm);
  346. int (*get_pp_num_states)(void *handle, struct pp_states_info *data);
  347. int (*get_pp_table)(void *handle, char **table);
  348. int (*set_pp_table)(void *handle, const char *buf, size_t size);
  349. void (*debugfs_print_current_performance_level)(void *handle, struct seq_file *m);
  350. int (*switch_power_profile)(void *handle, enum PP_SMC_POWER_PROFILE type, bool en);
  351. /* export to amdgpu */
  352. struct amd_vce_state *(*get_vce_clock_state)(void *handle, u32 idx);
  353. int (*dispatch_tasks)(void *handle, enum amd_pp_task task_id,
  354. enum amd_pm_state_type *user_state);
  355. int (*load_firmware)(void *handle);
  356. int (*wait_for_fw_loading_complete)(void *handle);
  357. int (*set_powergating_by_smu)(void *handle,
  358. uint32_t block_type, bool gate);
  359. int (*set_clockgating_by_smu)(void *handle, uint32_t msg_id);
  360. int (*set_power_limit)(void *handle, uint32_t n);
  361. int (*get_power_limit)(void *handle, uint32_t *limit,
  362. enum pp_power_limit_level pp_limit_level,
  363. enum pp_power_type power_type);
  364. int (*get_power_profile_mode)(void *handle, char *buf);
  365. int (*set_power_profile_mode)(void *handle, long *input, uint32_t size);
  366. int (*set_fine_grain_clk_vol)(void *handle, uint32_t type, long *input, uint32_t size);
  367. int (*odn_edit_dpm_table)(void *handle, enum PP_OD_DPM_TABLE_COMMAND type,
  368. long *input, uint32_t size);
  369. int (*set_mp1_state)(void *handle, enum pp_mp1_state mp1_state);
  370. int (*smu_i2c_bus_access)(void *handle, bool acquire);
  371. int (*gfx_state_change_set)(void *handle, uint32_t state);
  372. /* export to DC */
  373. u32 (*get_sclk)(void *handle, bool low);
  374. u32 (*get_mclk)(void *handle, bool low);
  375. int (*display_configuration_change)(void *handle,
  376. const struct amd_pp_display_configuration *input);
  377. int (*get_display_power_level)(void *handle,
  378. struct amd_pp_simple_clock_info *output);
  379. int (*get_current_clocks)(void *handle,
  380. struct amd_pp_clock_info *clocks);
  381. int (*get_clock_by_type)(void *handle,
  382. enum amd_pp_clock_type type,
  383. struct amd_pp_clocks *clocks);
  384. int (*get_clock_by_type_with_latency)(void *handle,
  385. enum amd_pp_clock_type type,
  386. struct pp_clock_levels_with_latency *clocks);
  387. int (*get_clock_by_type_with_voltage)(void *handle,
  388. enum amd_pp_clock_type type,
  389. struct pp_clock_levels_with_voltage *clocks);
  390. int (*set_watermarks_for_clocks_ranges)(void *handle,
  391. void *clock_ranges);
  392. int (*display_clock_voltage_request)(void *handle,
  393. struct pp_display_clock_request *clock);
  394. int (*get_display_mode_validation_clocks)(void *handle,
  395. struct amd_pp_simple_clock_info *clocks);
  396. int (*notify_smu_enable_pwe)(void *handle);
  397. int (*enable_mgpu_fan_boost)(void *handle);
  398. int (*set_active_display_count)(void *handle, uint32_t count);
  399. int (*set_hard_min_dcefclk_by_freq)(void *handle, uint32_t clock);
  400. int (*set_hard_min_fclk_by_freq)(void *handle, uint32_t clock);
  401. int (*set_min_deep_sleep_dcefclk)(void *handle, uint32_t clock);
  402. int (*get_asic_baco_capability)(void *handle);
  403. int (*get_asic_baco_state)(void *handle, int *state);
  404. int (*set_asic_baco_state)(void *handle, int state);
  405. int (*get_ppfeature_status)(void *handle, char *buf);
  406. int (*set_ppfeature_status)(void *handle, uint64_t ppfeature_masks);
  407. int (*asic_reset_mode_2)(void *handle);
  408. int (*asic_reset_enable_gfx_features)(void *handle);
  409. int (*set_df_cstate)(void *handle, enum pp_df_cstate state);
  410. int (*set_xgmi_pstate)(void *handle, uint32_t pstate);
  411. ssize_t (*get_gpu_metrics)(void *handle, void **table);
  412. ssize_t (*get_pm_metrics)(void *handle, void *pmmetrics, size_t size);
  413. int (*set_watermarks_for_clock_ranges)(void *handle,
  414. struct pp_smu_wm_range_sets *ranges);
  415. int (*display_disable_memory_clock_switch)(void *handle,
  416. bool disable_memory_clock_switch);
  417. int (*get_max_sustainable_clocks_by_dc)(void *handle,
  418. struct pp_smu_nv_clock_table *max_clocks);
  419. int (*get_uclk_dpm_states)(void *handle,
  420. unsigned int *clock_values_in_khz,
  421. unsigned int *num_states);
  422. int (*get_dpm_clock_table)(void *handle,
  423. struct dpm_clocks *clock_table);
  424. int (*get_smu_prv_buf_details)(void *handle, void **addr, size_t *size);
  425. void (*pm_compute_clocks)(void *handle);
  426. int (*notify_rlc_state)(void *handle, bool en);
  427. };
  428. struct metrics_table_header {
  429. uint16_t structure_size;
  430. uint8_t format_revision;
  431. uint8_t content_revision;
  432. };
  433. /*
  434. * gpu_metrics_v1_0 is not recommended as it's not naturally aligned.
  435. * Use gpu_metrics_v1_1 or later instead.
  436. */
  437. struct gpu_metrics_v1_0 {
  438. struct metrics_table_header common_header;
  439. /* Driver attached timestamp (in ns) */
  440. uint64_t system_clock_counter;
  441. /* Temperature */
  442. uint16_t temperature_edge;
  443. uint16_t temperature_hotspot;
  444. uint16_t temperature_mem;
  445. uint16_t temperature_vrgfx;
  446. uint16_t temperature_vrsoc;
  447. uint16_t temperature_vrmem;
  448. /* Utilization */
  449. uint16_t average_gfx_activity;
  450. uint16_t average_umc_activity; // memory controller
  451. uint16_t average_mm_activity; // UVD or VCN
  452. /* Power/Energy */
  453. uint16_t average_socket_power;
  454. uint32_t energy_accumulator;
  455. /* Average clocks */
  456. uint16_t average_gfxclk_frequency;
  457. uint16_t average_socclk_frequency;
  458. uint16_t average_uclk_frequency;
  459. uint16_t average_vclk0_frequency;
  460. uint16_t average_dclk0_frequency;
  461. uint16_t average_vclk1_frequency;
  462. uint16_t average_dclk1_frequency;
  463. /* Current clocks */
  464. uint16_t current_gfxclk;
  465. uint16_t current_socclk;
  466. uint16_t current_uclk;
  467. uint16_t current_vclk0;
  468. uint16_t current_dclk0;
  469. uint16_t current_vclk1;
  470. uint16_t current_dclk1;
  471. /* Throttle status */
  472. uint32_t throttle_status;
  473. /* Fans */
  474. uint16_t current_fan_speed;
  475. /* Link width/speed */
  476. uint8_t pcie_link_width;
  477. uint8_t pcie_link_speed; // in 0.1 GT/s
  478. };
  479. struct gpu_metrics_v1_1 {
  480. struct metrics_table_header common_header;
  481. /* Temperature */
  482. uint16_t temperature_edge;
  483. uint16_t temperature_hotspot;
  484. uint16_t temperature_mem;
  485. uint16_t temperature_vrgfx;
  486. uint16_t temperature_vrsoc;
  487. uint16_t temperature_vrmem;
  488. /* Utilization */
  489. uint16_t average_gfx_activity;
  490. uint16_t average_umc_activity; // memory controller
  491. uint16_t average_mm_activity; // UVD or VCN
  492. /* Power/Energy */
  493. uint16_t average_socket_power;
  494. uint64_t energy_accumulator;
  495. /* Driver attached timestamp (in ns) */
  496. uint64_t system_clock_counter;
  497. /* Average clocks */
  498. uint16_t average_gfxclk_frequency;
  499. uint16_t average_socclk_frequency;
  500. uint16_t average_uclk_frequency;
  501. uint16_t average_vclk0_frequency;
  502. uint16_t average_dclk0_frequency;
  503. uint16_t average_vclk1_frequency;
  504. uint16_t average_dclk1_frequency;
  505. /* Current clocks */
  506. uint16_t current_gfxclk;
  507. uint16_t current_socclk;
  508. uint16_t current_uclk;
  509. uint16_t current_vclk0;
  510. uint16_t current_dclk0;
  511. uint16_t current_vclk1;
  512. uint16_t current_dclk1;
  513. /* Throttle status */
  514. uint32_t throttle_status;
  515. /* Fans */
  516. uint16_t current_fan_speed;
  517. /* Link width/speed */
  518. uint16_t pcie_link_width;
  519. uint16_t pcie_link_speed; // in 0.1 GT/s
  520. uint16_t padding;
  521. uint32_t gfx_activity_acc;
  522. uint32_t mem_activity_acc;
  523. uint16_t temperature_hbm[NUM_HBM_INSTANCES];
  524. };
  525. struct gpu_metrics_v1_2 {
  526. struct metrics_table_header common_header;
  527. /* Temperature */
  528. uint16_t temperature_edge;
  529. uint16_t temperature_hotspot;
  530. uint16_t temperature_mem;
  531. uint16_t temperature_vrgfx;
  532. uint16_t temperature_vrsoc;
  533. uint16_t temperature_vrmem;
  534. /* Utilization */
  535. uint16_t average_gfx_activity;
  536. uint16_t average_umc_activity; // memory controller
  537. uint16_t average_mm_activity; // UVD or VCN
  538. /* Power/Energy */
  539. uint16_t average_socket_power;
  540. uint64_t energy_accumulator;
  541. /* Driver attached timestamp (in ns) */
  542. uint64_t system_clock_counter;
  543. /* Average clocks */
  544. uint16_t average_gfxclk_frequency;
  545. uint16_t average_socclk_frequency;
  546. uint16_t average_uclk_frequency;
  547. uint16_t average_vclk0_frequency;
  548. uint16_t average_dclk0_frequency;
  549. uint16_t average_vclk1_frequency;
  550. uint16_t average_dclk1_frequency;
  551. /* Current clocks */
  552. uint16_t current_gfxclk;
  553. uint16_t current_socclk;
  554. uint16_t current_uclk;
  555. uint16_t current_vclk0;
  556. uint16_t current_dclk0;
  557. uint16_t current_vclk1;
  558. uint16_t current_dclk1;
  559. /* Throttle status (ASIC dependent) */
  560. uint32_t throttle_status;
  561. /* Fans */
  562. uint16_t current_fan_speed;
  563. /* Link width/speed */
  564. uint16_t pcie_link_width;
  565. uint16_t pcie_link_speed; // in 0.1 GT/s
  566. uint16_t padding;
  567. uint32_t gfx_activity_acc;
  568. uint32_t mem_activity_acc;
  569. uint16_t temperature_hbm[NUM_HBM_INSTANCES];
  570. /* PMFW attached timestamp (10ns resolution) */
  571. uint64_t firmware_timestamp;
  572. };
  573. struct gpu_metrics_v1_3 {
  574. struct metrics_table_header common_header;
  575. /* Temperature */
  576. uint16_t temperature_edge;
  577. uint16_t temperature_hotspot;
  578. uint16_t temperature_mem;
  579. uint16_t temperature_vrgfx;
  580. uint16_t temperature_vrsoc;
  581. uint16_t temperature_vrmem;
  582. /* Utilization */
  583. uint16_t average_gfx_activity;
  584. uint16_t average_umc_activity; // memory controller
  585. uint16_t average_mm_activity; // UVD or VCN
  586. /* Power/Energy */
  587. uint16_t average_socket_power;
  588. uint64_t energy_accumulator;
  589. /* Driver attached timestamp (in ns) */
  590. uint64_t system_clock_counter;
  591. /* Average clocks */
  592. uint16_t average_gfxclk_frequency;
  593. uint16_t average_socclk_frequency;
  594. uint16_t average_uclk_frequency;
  595. uint16_t average_vclk0_frequency;
  596. uint16_t average_dclk0_frequency;
  597. uint16_t average_vclk1_frequency;
  598. uint16_t average_dclk1_frequency;
  599. /* Current clocks */
  600. uint16_t current_gfxclk;
  601. uint16_t current_socclk;
  602. uint16_t current_uclk;
  603. uint16_t current_vclk0;
  604. uint16_t current_dclk0;
  605. uint16_t current_vclk1;
  606. uint16_t current_dclk1;
  607. /* Throttle status */
  608. uint32_t throttle_status;
  609. /* Fans */
  610. uint16_t current_fan_speed;
  611. /* Link width/speed */
  612. uint16_t pcie_link_width;
  613. uint16_t pcie_link_speed; // in 0.1 GT/s
  614. uint16_t padding;
  615. uint32_t gfx_activity_acc;
  616. uint32_t mem_activity_acc;
  617. uint16_t temperature_hbm[NUM_HBM_INSTANCES];
  618. /* PMFW attached timestamp (10ns resolution) */
  619. uint64_t firmware_timestamp;
  620. /* Voltage (mV) */
  621. uint16_t voltage_soc;
  622. uint16_t voltage_gfx;
  623. uint16_t voltage_mem;
  624. uint16_t padding1;
  625. /* Throttle status (ASIC independent) */
  626. uint64_t indep_throttle_status;
  627. };
  628. struct gpu_metrics_v1_4 {
  629. struct metrics_table_header common_header;
  630. /* Temperature (Celsius) */
  631. uint16_t temperature_hotspot;
  632. uint16_t temperature_mem;
  633. uint16_t temperature_vrsoc;
  634. /* Power (Watts) */
  635. uint16_t curr_socket_power;
  636. /* Utilization (%) */
  637. uint16_t average_gfx_activity;
  638. uint16_t average_umc_activity; // memory controller
  639. uint16_t vcn_activity[NUM_VCN];
  640. /* Energy (15.259uJ (2^-16) units) */
  641. uint64_t energy_accumulator;
  642. /* Driver attached timestamp (in ns) */
  643. uint64_t system_clock_counter;
  644. /* Throttle status */
  645. uint32_t throttle_status;
  646. /* Clock Lock Status. Each bit corresponds to clock instance */
  647. uint32_t gfxclk_lock_status;
  648. /* Link width (number of lanes) and speed (in 0.1 GT/s) */
  649. uint16_t pcie_link_width;
  650. uint16_t pcie_link_speed;
  651. /* XGMI bus width and bitrate (in Gbps) */
  652. uint16_t xgmi_link_width;
  653. uint16_t xgmi_link_speed;
  654. /* Utilization Accumulated (%) */
  655. uint32_t gfx_activity_acc;
  656. uint32_t mem_activity_acc;
  657. /*PCIE accumulated bandwidth (GB/sec) */
  658. uint64_t pcie_bandwidth_acc;
  659. /*PCIE instantaneous bandwidth (GB/sec) */
  660. uint64_t pcie_bandwidth_inst;
  661. /* PCIE L0 to recovery state transition accumulated count */
  662. uint64_t pcie_l0_to_recov_count_acc;
  663. /* PCIE replay accumulated count */
  664. uint64_t pcie_replay_count_acc;
  665. /* PCIE replay rollover accumulated count */
  666. uint64_t pcie_replay_rover_count_acc;
  667. /* XGMI accumulated data transfer size(KiloBytes) */
  668. uint64_t xgmi_read_data_acc[NUM_XGMI_LINKS];
  669. uint64_t xgmi_write_data_acc[NUM_XGMI_LINKS];
  670. /* PMFW attached timestamp (10ns resolution) */
  671. uint64_t firmware_timestamp;
  672. /* Current clocks (Mhz) */
  673. uint16_t current_gfxclk[MAX_GFX_CLKS];
  674. uint16_t current_socclk[MAX_CLKS];
  675. uint16_t current_vclk0[MAX_CLKS];
  676. uint16_t current_dclk0[MAX_CLKS];
  677. uint16_t current_uclk;
  678. uint16_t padding;
  679. };
  680. struct gpu_metrics_v1_5 {
  681. struct metrics_table_header common_header;
  682. /* Temperature (Celsius) */
  683. uint16_t temperature_hotspot;
  684. uint16_t temperature_mem;
  685. uint16_t temperature_vrsoc;
  686. /* Power (Watts) */
  687. uint16_t curr_socket_power;
  688. /* Utilization (%) */
  689. uint16_t average_gfx_activity;
  690. uint16_t average_umc_activity; // memory controller
  691. uint16_t vcn_activity[NUM_VCN];
  692. uint16_t jpeg_activity[NUM_JPEG_ENG];
  693. /* Energy (15.259uJ (2^-16) units) */
  694. uint64_t energy_accumulator;
  695. /* Driver attached timestamp (in ns) */
  696. uint64_t system_clock_counter;
  697. /* Throttle status */
  698. uint32_t throttle_status;
  699. /* Clock Lock Status. Each bit corresponds to clock instance */
  700. uint32_t gfxclk_lock_status;
  701. /* Link width (number of lanes) and speed (in 0.1 GT/s) */
  702. uint16_t pcie_link_width;
  703. uint16_t pcie_link_speed;
  704. /* XGMI bus width and bitrate (in Gbps) */
  705. uint16_t xgmi_link_width;
  706. uint16_t xgmi_link_speed;
  707. /* Utilization Accumulated (%) */
  708. uint32_t gfx_activity_acc;
  709. uint32_t mem_activity_acc;
  710. /*PCIE accumulated bandwidth (GB/sec) */
  711. uint64_t pcie_bandwidth_acc;
  712. /*PCIE instantaneous bandwidth (GB/sec) */
  713. uint64_t pcie_bandwidth_inst;
  714. /* PCIE L0 to recovery state transition accumulated count */
  715. uint64_t pcie_l0_to_recov_count_acc;
  716. /* PCIE replay accumulated count */
  717. uint64_t pcie_replay_count_acc;
  718. /* PCIE replay rollover accumulated count */
  719. uint64_t pcie_replay_rover_count_acc;
  720. /* PCIE NAK sent accumulated count */
  721. uint32_t pcie_nak_sent_count_acc;
  722. /* PCIE NAK received accumulated count */
  723. uint32_t pcie_nak_rcvd_count_acc;
  724. /* XGMI accumulated data transfer size(KiloBytes) */
  725. uint64_t xgmi_read_data_acc[NUM_XGMI_LINKS];
  726. uint64_t xgmi_write_data_acc[NUM_XGMI_LINKS];
  727. /* PMFW attached timestamp (10ns resolution) */
  728. uint64_t firmware_timestamp;
  729. /* Current clocks (Mhz) */
  730. uint16_t current_gfxclk[MAX_GFX_CLKS];
  731. uint16_t current_socclk[MAX_CLKS];
  732. uint16_t current_vclk0[MAX_CLKS];
  733. uint16_t current_dclk0[MAX_CLKS];
  734. uint16_t current_uclk;
  735. uint16_t padding;
  736. };
  737. /*
  738. * gpu_metrics_v2_0 is not recommended as it's not naturally aligned.
  739. * Use gpu_metrics_v2_1 or later instead.
  740. */
  741. struct gpu_metrics_v2_0 {
  742. struct metrics_table_header common_header;
  743. /* Driver attached timestamp (in ns) */
  744. uint64_t system_clock_counter;
  745. /* Temperature */
  746. uint16_t temperature_gfx; // gfx temperature on APUs
  747. uint16_t temperature_soc; // soc temperature on APUs
  748. uint16_t temperature_core[8]; // CPU core temperature on APUs
  749. uint16_t temperature_l3[2];
  750. /* Utilization */
  751. uint16_t average_gfx_activity;
  752. uint16_t average_mm_activity; // UVD or VCN
  753. /* Power/Energy */
  754. uint16_t average_socket_power; // dGPU + APU power on A + A platform
  755. uint16_t average_cpu_power;
  756. uint16_t average_soc_power;
  757. uint16_t average_gfx_power;
  758. uint16_t average_core_power[8]; // CPU core power on APUs
  759. /* Average clocks */
  760. uint16_t average_gfxclk_frequency;
  761. uint16_t average_socclk_frequency;
  762. uint16_t average_uclk_frequency;
  763. uint16_t average_fclk_frequency;
  764. uint16_t average_vclk_frequency;
  765. uint16_t average_dclk_frequency;
  766. /* Current clocks */
  767. uint16_t current_gfxclk;
  768. uint16_t current_socclk;
  769. uint16_t current_uclk;
  770. uint16_t current_fclk;
  771. uint16_t current_vclk;
  772. uint16_t current_dclk;
  773. uint16_t current_coreclk[8]; // CPU core clocks
  774. uint16_t current_l3clk[2];
  775. /* Throttle status */
  776. uint32_t throttle_status;
  777. /* Fans */
  778. uint16_t fan_pwm;
  779. uint16_t padding;
  780. };
  781. struct gpu_metrics_v2_1 {
  782. struct metrics_table_header common_header;
  783. /* Temperature */
  784. uint16_t temperature_gfx; // gfx temperature on APUs
  785. uint16_t temperature_soc; // soc temperature on APUs
  786. uint16_t temperature_core[8]; // CPU core temperature on APUs
  787. uint16_t temperature_l3[2];
  788. /* Utilization */
  789. uint16_t average_gfx_activity;
  790. uint16_t average_mm_activity; // UVD or VCN
  791. /* Driver attached timestamp (in ns) */
  792. uint64_t system_clock_counter;
  793. /* Power/Energy */
  794. uint16_t average_socket_power; // dGPU + APU power on A + A platform
  795. uint16_t average_cpu_power;
  796. uint16_t average_soc_power;
  797. uint16_t average_gfx_power;
  798. uint16_t average_core_power[8]; // CPU core power on APUs
  799. /* Average clocks */
  800. uint16_t average_gfxclk_frequency;
  801. uint16_t average_socclk_frequency;
  802. uint16_t average_uclk_frequency;
  803. uint16_t average_fclk_frequency;
  804. uint16_t average_vclk_frequency;
  805. uint16_t average_dclk_frequency;
  806. /* Current clocks */
  807. uint16_t current_gfxclk;
  808. uint16_t current_socclk;
  809. uint16_t current_uclk;
  810. uint16_t current_fclk;
  811. uint16_t current_vclk;
  812. uint16_t current_dclk;
  813. uint16_t current_coreclk[8]; // CPU core clocks
  814. uint16_t current_l3clk[2];
  815. /* Throttle status */
  816. uint32_t throttle_status;
  817. /* Fans */
  818. uint16_t fan_pwm;
  819. uint16_t padding[3];
  820. };
  821. struct gpu_metrics_v2_2 {
  822. struct metrics_table_header common_header;
  823. /* Temperature */
  824. uint16_t temperature_gfx; // gfx temperature on APUs
  825. uint16_t temperature_soc; // soc temperature on APUs
  826. uint16_t temperature_core[8]; // CPU core temperature on APUs
  827. uint16_t temperature_l3[2];
  828. /* Utilization */
  829. uint16_t average_gfx_activity;
  830. uint16_t average_mm_activity; // UVD or VCN
  831. /* Driver attached timestamp (in ns) */
  832. uint64_t system_clock_counter;
  833. /* Power/Energy */
  834. uint16_t average_socket_power; // dGPU + APU power on A + A platform
  835. uint16_t average_cpu_power;
  836. uint16_t average_soc_power;
  837. uint16_t average_gfx_power;
  838. uint16_t average_core_power[8]; // CPU core power on APUs
  839. /* Average clocks */
  840. uint16_t average_gfxclk_frequency;
  841. uint16_t average_socclk_frequency;
  842. uint16_t average_uclk_frequency;
  843. uint16_t average_fclk_frequency;
  844. uint16_t average_vclk_frequency;
  845. uint16_t average_dclk_frequency;
  846. /* Current clocks */
  847. uint16_t current_gfxclk;
  848. uint16_t current_socclk;
  849. uint16_t current_uclk;
  850. uint16_t current_fclk;
  851. uint16_t current_vclk;
  852. uint16_t current_dclk;
  853. uint16_t current_coreclk[8]; // CPU core clocks
  854. uint16_t current_l3clk[2];
  855. /* Throttle status (ASIC dependent) */
  856. uint32_t throttle_status;
  857. /* Fans */
  858. uint16_t fan_pwm;
  859. uint16_t padding[3];
  860. /* Throttle status (ASIC independent) */
  861. uint64_t indep_throttle_status;
  862. };
  863. struct gpu_metrics_v2_3 {
  864. struct metrics_table_header common_header;
  865. /* Temperature */
  866. uint16_t temperature_gfx; // gfx temperature on APUs
  867. uint16_t temperature_soc; // soc temperature on APUs
  868. uint16_t temperature_core[8]; // CPU core temperature on APUs
  869. uint16_t temperature_l3[2];
  870. /* Utilization */
  871. uint16_t average_gfx_activity;
  872. uint16_t average_mm_activity; // UVD or VCN
  873. /* Driver attached timestamp (in ns) */
  874. uint64_t system_clock_counter;
  875. /* Power/Energy */
  876. uint16_t average_socket_power; // dGPU + APU power on A + A platform
  877. uint16_t average_cpu_power;
  878. uint16_t average_soc_power;
  879. uint16_t average_gfx_power;
  880. uint16_t average_core_power[8]; // CPU core power on APUs
  881. /* Average clocks */
  882. uint16_t average_gfxclk_frequency;
  883. uint16_t average_socclk_frequency;
  884. uint16_t average_uclk_frequency;
  885. uint16_t average_fclk_frequency;
  886. uint16_t average_vclk_frequency;
  887. uint16_t average_dclk_frequency;
  888. /* Current clocks */
  889. uint16_t current_gfxclk;
  890. uint16_t current_socclk;
  891. uint16_t current_uclk;
  892. uint16_t current_fclk;
  893. uint16_t current_vclk;
  894. uint16_t current_dclk;
  895. uint16_t current_coreclk[8]; // CPU core clocks
  896. uint16_t current_l3clk[2];
  897. /* Throttle status (ASIC dependent) */
  898. uint32_t throttle_status;
  899. /* Fans */
  900. uint16_t fan_pwm;
  901. uint16_t padding[3];
  902. /* Throttle status (ASIC independent) */
  903. uint64_t indep_throttle_status;
  904. /* Average Temperature */
  905. uint16_t average_temperature_gfx; // average gfx temperature on APUs
  906. uint16_t average_temperature_soc; // average soc temperature on APUs
  907. uint16_t average_temperature_core[8]; // average CPU core temperature on APUs
  908. uint16_t average_temperature_l3[2];
  909. };
  910. struct gpu_metrics_v2_4 {
  911. struct metrics_table_header common_header;
  912. /* Temperature (unit: centi-Celsius) */
  913. uint16_t temperature_gfx;
  914. uint16_t temperature_soc;
  915. uint16_t temperature_core[8];
  916. uint16_t temperature_l3[2];
  917. /* Utilization (unit: centi) */
  918. uint16_t average_gfx_activity;
  919. uint16_t average_mm_activity;
  920. /* Driver attached timestamp (in ns) */
  921. uint64_t system_clock_counter;
  922. /* Power/Energy (unit: mW) */
  923. uint16_t average_socket_power;
  924. uint16_t average_cpu_power;
  925. uint16_t average_soc_power;
  926. uint16_t average_gfx_power;
  927. uint16_t average_core_power[8];
  928. /* Average clocks (unit: MHz) */
  929. uint16_t average_gfxclk_frequency;
  930. uint16_t average_socclk_frequency;
  931. uint16_t average_uclk_frequency;
  932. uint16_t average_fclk_frequency;
  933. uint16_t average_vclk_frequency;
  934. uint16_t average_dclk_frequency;
  935. /* Current clocks (unit: MHz) */
  936. uint16_t current_gfxclk;
  937. uint16_t current_socclk;
  938. uint16_t current_uclk;
  939. uint16_t current_fclk;
  940. uint16_t current_vclk;
  941. uint16_t current_dclk;
  942. uint16_t current_coreclk[8];
  943. uint16_t current_l3clk[2];
  944. /* Throttle status (ASIC dependent) */
  945. uint32_t throttle_status;
  946. /* Fans */
  947. uint16_t fan_pwm;
  948. uint16_t padding[3];
  949. /* Throttle status (ASIC independent) */
  950. uint64_t indep_throttle_status;
  951. /* Average Temperature (unit: centi-Celsius) */
  952. uint16_t average_temperature_gfx;
  953. uint16_t average_temperature_soc;
  954. uint16_t average_temperature_core[8];
  955. uint16_t average_temperature_l3[2];
  956. /* Power/Voltage (unit: mV) */
  957. uint16_t average_cpu_voltage;
  958. uint16_t average_soc_voltage;
  959. uint16_t average_gfx_voltage;
  960. /* Power/Current (unit: mA) */
  961. uint16_t average_cpu_current;
  962. uint16_t average_soc_current;
  963. uint16_t average_gfx_current;
  964. };
  965. struct gpu_metrics_v3_0 {
  966. struct metrics_table_header common_header;
  967. /* Temperature */
  968. /* gfx temperature on APUs */
  969. uint16_t temperature_gfx;
  970. /* soc temperature on APUs */
  971. uint16_t temperature_soc;
  972. /* CPU core temperature on APUs */
  973. uint16_t temperature_core[16];
  974. /* skin temperature on APUs */
  975. uint16_t temperature_skin;
  976. /* Utilization */
  977. /* time filtered GFX busy % [0-100] */
  978. uint16_t average_gfx_activity;
  979. /* time filtered VCN busy % [0-100] */
  980. uint16_t average_vcn_activity;
  981. /* time filtered IPU per-column busy % [0-100] */
  982. uint16_t average_ipu_activity[8];
  983. /* time filtered per-core C0 residency % [0-100]*/
  984. uint16_t average_core_c0_activity[16];
  985. /* time filtered DRAM read bandwidth [MB/sec] */
  986. uint16_t average_dram_reads;
  987. /* time filtered DRAM write bandwidth [MB/sec] */
  988. uint16_t average_dram_writes;
  989. /* time filtered IPU read bandwidth [MB/sec] */
  990. uint16_t average_ipu_reads;
  991. /* time filtered IPU write bandwidth [MB/sec] */
  992. uint16_t average_ipu_writes;
  993. /* Driver attached timestamp (in ns) */
  994. uint64_t system_clock_counter;
  995. /* Power/Energy */
  996. /* time filtered power used for PPT/STAPM [APU+dGPU] [mW] */
  997. uint32_t average_socket_power;
  998. /* time filtered IPU power [mW] */
  999. uint16_t average_ipu_power;
  1000. /* time filtered APU power [mW] */
  1001. uint32_t average_apu_power;
  1002. /* time filtered GFX power [mW] */
  1003. uint32_t average_gfx_power;
  1004. /* time filtered dGPU power [mW] */
  1005. uint32_t average_dgpu_power;
  1006. /* time filtered sum of core power across all cores in the socket [mW] */
  1007. uint32_t average_all_core_power;
  1008. /* calculated core power [mW] */
  1009. uint16_t average_core_power[16];
  1010. /* time filtered total system power [mW] */
  1011. uint16_t average_sys_power;
  1012. /* maximum IRM defined STAPM power limit [mW] */
  1013. uint16_t stapm_power_limit;
  1014. /* time filtered STAPM power limit [mW] */
  1015. uint16_t current_stapm_power_limit;
  1016. /* time filtered clocks [MHz] */
  1017. uint16_t average_gfxclk_frequency;
  1018. uint16_t average_socclk_frequency;
  1019. uint16_t average_vpeclk_frequency;
  1020. uint16_t average_ipuclk_frequency;
  1021. uint16_t average_fclk_frequency;
  1022. uint16_t average_vclk_frequency;
  1023. uint16_t average_uclk_frequency;
  1024. uint16_t average_mpipu_frequency;
  1025. /* Current clocks */
  1026. /* target core frequency [MHz] */
  1027. uint16_t current_coreclk[16];
  1028. /* CCLK frequency limit enforced on classic cores [MHz] */
  1029. uint16_t current_core_maxfreq;
  1030. /* GFXCLK frequency limit enforced on GFX [MHz] */
  1031. uint16_t current_gfx_maxfreq;
  1032. /* Throttle Residency (ASIC dependent) */
  1033. uint32_t throttle_residency_prochot;
  1034. uint32_t throttle_residency_spl;
  1035. uint32_t throttle_residency_fppt;
  1036. uint32_t throttle_residency_sppt;
  1037. uint32_t throttle_residency_thm_core;
  1038. uint32_t throttle_residency_thm_gfx;
  1039. uint32_t throttle_residency_thm_soc;
  1040. /* Metrics table alpha filter time constant [us] */
  1041. uint32_t time_filter_alphavalue;
  1042. };
  1043. struct amdgpu_pmmetrics_header {
  1044. uint16_t structure_size;
  1045. uint16_t pad;
  1046. uint32_t mp1_ip_discovery_version;
  1047. uint32_t pmfw_version;
  1048. uint32_t pmmetrics_version;
  1049. };
  1050. struct amdgpu_pm_metrics {
  1051. struct amdgpu_pmmetrics_header common_header;
  1052. uint8_t data[];
  1053. };
  1054. #endif