Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/pm: Add STB accessors interface

Add interface to collect STB logs.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Luben Tuikov <luben.tuikov@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Andrey Grodzovsky and committed by
Alex Deucher
79aae67e ae360bf1

+33
+15
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h
··· 474 474 int map_to; 475 475 }; 476 476 477 + struct stb_context { 478 + uint32_t stb_buf_size; 479 + bool enabled; 480 + spinlock_t lock; 481 + }; 482 + 477 483 #define WORKLOAD_POLICY_MAX 7 478 484 struct smu_context 479 485 { ··· 567 561 uint16_t cpu_core_num; 568 562 569 563 struct smu_user_dpm_profile user_dpm_profile; 564 + 565 + struct stb_context stb_context; 570 566 }; 571 567 572 568 struct i2c_adapter; ··· 1276 1268 * @get_ecc_table: message SMU to get ECC INFO table. 1277 1269 */ 1278 1270 ssize_t (*get_ecc_info)(struct smu_context *smu, void *table); 1271 + 1272 + 1273 + /** 1274 + * @stb_collect_info: Collects Smart Trace Buffers data. 1275 + */ 1276 + int (*stb_collect_info)(struct smu_context *smu, void *buf, uint32_t size); 1279 1277 }; 1280 1278 1281 1279 typedef enum { ··· 1419 1405 int smu_wait_for_event(struct amdgpu_device *adev, enum smu_event_type event, 1420 1406 uint64_t event_arg); 1421 1407 int smu_get_ecc_info(struct smu_context *smu, void *umc_ecc); 1408 + int smu_stb_collect_info(struct smu_context *smu, void *buff, uint32_t size); 1422 1409 1423 1410 #endif 1424 1411 #endif
+18
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
··· 3175 3175 3176 3176 return ret; 3177 3177 } 3178 + 3179 + int smu_stb_collect_info(struct smu_context *smu, void *buf, uint32_t size) 3180 + { 3181 + 3182 + if (!smu->ppt_funcs->stb_collect_info || !smu->stb_context.enabled) 3183 + return -EOPNOTSUPP; 3184 + 3185 + /* Confirm the buffer allocated is of correct size */ 3186 + if (size != smu->stb_context.stb_buf_size) 3187 + return -EINVAL; 3188 + 3189 + /* 3190 + * No need to lock smu mutex as we access STB directly through MMIO 3191 + * and not going through SMU messaging route (for now at least). 3192 + * For registers access rely on implementation internal locking. 3193 + */ 3194 + return smu->ppt_funcs->stb_collect_info(smu, buf, size); 3195 + }