mirror of
https://github.com/torvalds/linux.git
synced 2024-11-12 07:01:57 +00:00
drm/amdgpu: Fix null point error
need to check adev->powerplay.pp_funcs first, becasue from AI, the smu ip can be disabled by user, and the pp_handle is null in this case. 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>
This commit is contained in:
parent
6f059c641b
commit
7179d24040
@ -135,7 +135,8 @@ static int acp_poweroff(struct generic_pm_domain *genpd)
|
|||||||
* 2. power off the acp tiles
|
* 2. power off the acp tiles
|
||||||
* 3. check and enter ulv state
|
* 3. check and enter ulv state
|
||||||
*/
|
*/
|
||||||
if (adev->powerplay.pp_funcs->set_powergating_by_smu)
|
if (adev->powerplay.pp_funcs &&
|
||||||
|
adev->powerplay.pp_funcs->set_powergating_by_smu)
|
||||||
amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_ACP, true);
|
amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_ACP, true);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -517,7 +518,8 @@ static int acp_set_powergating_state(void *handle,
|
|||||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||||
bool enable = state == AMD_PG_STATE_GATE ? true : false;
|
bool enable = state == AMD_PG_STATE_GATE ? true : false;
|
||||||
|
|
||||||
if (adev->powerplay.pp_funcs->set_powergating_by_smu)
|
if (adev->powerplay.pp_funcs &&
|
||||||
|
adev->powerplay.pp_funcs->set_powergating_by_smu)
|
||||||
amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_ACP, enable);
|
amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_ACP, enable);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -392,7 +392,7 @@ void amdgpu_gfx_off_ctrl(struct amdgpu_device *adev, bool enable)
|
|||||||
if (!(adev->powerplay.pp_feature & PP_GFXOFF_MASK))
|
if (!(adev->powerplay.pp_feature & PP_GFXOFF_MASK))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!adev->powerplay.pp_funcs->set_powergating_by_smu)
|
if (!adev->powerplay.pp_funcs || !adev->powerplay.pp_funcs->set_powergating_by_smu)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ void mmhub_v1_0_update_power_gating(struct amdgpu_device *adev,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (enable && adev->pg_flags & AMD_PG_SUPPORT_MMHUB) {
|
if (enable && adev->pg_flags & AMD_PG_SUPPORT_MMHUB) {
|
||||||
if (adev->powerplay.pp_funcs->set_powergating_by_smu)
|
if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->set_powergating_by_smu)
|
||||||
amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_GMC, true);
|
amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_GMC, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1366,7 +1366,8 @@ static int sdma_v4_0_hw_init(void *handle)
|
|||||||
int r;
|
int r;
|
||||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||||
|
|
||||||
if (adev->asic_type == CHIP_RAVEN && adev->powerplay.pp_funcs->set_powergating_by_smu)
|
if (adev->asic_type == CHIP_RAVEN && adev->powerplay.pp_funcs &&
|
||||||
|
adev->powerplay.pp_funcs->set_powergating_by_smu)
|
||||||
amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_SDMA, false);
|
amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_SDMA, false);
|
||||||
|
|
||||||
sdma_v4_0_init_golden_registers(adev);
|
sdma_v4_0_init_golden_registers(adev);
|
||||||
@ -1386,7 +1387,8 @@ static int sdma_v4_0_hw_fini(void *handle)
|
|||||||
sdma_v4_0_ctx_switch_enable(adev, false);
|
sdma_v4_0_ctx_switch_enable(adev, false);
|
||||||
sdma_v4_0_enable(adev, false);
|
sdma_v4_0_enable(adev, false);
|
||||||
|
|
||||||
if (adev->asic_type == CHIP_RAVEN && adev->powerplay.pp_funcs->set_powergating_by_smu)
|
if (adev->asic_type == CHIP_RAVEN && adev->powerplay.pp_funcs
|
||||||
|
&& adev->powerplay.pp_funcs->set_powergating_by_smu)
|
||||||
amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_SDMA, true);
|
amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_SDMA, true);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user