Make sure the interface get granted only when amdgpu_dpm enabled. Signed-off-by: Evan Quan <evan.quan@xxxxxxx> Change-Id: Ia1d1123470fab89b41b24ea80dcb319570aa7438 --- drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 6 ++++++ drivers/gpu/drm/amd/pm/powerplay/hwmgr/hwmgr.c | 3 --- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c index 4c709f7bcd51..e95893556147 100644 --- a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +++ b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c @@ -49,6 +49,9 @@ static int amd_powerplay_create(struct amdgpu_device *adev) hwmgr->adev = adev; hwmgr->not_vf = !amdgpu_sriov_vf(adev); + hwmgr->pp_one_vf = amdgpu_sriov_is_pp_one_vf(adev); + hwmgr->pm_en = (amdgpu_dpm && (hwmgr->not_vf || hwmgr->pp_one_vf)) + ? true : false; hwmgr->device = amdgpu_cgs_create_device(adev); mutex_init(&hwmgr->msg_lock); hwmgr->chip_family = adev->family; @@ -275,6 +278,9 @@ static int pp_dpm_load_fw(void *handle) { struct pp_hwmgr *hwmgr = handle; + if (!hwmgr->pm_en) + return -EOPNOTSUPP; + if (!hwmgr || !hwmgr->smumgr_funcs || !hwmgr->smumgr_funcs->start_smu) return -EINVAL; diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/hwmgr.c index 4fd61d7f6c70..c0c2f36094fa 100644 --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/hwmgr.c +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/hwmgr.c @@ -217,9 +217,6 @@ int hwmgr_hw_init(struct pp_hwmgr *hwmgr) { int ret = 0; - hwmgr->pp_one_vf = amdgpu_sriov_is_pp_one_vf((struct amdgpu_device *)hwmgr->adev); - hwmgr->pm_en = (amdgpu_dpm && (hwmgr->not_vf || hwmgr->pp_one_vf)) - ? true : false; if (!hwmgr->pm_en) return 0; -- 2.29.0