[PATCH 1/2] drm/amdgpu: Execute IP's hw_fini when hw_init failed

Alex Deucher alexdeucher at gmail.com
Tue Apr 19 19:59:35 UTC 2022


On Tue, Apr 19, 2022 at 3:38 PM Alice Wong <shiwei.wong at amd.com> wrote:
>
> amdgpu_device_ip_hw_init_phase1 and amdgpu_device_ip_hw_init_phase2
> call IP blocks' respective hw_fini when hw_init failed.

I don't think we should call hw_fini() if hw_init() failed.  If there
are things that are not properly cleaned up in hw_init() fail cases,
those should be fixed in the relevant hw_init callbacks.

Alex

>
> BUG:SWDEV-332449
> Signed-off-by: Alice Wong <shiwei.wong at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index ec38517ab33f..3abe647bbd2a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -2281,6 +2281,7 @@ static int amdgpu_device_ip_hw_init_phase1(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);
> +                               adev->ip_blocks[i].version->funcs->hw_fini(adev);
>                                 return r;
>                         }
>                         adev->ip_blocks[i].status.hw = true;
> @@ -2303,6 +2304,7 @@ static int amdgpu_device_ip_hw_init_phase2(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);
> +                       adev->ip_blocks[i].version->funcs->hw_fini(adev);
>                         return r;
>                 }
>                 adev->ip_blocks[i].status.hw = true;
> --
> 2.25.1
>


More information about the amd-gfx mailing list