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

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

 



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





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

  Powered by Linux