[PATCH 03/14] drm/amdgpu: add pre_soft_reset ip func
Christian König
deathsimple at vodafone.de
Tue Jul 19 09:14:50 UTC 2016
Am 19.07.2016 um 10:13 schrieb Chunming Zhou:
> It will be used before soft_reset to do some preparing work for reset.
>
> Change-Id: Ie3e614102d0361cf2546a260193a2b2bdfee615b
> Signed-off-by: Chunming Zhou <David1.Zhou at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 16 ++++++++++++++++
> drivers/gpu/drm/amd/include/amd_shared.h | 2 ++
> 2 files changed, 18 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index f9e8185..97957ab 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -1969,6 +1969,22 @@ static bool amdgpu_check_soft_reset(struct amdgpu_device *adev)
> return asic_hang;
> }
>
> +int amdgpu_pre_soft_reset(struct amdgpu_device *adev)
> +{
> + int i, r = 0;
> +
> + for (i = 0; i < adev->num_ip_blocks; i++) {
> + if (!adev->ip_block_status[i].valid)
> + continue;
> + if (adev->ip_blocks[i].funcs->pre_soft_reset)
> + r = adev->ip_blocks[i].funcs->pre_soft_reset(adev);
> + if (r)
> + return r;
Either invert the check if the function is present and use continue or
move the "if (r)" into the check if the function is present as well.
Christian.
> + }
> +
> + return 0;
> +}
> +
> /**
> * amdgpu_gpu_reset - reset the asic
> *
> diff --git a/drivers/gpu/drm/amd/include/amd_shared.h b/drivers/gpu/drm/amd/include/amd_shared.h
> index 6d284c8..7104085 100644
> --- a/drivers/gpu/drm/amd/include/amd_shared.h
> +++ b/drivers/gpu/drm/amd/include/amd_shared.h
> @@ -170,6 +170,8 @@ struct amd_ip_funcs {
> int (*wait_for_idle)(void *handle);
> /* check soft reset the IP block */
> int (*check_soft_reset)(void *handle);
> + /* pre soft reset the IP block */
> + int (*pre_soft_reset)(void *handle);
> /* soft reset the IP block */
> int (*soft_reset)(void *handle);
> /* enable/disable cg for the IP block */
More information about the amd-gfx
mailing list