[PATCH 01/14] drm/amdgpu: add check_soft_reset ip func

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 19.07.2016 um 10:13 schrieb Chunming Zhou:
> It is used to identify if the ip block is hang.
>
> Change-Id: Iea2c4274256b00cd330297189c2bafbb9723b7c7
> Signed-off-by: Chunming Zhou <David1.Zhou at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  1 +
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 24 ++++++++++++++++++++++++
>   drivers/gpu/drm/amd/include/amd_shared.h   |  2 ++
>   3 files changed, 27 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 88efffe..15673dd 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -1978,6 +1978,7 @@ struct amdgpu_ip_block_status {
>   	bool valid;
>   	bool sw;
>   	bool hw;
> +	bool hang;
>   };
>   
>   struct amdgpu_device {
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 9a7e574..f9e8185 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -1950,6 +1950,25 @@ int amdgpu_resume_kms(struct drm_device *dev, bool resume, bool fbcon)
>   	return 0;
>   }
>   
> +static bool amdgpu_check_soft_reset(struct amdgpu_device *adev)
> +{
> +	int i;
> +	bool asic_hang = false;
> +
> +	for (i = 0; i < adev->num_ip_blocks; i++) {
> +		if (!adev->ip_block_status[i].valid)
> +			continue;
> +		/* disable VCE checking, since VCE is always busy */
> +		if (i == AMD_IP_BLOCK_TYPE_VCE)
> +			continue;

I would rather add that in the VCE specific check_soft_reset handler.

Christian.

> +		if (adev->ip_blocks[i].funcs->check_soft_reset)
> +			adev->ip_blocks[i].funcs->check_soft_reset(adev);
> +		if (adev->ip_block_status[i].hang)
> +			asic_hang = true;
> +	}
> +	return asic_hang;
> +}
> +
>   /**
>    * amdgpu_gpu_reset - reset the asic
>    *
> @@ -1964,6 +1983,11 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev)
>   	int i, r;
>   	int resched;
>   
> +	if (!amdgpu_check_soft_reset(adev)) {
> +		DRM_INFO("No hardware hang detected. Did some blocks stall?\n");
> +		return 0;
> +	}
> +
>   	atomic_inc(&adev->gpu_reset_counter);
>   
>   	/* block TTM */
> diff --git a/drivers/gpu/drm/amd/include/amd_shared.h b/drivers/gpu/drm/amd/include/amd_shared.h
> index afbd876..6d284c8 100644
> --- a/drivers/gpu/drm/amd/include/amd_shared.h
> +++ b/drivers/gpu/drm/amd/include/amd_shared.h
> @@ -168,6 +168,8 @@ struct amd_ip_funcs {
>   	bool (*is_idle)(void *handle);
>   	/* poll for idle */
>   	int (*wait_for_idle)(void *handle);
> +	/* check soft reset the IP block */
> +	int (*check_soft_reset)(void *handle);
>   	/* soft reset the IP block */
>   	int (*soft_reset)(void *handle);
>   	/* enable/disable cg for the IP block */



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux