[PATCH 12/22] drm/amdgpu: send rel event first after init failed
Alex Deucher
alexdeucher at gmail.com
Mon Feb 26 17:24:47 UTC 2018
On Mon, Feb 26, 2018 at 12:18 AM, Monk Liu <Monk.Liu at amd.com> wrote:
> and later send req_fini and rel_fini to host for the
> finish routine
This looks like it should be two patches:
1. Properly release the gpu in sr-iov in device_ip_init() when it fails
2. Make sure to request gpu in sr-iov in device_init() before calling
device_ip_fini()
Also, please provide better commit messages.
Alex
>
> Change-Id: Ib0347a305ab5f7712d2d76b1a843bb2429acbf3d
> Signed-off-by: Monk Liu <Monk.Liu at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 19 ++++++++++---------
> 1 file changed, 10 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 61696c7..f6380ed 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -1308,7 +1308,7 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
> if (r) {
> DRM_ERROR("sw_init of IP block <%s> failed %d\n",
> adev->ip_blocks[i].version->funcs->name, r);
> - return r;
> + goto init_failed;
> }
> adev->ip_blocks[i].status.sw = true;
>
> @@ -1317,17 +1317,17 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
> r = amdgpu_device_vram_scratch_init(adev);
> if (r) {
> DRM_ERROR("amdgpu_vram_scratch_init failed %d\n", r);
> - return r;
> + goto init_failed;
> }
> r = adev->ip_blocks[i].version->funcs->hw_init((void *)adev);
> if (r) {
> DRM_ERROR("hw_init %d failed %d\n", i, r);
> - return r;
> + goto init_failed;
> }
> r = amdgpu_device_wb_init(adev);
> if (r) {
> DRM_ERROR("amdgpu_device_wb_init failed %d\n", r);
> - return r;
> + goto init_failed;
> }
> adev->ip_blocks[i].status.hw = true;
>
> @@ -1336,7 +1336,7 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
> r = amdgpu_allocate_static_csa(adev);
> if (r) {
> DRM_ERROR("allocate CSA failed %d\n", r);
> - return r;
> + goto init_failed;
> }
> }
> }
> @@ -1351,17 +1351,17 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
> if (r) {
> DRM_ERROR("hw_init of IP block <%s> failed %d\n",
> adev->ip_blocks[i].version->funcs->name, r);
> - return r;
> + goto init_failed;
> }
> adev->ip_blocks[i].status.hw = true;
> }
>
> amdgpu_amdkfd_device_init(adev);
> -
> +init_failed:
> if (amdgpu_sriov_vf(adev))
> amdgpu_virt_release_full_gpu(adev, true);
>
> - return 0;
> + return r;
> }
>
> static void amdgpu_device_fill_reset_magic(struct amdgpu_device *adev)
> @@ -1978,7 +1978,8 @@ int amdgpu_device_init(struct amdgpu_device *adev,
> }
> dev_err(adev->dev, "amdgpu_device_ip_init failed\n");
> amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_AMDGPU_INIT_FAIL, 0, 0);
> - amdgpu_device_ip_fini(adev);
> + if (!amdgpu_virt_request_full_gpu(adev, false))
> + amdgpu_device_ip_fini(adev);
> goto failed;
> }
>
> --
> 2.7.4
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
More information about the amd-gfx
mailing list