提交 b61e54cb 编写于 作者: R Rex Zhu 提交者: Alex Deucher

drm/amd/pp: Lock pm_funcs when set pp table

unlock mutex until set pp table completely to avoid
conflict if other pp functions were called simultaneously.

use hwmgr_handle_task instand of pp_dpm_dispatch_tasks.
It is not make sense that call pp_functions in ip_functions.
Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: NRex Zhu <Rex.Zhu@amd.com>
Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
上级 ba8ab90e
...@@ -31,8 +31,6 @@ ...@@ -31,8 +31,6 @@
#include "amdgpu.h" #include "amdgpu.h"
#include "hwmgr.h" #include "hwmgr.h"
static int pp_dpm_dispatch_tasks(void *handle, enum amd_pp_task task_id,
enum amd_pm_state_type *user_state);
static const struct amd_pm_funcs pp_dpm_funcs; static const struct amd_pm_funcs pp_dpm_funcs;
...@@ -146,10 +144,12 @@ static int pp_late_init(void *handle) ...@@ -146,10 +144,12 @@ static int pp_late_init(void *handle)
struct amdgpu_device *adev = handle; struct amdgpu_device *adev = handle;
struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle; struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;
if (hwmgr && hwmgr->pm_en) if (hwmgr && hwmgr->pm_en) {
pp_dpm_dispatch_tasks(hwmgr, mutex_lock(&hwmgr->smu_lock);
hwmgr_handle_task(hwmgr,
AMD_PP_TASK_COMPLETE_INIT, NULL); AMD_PP_TASK_COMPLETE_INIT, NULL);
mutex_unlock(&hwmgr->smu_lock);
}
return 0; return 0;
} }
...@@ -620,7 +620,7 @@ static int amd_powerplay_reset(void *handle) ...@@ -620,7 +620,7 @@ static int amd_powerplay_reset(void *handle)
static int pp_dpm_set_pp_table(void *handle, const char *buf, size_t size) static int pp_dpm_set_pp_table(void *handle, const char *buf, size_t size)
{ {
struct pp_hwmgr *hwmgr = handle; struct pp_hwmgr *hwmgr = handle;
int ret = 0; int ret = -ENOMEM;
if (!hwmgr || !hwmgr->pm_en) if (!hwmgr || !hwmgr->pm_en)
return -EINVAL; return -EINVAL;
...@@ -630,28 +630,28 @@ static int pp_dpm_set_pp_table(void *handle, const char *buf, size_t size) ...@@ -630,28 +630,28 @@ static int pp_dpm_set_pp_table(void *handle, const char *buf, size_t size)
hwmgr->hardcode_pp_table = kmemdup(hwmgr->soft_pp_table, hwmgr->hardcode_pp_table = kmemdup(hwmgr->soft_pp_table,
hwmgr->soft_pp_table_size, hwmgr->soft_pp_table_size,
GFP_KERNEL); GFP_KERNEL);
if (!hwmgr->hardcode_pp_table) { if (!hwmgr->hardcode_pp_table)
mutex_unlock(&hwmgr->smu_lock); goto err;
return -ENOMEM;
}
} }
memcpy(hwmgr->hardcode_pp_table, buf, size); memcpy(hwmgr->hardcode_pp_table, buf, size);
hwmgr->soft_pp_table = hwmgr->hardcode_pp_table; hwmgr->soft_pp_table = hwmgr->hardcode_pp_table;
mutex_unlock(&hwmgr->smu_lock);
ret = amd_powerplay_reset(handle); ret = amd_powerplay_reset(handle);
if (ret) if (ret)
return ret; goto err;
if (hwmgr->hwmgr_func->avfs_control) { if (hwmgr->hwmgr_func->avfs_control) {
ret = hwmgr->hwmgr_func->avfs_control(hwmgr, false); ret = hwmgr->hwmgr_func->avfs_control(hwmgr, false);
if (ret) if (ret)
return ret; goto err;
} }
mutex_unlock(&hwmgr->smu_lock);
return 0; return 0;
err:
mutex_unlock(&hwmgr->smu_lock);
return ret;
} }
static int pp_dpm_force_clock_level(void *handle, static int pp_dpm_force_clock_level(void *handle,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册