[PATCH 05/10] drm/amdgpu: enable/disable doorbell interrupt in baco entry/exit helper

Zhou1, Tao Tao.Zhou1 at amd.com
Thu Nov 28 06:50:24 UTC 2019



> -----Original Message-----
> From: Le Ma <le.ma at amd.com>
> Sent: 2019年11月27日 17:15
> To: amd-gfx at lists.freedesktop.org
> Cc: Zhang, Hawking <Hawking.Zhang at amd.com>; Chen, Guchun
> <Guchun.Chen at amd.com>; Zhou1, Tao <Tao.Zhou1 at amd.com>; Li, Dennis
> <Dennis.Li at amd.com>; Deucher, Alexander
> <Alexander.Deucher at amd.com>; Ma, Le <Le.Ma at amd.com>
> Subject: [PATCH 05/10] drm/amdgpu: enable/disable doorbell interrupt in
> baco entry/exit helper
> 
> This operation is needed when baco entry/exit for ras recovery
> 
> Change-Id: I535c7231693f3138a8e3d5acd55672e2ac68232f
> Signed-off-by: Le Ma <le.ma at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index b1408c5..bd387bb 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -4308,10 +4308,14 @@ static void amdgpu_device_get_pcie_info(struct
> amdgpu_device *adev)  int amdgpu_device_baco_enter(struct drm_device
> *dev)  {
>  	struct amdgpu_device *adev = dev->dev_private;
> +	struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
> 
>  	if (!amdgpu_device_supports_baco(adev->ddev))
>  		return -ENOTSUPP;
> 
> +	if (ras && ras->supported)
> +		adev->nbio.funcs->enable_doorbell_interrupt(adev, false);
> +

[Tao] The following code is observed several times, I think we can add a new interface to replace it, I'll do that when I have time.

struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
if (ras && ras->supported)

>  	if (is_support_sw_smu(adev)) {
>  		struct smu_context *smu = &adev->smu;
>  		int ret;
> @@ -4319,8 +4323,6 @@ int amdgpu_device_baco_enter(struct drm_device
> *dev)
>  		ret = smu_baco_enter(smu);
>  		if (ret)
>  			return ret;
> -
> -		return 0;
>  	} else {
>  		void *pp_handle = adev->powerplay.pp_handle;
>  		const struct amd_pm_funcs *pp_funcs = adev-
> >powerplay.pp_funcs; @@ -4331,14 +4333,15 @@ int
> amdgpu_device_baco_enter(struct drm_device *dev)
>  		/* enter BACO state */
>  		if (pp_funcs->set_asic_baco_state(pp_handle, 1))
>  			return -EIO;
> -
> -		return 0;
>  	}
> +
> +	return 0;
>  }
> 
>  int amdgpu_device_baco_exit(struct drm_device *dev)  {
>  	struct amdgpu_device *adev = dev->dev_private;
> +	struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
> 
>  	if (!amdgpu_device_supports_baco(adev->ddev))
>  		return -ENOTSUPP;
> @@ -4351,7 +4354,6 @@ int amdgpu_device_baco_exit(struct drm_device
> *dev)
>  		if (ret)
>  			return ret;
> 
> -		return 0;
>  	} else {
>  		void *pp_handle = adev->powerplay.pp_handle;
>  		const struct amd_pm_funcs *pp_funcs = adev-
> >powerplay.pp_funcs; @@ -4362,7 +4364,10 @@ int
> amdgpu_device_baco_exit(struct drm_device *dev)
>  		/* exit BACO state */
>  		if (pp_funcs->set_asic_baco_state(pp_handle, 0))
>  			return -EIO;
> -
> -		return 0;
>  	}
> +
> +	if (ras && ras->supported)
> +		adev->nbio.funcs->enable_doorbell_interrupt(adev, false);
> +
> +	return 0;
>  }
> --
> 2.7.4



More information about the amd-gfx mailing list