All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/amdgpu: Execute IP's hw_fini when hw_init failed
@ 2022-04-19 19:37 Alice Wong
  2022-04-19 19:45 ` Wong, Alice
  2022-04-19 19:59 ` Alex Deucher
  0 siblings, 2 replies; 4+ messages in thread
From: Alice Wong @ 2022-04-19 19:37 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alice Wong

amdgpu_device_ip_hw_init_phase1 and amdgpu_device_ip_hw_init_phase2
call IP blocks' respective hw_fini when hw_init failed.

BUG:SWDEV-332449
Signed-off-by: Alice Wong <shiwei.wong@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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH 1/2] drm/amdgpu: Execute IP's hw_fini when hw_init failed
  2022-04-19 19:37 [PATCH 1/2] drm/amdgpu: Execute IP's hw_fini when hw_init failed Alice Wong
@ 2022-04-19 19:45 ` Wong, Alice
  2022-04-19 19:59 ` Alex Deucher
  1 sibling, 0 replies; 4+ messages in thread
From: Wong, Alice @ 2022-04-19 19:45 UTC (permalink / raw)
  To: amd-gfx, Zhang, Bokun

[AMD Official Use Only]


amdgpu_device_ip_hw_init_phase1 and amdgpu_device_ip_hw_init_phase2 call IP blocks' respective hw_fini when hw_init failed.

BUG:SWDEV-332449
Signed-off-by: Alice Wong <shiwei.wong@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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] drm/amdgpu: Execute IP's hw_fini when hw_init failed
  2022-04-19 19:37 [PATCH 1/2] drm/amdgpu: Execute IP's hw_fini when hw_init failed Alice Wong
  2022-04-19 19:45 ` Wong, Alice
@ 2022-04-19 19:59 ` Alex Deucher
  2022-04-20  7:47   ` Christian König
  1 sibling, 1 reply; 4+ messages in thread
From: Alex Deucher @ 2022-04-19 19:59 UTC (permalink / raw)
  To: Alice Wong; +Cc: amd-gfx list

On Tue, Apr 19, 2022 at 3:38 PM Alice Wong <shiwei.wong@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@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
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] drm/amdgpu: Execute IP's hw_fini when hw_init failed
  2022-04-19 19:59 ` Alex Deucher
@ 2022-04-20  7:47   ` Christian König
  0 siblings, 0 replies; 4+ messages in thread
From: Christian König @ 2022-04-20  7:47 UTC (permalink / raw)
  To: Alex Deucher, Alice Wong; +Cc: amd-gfx list

Am 19.04.22 um 21:59 schrieb Alex Deucher:
> On Tue, Apr 19, 2022 at 3:38 PM Alice Wong <shiwei.wong@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.

I agree. That doesn't looks like good design to me.

Each IP block should cleanup themselves when their hw_init fails.

Only the previously initialized blocks should be cleaned up by the 
common framework.

Regards,
Christian.

>
> Alex
>
>> BUG:SWDEV-332449
>> Signed-off-by: Alice Wong <shiwei.wong@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
>>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-04-20  7:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-19 19:37 [PATCH 1/2] drm/amdgpu: Execute IP's hw_fini when hw_init failed Alice Wong
2022-04-19 19:45 ` Wong, Alice
2022-04-19 19:59 ` Alex Deucher
2022-04-20  7:47   ` Christian König

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.