[PATCH Review 1/1] drm/amdgpu/pm: add asic smu support check

Quan, Evan Evan.Quan at amd.com
Mon Mar 21 06:02:23 UTC 2022


[AMD Official Use Only]

Reviewed-by: Evan Quan <evan.quan at amd.com>

> -----Original Message-----
> From: Stanley.Yang <Stanley.Yang at amd.com>
> Sent: Monday, March 21, 2022 1:46 PM
> To: amd-gfx at lists.freedesktop.org; Zhang, Hawking
> <Hawking.Zhang at amd.com>; Zhou1, Tao <Tao.Zhou1 at amd.com>; Li,
> Candice <Candice.Li at amd.com>; Quan, Evan <Evan.Quan at amd.com>
> Cc: Yang, Stanley <Stanley.Yang at amd.com>
> Subject: [PATCH Review 1/1] drm/amdgpu/pm: add asic smu support check
> 
> It must check asic whether support smu
> before call smu powerplay function, otherwise it may cause null point on no
> support smu asic.
> 
> Change-Id: Ib86f3d4c88317b23eb1040b9ce1c5c8dcae42488
> Signed-off-by: Stanley.Yang <Stanley.Yang at amd.com>
> ---
>  drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
> b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
> index 89fbee568be4..c73fb73e9628 100644
> --- a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
> +++ b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
> @@ -500,6 +500,9 @@ int
> amdgpu_dpm_send_hbm_bad_pages_num(struct amdgpu_device *adev,
> uint32_t size)
>  	struct smu_context *smu = adev->powerplay.pp_handle;
>  	int ret = 0;
> 
> +	if (!is_support_sw_smu(adev))
> +		return -EOPNOTSUPP;
> +
>  	mutex_lock(&adev->pm.mutex);
>  	ret = smu_send_hbm_bad_pages_num(smu, size);
>  	mutex_unlock(&adev->pm.mutex);
> @@ -512,6 +515,9 @@ int
> amdgpu_dpm_send_hbm_bad_channel_flag(struct amdgpu_device *adev,
> uint32_t si
>  	struct smu_context *smu = adev->powerplay.pp_handle;
>  	int ret = 0;
> 
> +	if (!is_support_sw_smu(adev))
> +		return -EOPNOTSUPP;
> +
>  	mutex_lock(&adev->pm.mutex);
>  	ret = smu_send_hbm_bad_channel_flag(smu, size);
>  	mutex_unlock(&adev->pm.mutex);
> --
> 2.17.1


More information about the amd-gfx mailing list