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

Configure Feed

Select the types of activity you want to include in your feed.

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: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Rex Zhu and committed by
Alex Deucher
b61e54cb ba8ab90e

+14 -14
+14 -14
drivers/gpu/drm/amd/powerplay/amd_powerplay.c
··· 31 31 #include "amdgpu.h" 32 32 #include "hwmgr.h" 33 33 34 - static int pp_dpm_dispatch_tasks(void *handle, enum amd_pp_task task_id, 35 - enum amd_pm_state_type *user_state); 36 34 37 35 static const struct amd_pm_funcs pp_dpm_funcs; 38 36 ··· 144 146 struct amdgpu_device *adev = handle; 145 147 struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle; 146 148 147 - if (hwmgr && hwmgr->pm_en) 148 - pp_dpm_dispatch_tasks(hwmgr, 149 + if (hwmgr && hwmgr->pm_en) { 150 + mutex_lock(&hwmgr->smu_lock); 151 + hwmgr_handle_task(hwmgr, 149 152 AMD_PP_TASK_COMPLETE_INIT, NULL); 150 - 153 + mutex_unlock(&hwmgr->smu_lock); 154 + } 151 155 return 0; 152 156 } 153 157 ··· 620 620 static int pp_dpm_set_pp_table(void *handle, const char *buf, size_t size) 621 621 { 622 622 struct pp_hwmgr *hwmgr = handle; 623 - int ret = 0; 623 + int ret = -ENOMEM; 624 624 625 625 if (!hwmgr || !hwmgr->pm_en) 626 626 return -EINVAL; ··· 630 630 hwmgr->hardcode_pp_table = kmemdup(hwmgr->soft_pp_table, 631 631 hwmgr->soft_pp_table_size, 632 632 GFP_KERNEL); 633 - if (!hwmgr->hardcode_pp_table) { 634 - mutex_unlock(&hwmgr->smu_lock); 635 - return -ENOMEM; 636 - } 633 + if (!hwmgr->hardcode_pp_table) 634 + goto err; 637 635 } 638 636 639 637 memcpy(hwmgr->hardcode_pp_table, buf, size); 640 638 641 639 hwmgr->soft_pp_table = hwmgr->hardcode_pp_table; 642 - mutex_unlock(&hwmgr->smu_lock); 643 640 644 641 ret = amd_powerplay_reset(handle); 645 642 if (ret) 646 - return ret; 643 + goto err; 647 644 648 645 if (hwmgr->hwmgr_func->avfs_control) { 649 646 ret = hwmgr->hwmgr_func->avfs_control(hwmgr, false); 650 647 if (ret) 651 - return ret; 648 + goto err; 652 649 } 653 - 650 + mutex_unlock(&hwmgr->smu_lock); 654 651 return 0; 652 + err: 653 + mutex_unlock(&hwmgr->smu_lock); 654 + return ret; 655 655 } 656 656 657 657 static int pp_dpm_force_clock_level(void *handle,