Commit 79aae67e authored by Andrey Grodzovsky's avatar Andrey Grodzovsky Committed by Alex Deucher

drm/amd/pm: Add STB accessors interface

Add interface to collect STB logs.
Signed-off-by: default avatarAndrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: default avatarLijo Lazar <lijo.lazar@amd.com>
Reviewed-by: default avatarLuben Tuikov <luben.tuikov@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent ae360bf1
...@@ -474,6 +474,12 @@ struct cmn2asic_mapping { ...@@ -474,6 +474,12 @@ struct cmn2asic_mapping {
int map_to; int map_to;
}; };
struct stb_context {
uint32_t stb_buf_size;
bool enabled;
spinlock_t lock;
};
#define WORKLOAD_POLICY_MAX 7 #define WORKLOAD_POLICY_MAX 7
struct smu_context struct smu_context
{ {
...@@ -561,6 +567,8 @@ struct smu_context ...@@ -561,6 +567,8 @@ struct smu_context
uint16_t cpu_core_num; uint16_t cpu_core_num;
struct smu_user_dpm_profile user_dpm_profile; struct smu_user_dpm_profile user_dpm_profile;
struct stb_context stb_context;
}; };
struct i2c_adapter; struct i2c_adapter;
...@@ -1268,6 +1276,12 @@ struct pptable_funcs { ...@@ -1268,6 +1276,12 @@ struct pptable_funcs {
* @get_ecc_table: message SMU to get ECC INFO table. * @get_ecc_table: message SMU to get ECC INFO table.
*/ */
ssize_t (*get_ecc_info)(struct smu_context *smu, void *table); ssize_t (*get_ecc_info)(struct smu_context *smu, void *table);
/**
* @stb_collect_info: Collects Smart Trace Buffers data.
*/
int (*stb_collect_info)(struct smu_context *smu, void *buf, uint32_t size);
}; };
typedef enum { typedef enum {
...@@ -1405,6 +1419,7 @@ int smu_set_light_sbr(struct smu_context *smu, bool enable); ...@@ -1405,6 +1419,7 @@ int smu_set_light_sbr(struct smu_context *smu, bool enable);
int smu_wait_for_event(struct amdgpu_device *adev, enum smu_event_type event, int smu_wait_for_event(struct amdgpu_device *adev, enum smu_event_type event,
uint64_t event_arg); uint64_t event_arg);
int smu_get_ecc_info(struct smu_context *smu, void *umc_ecc); int smu_get_ecc_info(struct smu_context *smu, void *umc_ecc);
int smu_stb_collect_info(struct smu_context *smu, void *buff, uint32_t size);
#endif #endif
#endif #endif
...@@ -3175,3 +3175,21 @@ int smu_wait_for_event(struct amdgpu_device *adev, enum smu_event_type event, ...@@ -3175,3 +3175,21 @@ int smu_wait_for_event(struct amdgpu_device *adev, enum smu_event_type event,
return ret; return ret;
} }
int smu_stb_collect_info(struct smu_context *smu, void *buf, uint32_t size)
{
if (!smu->ppt_funcs->stb_collect_info || !smu->stb_context.enabled)
return -EOPNOTSUPP;
/* Confirm the buffer allocated is of correct size */
if (size != smu->stb_context.stb_buf_size)
return -EINVAL;
/*
* No need to lock smu mutex as we access STB directly through MMIO
* and not going through SMU messaging route (for now at least).
* For registers access rely on implementation internal locking.
*/
return smu->ppt_funcs->stb_collect_info(smu, buf, size);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment