Skip to content

Commit

Permalink
drm/amd/powerplay: enable SMC message filter
Browse files Browse the repository at this point in the history
1. enable SMC message filter in SRIOV situation
2. return -EACCESS if msg is blocked from smu_msg_get_index
3. if msg is block, always return 0 from smu_v11_0_send_msg_with_param

Signed-off-by: Wenhui Sheng <Wenhui.Sheng@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Wenhui Sheng authored and Alex Deucher committed May 28, 2020
1 parent d4f3c0b commit 4ea5081
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
12 changes: 3 additions & 9 deletions drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ static int arcturus_get_smu_msg_index(struct smu_context *smc, uint32_t index)
if (!(mapping.valid_mapping))
return -EINVAL;

if (amdgpu_sriov_vf(smc->adev) && !mapping.valid_in_vf)
return -EACCES;

return mapping.map_to;
}

Expand Down Expand Up @@ -382,11 +385,6 @@ arcturus_set_single_dpm_table(struct smu_context *smu,
return ret;
}

if (!num_of_levels) {
pr_err("[%s] number of clk levels is invalid!\n", __func__);
return -EINVAL;
}

single_dpm_table->count = num_of_levels;
for (i = 0; i < num_of_levels; i++) {
ret = smu_send_smc_msg_with_param(smu,
Expand All @@ -397,10 +395,6 @@ arcturus_set_single_dpm_table(struct smu_context *smu,
pr_err("[%s] failed to get dpm freq by index!\n", __func__);
return ret;
}
if (!clk) {
pr_err("[%s] clk value is invalid!\n", __func__);
return -EINVAL;
}
single_dpm_table->dpm_levels[i].value = clk;
single_dpm_table->dpm_levels[i].enabled = true;
}
Expand Down
3 changes: 3 additions & 0 deletions drivers/gpu/drm/amd/powerplay/navi10_ppt.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ static int navi10_get_smu_msg_index(struct smu_context *smc, uint32_t index)
return -EINVAL;
}

if (amdgpu_sriov_vf(smc->adev) && !mapping.valid_in_vf)
return -EACCES;

return mapping.map_to;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/amd/powerplay/smu_v11_0.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ smu_v11_0_send_msg_with_param(struct smu_context *smu,

index = smu_msg_get_index(smu, msg);
if (index < 0)
return index;
return index == -EACCES ? 0 : index;

mutex_lock(&smu->message_lock);
ret = smu_v11_0_wait_for_response(smu);
Expand Down

0 comments on commit 4ea5081

Please sign in to comment.