hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/gpu/drm/amd/include/kgd_pp_interface.h
....@@ -92,8 +92,12 @@
9292 PP_SCLK,
9393 PP_MCLK,
9494 PP_PCIE,
95
+ PP_SOCCLK,
96
+ PP_FCLK,
97
+ PP_DCEFCLK,
9598 OD_SCLK,
9699 OD_MCLK,
100
+ OD_VDDC_CURVE,
97101 OD_RANGE,
98102 };
99103
....@@ -105,13 +109,21 @@
105109 AMDGPU_PP_SENSOR_UVD_DCLK,
106110 AMDGPU_PP_SENSOR_VCE_ECCLK,
107111 AMDGPU_PP_SENSOR_GPU_LOAD,
112
+ AMDGPU_PP_SENSOR_MEM_LOAD,
108113 AMDGPU_PP_SENSOR_GFX_MCLK,
109114 AMDGPU_PP_SENSOR_GPU_TEMP,
115
+ AMDGPU_PP_SENSOR_EDGE_TEMP = AMDGPU_PP_SENSOR_GPU_TEMP,
116
+ AMDGPU_PP_SENSOR_HOTSPOT_TEMP,
117
+ AMDGPU_PP_SENSOR_MEM_TEMP,
110118 AMDGPU_PP_SENSOR_VCE_POWER,
111119 AMDGPU_PP_SENSOR_UVD_POWER,
112120 AMDGPU_PP_SENSOR_GPU_POWER,
113121 AMDGPU_PP_SENSOR_STABLE_PSTATE_SCLK,
114122 AMDGPU_PP_SENSOR_STABLE_PSTATE_MCLK,
123
+ AMDGPU_PP_SENSOR_ENABLED_SMC_FEATURES_MASK,
124
+ AMDGPU_PP_SENSOR_MIN_FAN_RPM,
125
+ AMDGPU_PP_SENSOR_MAX_FAN_RPM,
126
+ AMDGPU_PP_SENSOR_VCN_POWER_STATE,
115127 };
116128
117129 enum amd_pp_task {
....@@ -123,12 +135,14 @@
123135 };
124136
125137 enum PP_SMC_POWER_PROFILE {
126
- PP_SMC_POWER_PROFILE_FULLSCREEN3D = 0x0,
127
- PP_SMC_POWER_PROFILE_POWERSAVING = 0x1,
128
- PP_SMC_POWER_PROFILE_VIDEO = 0x2,
129
- PP_SMC_POWER_PROFILE_VR = 0x3,
130
- PP_SMC_POWER_PROFILE_COMPUTE = 0x4,
131
- PP_SMC_POWER_PROFILE_CUSTOM = 0x5,
138
+ PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT = 0x0,
139
+ PP_SMC_POWER_PROFILE_FULLSCREEN3D = 0x1,
140
+ PP_SMC_POWER_PROFILE_POWERSAVING = 0x2,
141
+ PP_SMC_POWER_PROFILE_VIDEO = 0x3,
142
+ PP_SMC_POWER_PROFILE_VR = 0x4,
143
+ PP_SMC_POWER_PROFILE_COMPUTE = 0x5,
144
+ PP_SMC_POWER_PROFILE_CUSTOM = 0x6,
145
+ PP_SMC_POWER_PROFILE_COUNT,
132146 };
133147
134148 enum {
....@@ -141,6 +155,7 @@
141155 enum PP_OD_DPM_TABLE_COMMAND {
142156 PP_OD_EDIT_SCLK_VDDC_TABLE,
143157 PP_OD_EDIT_MCLK_VDDC_TABLE,
158
+ PP_OD_EDIT_VDDC_CURVE,
144159 PP_OD_RESTORE_DEFAULT_TABLE,
145160 PP_OD_COMMIT_DPM_TABLE
146161 };
....@@ -148,6 +163,25 @@
148163 struct pp_states_info {
149164 uint32_t nums;
150165 uint32_t states[16];
166
+};
167
+
168
+enum PP_HWMON_TEMP {
169
+ PP_TEMP_EDGE = 0,
170
+ PP_TEMP_JUNCTION,
171
+ PP_TEMP_MEM,
172
+ PP_TEMP_MAX
173
+};
174
+
175
+enum pp_mp1_state {
176
+ PP_MP1_STATE_NONE,
177
+ PP_MP1_STATE_SHUTDOWN,
178
+ PP_MP1_STATE_UNLOAD,
179
+ PP_MP1_STATE_RESET,
180
+};
181
+
182
+enum pp_df_cstate {
183
+ DF_CSTATE_DISALLOW = 0,
184
+ DF_CSTATE_ALLOW,
151185 };
152186
153187 #define PP_GROUP_MASK 0xF0000000
....@@ -185,6 +219,9 @@
185219 #define PP_CG_MSG_ID(group, block, support, state) \
186220 ((group) << PP_GROUP_SHIFT | (block) << PP_BLOCK_SHIFT | \
187221 (support) << PP_STATE_SUPPORT_SHIFT | (state) << PP_STATE_SHIFT)
222
+
223
+#define XGMI_MODE_PSTATE_D3 0
224
+#define XGMI_MODE_PSTATE_D0 1
188225
189226 struct seq_file;
190227 enum amd_pp_clock_type;
....@@ -225,6 +262,7 @@
225262 enum amd_dpm_forced_level (*get_performance_level)(void *handle);
226263 enum amd_pm_state_type (*get_current_power_state)(void *handle);
227264 int (*get_fan_speed_rpm)(void *handle, uint32_t *rpm);
265
+ int (*set_fan_speed_rpm)(void *handle, uint32_t rpm);
228266 int (*get_pp_num_states)(void *handle, struct pp_states_info *data);
229267 int (*get_pp_table)(void *handle, char **table);
230268 int (*set_pp_table)(void *handle, const char *buf, size_t size);
....@@ -243,7 +281,10 @@
243281 int (*get_power_limit)(void *handle, uint32_t *limit, bool default_limit);
244282 int (*get_power_profile_mode)(void *handle, char *buf);
245283 int (*set_power_profile_mode)(void *handle, long *input, uint32_t size);
284
+ int (*set_fine_grain_clk_vol)(void *handle, uint32_t type, long *input, uint32_t size);
246285 int (*odn_edit_dpm_table)(void *handle, uint32_t type, long *input, uint32_t size);
286
+ int (*set_mp1_state)(void *handle, enum pp_mp1_state mp1_state);
287
+ int (*smu_i2c_bus_access)(void *handle, bool acquire);
247288 /* export to DC */
248289 u32 (*get_sclk)(void *handle, bool low);
249290 u32 (*get_mclk)(void *handle, bool low);
....@@ -269,6 +310,128 @@
269310 int (*get_display_mode_validation_clocks)(void *handle,
270311 struct amd_pp_simple_clock_info *clocks);
271312 int (*notify_smu_enable_pwe)(void *handle);
313
+ int (*enable_mgpu_fan_boost)(void *handle);
314
+ int (*set_active_display_count)(void *handle, uint32_t count);
315
+ int (*set_hard_min_dcefclk_by_freq)(void *handle, uint32_t clock);
316
+ int (*set_hard_min_fclk_by_freq)(void *handle, uint32_t clock);
317
+ int (*set_min_deep_sleep_dcefclk)(void *handle, uint32_t clock);
318
+ int (*get_asic_baco_capability)(void *handle, bool *cap);
319
+ int (*get_asic_baco_state)(void *handle, int *state);
320
+ int (*set_asic_baco_state)(void *handle, int state);
321
+ int (*get_ppfeature_status)(void *handle, char *buf);
322
+ int (*set_ppfeature_status)(void *handle, uint64_t ppfeature_masks);
323
+ int (*asic_reset_mode_2)(void *handle);
324
+ int (*set_df_cstate)(void *handle, enum pp_df_cstate state);
325
+ int (*set_xgmi_pstate)(void *handle, uint32_t pstate);
326
+ ssize_t (*get_gpu_metrics)(void *handle, void **table);
327
+};
328
+
329
+struct metrics_table_header {
330
+ uint16_t structure_size;
331
+ uint8_t format_revision;
332
+ uint8_t content_revision;
333
+};
334
+
335
+struct gpu_metrics_v1_0 {
336
+ struct metrics_table_header common_header;
337
+
338
+ /* Driver attached timestamp (in ns) */
339
+ uint64_t system_clock_counter;
340
+
341
+ /* Temperature */
342
+ uint16_t temperature_edge;
343
+ uint16_t temperature_hotspot;
344
+ uint16_t temperature_mem;
345
+ uint16_t temperature_vrgfx;
346
+ uint16_t temperature_vrsoc;
347
+ uint16_t temperature_vrmem;
348
+
349
+ /* Utilization */
350
+ uint16_t average_gfx_activity;
351
+ uint16_t average_umc_activity; // memory controller
352
+ uint16_t average_mm_activity; // UVD or VCN
353
+
354
+ /* Power/Energy */
355
+ uint16_t average_socket_power;
356
+ uint32_t energy_accumulator;
357
+
358
+ /* Average clocks */
359
+ uint16_t average_gfxclk_frequency;
360
+ uint16_t average_socclk_frequency;
361
+ uint16_t average_uclk_frequency;
362
+ uint16_t average_vclk0_frequency;
363
+ uint16_t average_dclk0_frequency;
364
+ uint16_t average_vclk1_frequency;
365
+ uint16_t average_dclk1_frequency;
366
+
367
+ /* Current clocks */
368
+ uint16_t current_gfxclk;
369
+ uint16_t current_socclk;
370
+ uint16_t current_uclk;
371
+ uint16_t current_vclk0;
372
+ uint16_t current_dclk0;
373
+ uint16_t current_vclk1;
374
+ uint16_t current_dclk1;
375
+
376
+ /* Throttle status */
377
+ uint32_t throttle_status;
378
+
379
+ /* Fans */
380
+ uint16_t current_fan_speed;
381
+
382
+ /* Link width/speed */
383
+ uint8_t pcie_link_width;
384
+ uint8_t pcie_link_speed; // in 0.1 GT/s
385
+};
386
+
387
+struct gpu_metrics_v2_0 {
388
+ struct metrics_table_header common_header;
389
+
390
+ /* Driver attached timestamp (in ns) */
391
+ uint64_t system_clock_counter;
392
+
393
+ /* Temperature */
394
+ uint16_t temperature_gfx; // gfx temperature on APUs
395
+ uint16_t temperature_soc; // soc temperature on APUs
396
+ uint16_t temperature_core[8]; // CPU core temperature on APUs
397
+ uint16_t temperature_l3[2];
398
+
399
+ /* Utilization */
400
+ uint16_t average_gfx_activity;
401
+ uint16_t average_mm_activity; // UVD or VCN
402
+
403
+ /* Power/Energy */
404
+ uint16_t average_socket_power; // dGPU + APU power on A + A platform
405
+ uint16_t average_cpu_power;
406
+ uint16_t average_soc_power;
407
+ uint16_t average_gfx_power;
408
+ uint16_t average_core_power[8]; // CPU core power on APUs
409
+
410
+ /* Average clocks */
411
+ uint16_t average_gfxclk_frequency;
412
+ uint16_t average_socclk_frequency;
413
+ uint16_t average_uclk_frequency;
414
+ uint16_t average_fclk_frequency;
415
+ uint16_t average_vclk_frequency;
416
+ uint16_t average_dclk_frequency;
417
+
418
+ /* Current clocks */
419
+ uint16_t current_gfxclk;
420
+ uint16_t current_socclk;
421
+ uint16_t current_uclk;
422
+ uint16_t current_fclk;
423
+ uint16_t current_vclk;
424
+ uint16_t current_dclk;
425
+ uint16_t current_coreclk[8]; // CPU core clocks
426
+ uint16_t current_l3clk[2];
427
+
428
+ /* Throttle status */
429
+ uint32_t throttle_status;
430
+
431
+ /* Fans */
432
+ uint16_t fan_pwm;
433
+
434
+ uint16_t padding;
272435 };
273436
274437 #endif