summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
diff options
context:
space:
mode:
authorEvan Quan <evan.quan@amd.com>2019-07-11 10:23:17 +0800
committerAlex Deucher <alexander.deucher@amd.com>2019-07-18 14:18:07 -0500
commit7e01a2ec96bf8a149c5e83d0352cf6ea286275cf (patch)
tree1c3056f2bb447a3137b5af65cc0f9cdccd81721a /drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
parenta08a4dae7a11d6665c8d2a49a2c01e8a71a18955 (diff)
drm/amd/powerplay: correct SW SMU valid mapping check
Current implementation is not actually able to detect invalid message/table/workload mapping. Signed-off-by: Evan Quan <evan.quan@amd.com> Reviewed-by: Feifei Xu <Feifei.Xu@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/powerplay/arcturus_ppt.c')
-rw-r--r--drivers/gpu/drm/amd/powerplay/arcturus_ppt.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
index 534e450df4bb..7d680f33ce3c 100644
--- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
@@ -37,9 +37,9 @@
#include "nbio/nbio_7_4_sh_mask.h"
#define MSG_MAP(msg, index) \
- [SMU_MSG_##msg] = index
+ [SMU_MSG_##msg] = {1, (index)}
-static int arcturus_message_map[SMU_MSG_MAX_COUNT] = {
+static struct smu_11_0_cmn2aisc_mapping arcturus_message_map[SMU_MSG_MAX_COUNT] = {
MSG_MAP(TestMessage, PPSMC_MSG_TestMessage),
MSG_MAP(GetSmuVersion, PPSMC_MSG_GetSmuVersion),
MSG_MAP(GetDriverIfVersion, PPSMC_MSG_GetDriverIfVersion),
@@ -101,16 +101,18 @@ static int arcturus_message_map[SMU_MSG_MAX_COUNT] = {
static int arcturus_get_smu_msg_index(struct smu_context *smc, uint32_t index)
{
- int val;
+ struct smu_11_0_cmn2aisc_mapping mapping;
if (index >= SMU_MSG_MAX_COUNT)
return -EINVAL;
- val = arcturus_message_map[index];
- if (val > PPSMC_Message_Count)
+ mapping = arcturus_message_map[index];
+ if (!(mapping.valid_mapping)) {
+ pr_warn("Unsupported SMU message: %d\n", index);
return -EINVAL;
+ }
- return val;
+ return mapping.map_to;
}
static const struct pptable_funcs arcturus_ppt_funcs = {