drm/amdgpu: Fix ecc irq enable/disable unpaired
Subsystems (2)
PATCH v2 1/1 drm/amdgpu: Fix ecc irq enable/disable unpaired
The ecc_irq is disabled while GPU mode2 reset suspending process, but not be enabled during GPU mode2 reset resume process.
Changed from V1:
only do sdma/gfx ras_late_init in aldebaran_mode2_restore_ip, delete amdgpu_ras_late_resume function.
--- drivers/gpu/drm/amd/amdgpu/aldebaran.c | 28 +++++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 3 +++ drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 3 +++ 4 files changed, 37 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/aldebaran.c +27 -1
@@ -330,6 +330,7 @@ aldebaran_mode2_restore_hwcontext(struct amdgpu_reset_control *reset_ctl, {struct list_head *reset_device_list = reset_context->reset_device_list;struct amdgpu_device *tmp_adev =NULL ; +struct amdgpu_ras *con;int r;if (reset_device_list ==NULL )
@@ -355,7 +356,32 @@ aldebaran_mode2_restore_hwcontext(struct amdgpu_reset_control *reset_ctl,*/ amdgpu_register_gpu_instance (tmp_adev); -/* Resume RAS */ +/* Resume RAS, ecc_irq */ + con =amdgpu_ras_get_context (tmp_adev); +if (!amdgpu_sriov_vf (tmp_adev) && con) { +if (tmp_adev->sdma.ras && +amdgpu_ras_is_supported (tmp_adev,AMDGPU_RAS_BLOCK__SDMA ) && + tmp_adev->sdma.ras->ras_block.ras_late_init) { + r = tmp_adev->sdma.ras->ras_block.ras_late_init (tmp_adev, + &tmp_adev->sdma.ras->ras_block.ras_comm); +if (r) { +dev_err (tmp_adev->dev,"SDMA failed to execute ras_late_init! ret:%d\n" , r); + goto end; + } + } + +if (tmp_adev->gfx.ras && +amdgpu_ras_is_supported (tmp_adev,AMDGPU_RAS_BLOCK__GFX ) && + tmp_adev->gfx.ras->ras_block.ras_late_init) { + r = tmp_adev->gfx.ras->ras_block.ras_late_init (tmp_adev, + &tmp_adev->gfx.ras->ras_block.ras_comm); +if (r) { +dev_err (tmp_adev->dev,"GFX failed to execute ras_late_init! ret:%d\n" , r); + goto end; + } + } + } +amdgpu_ras_resume (tmp_adev);/* Update PSP FW topology after reset */
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +3 -0
@@ -1043,6 +1043,9 @@ static int gmc_v10_0_hw_fini(void *handle)amdgpu_irq_put (adev, &adev->gmc.vm_fault,0 ); +if (adev->gmc.ecc_irq.funcs) +amdgpu_irq_put (adev, &adev->gmc.ecc_irq,0 ); +return 0 ; }
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +4 -0
@@ -941,6 +941,10 @@ static int gmc_v11_0_hw_fini(void *handle) }amdgpu_irq_put (adev, &adev->gmc.vm_fault,0 ); + +if (adev->gmc.ecc_irq.funcs) +amdgpu_irq_put (adev, &adev->gmc.ecc_irq,0 ); +gmc_v11_0_gart_disable (adev);return 0 ;
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +3 -0
@@ -2388,6 +2388,9 @@ static int gmc_v9_0_hw_fini(void *handle)amdgpu_irq_put (adev, &adev->gmc.vm_fault,0 ); +if (adev->gmc.ecc_irq.funcs) +amdgpu_irq_put (adev, &adev->gmc.ecc_irq,0 ); +return 0 ; }
Signature · 1 line
2.25.1
[AMD Official Use Only - General]
+ if (adev->gmc.ecc_irq.funcs)
+ amdgpu_irq_put(adev, &adev->gmc.ecc_irq, 0);
+
This doesn't match with amdgpu_irq_get call for gmc.ecc_irq, where driver checks ras cap to decide whether enabling the interrupt or not (see amdgpu_umc_ras_late_init). We do the same check for amdgpu_irq_put call.
Regards,
Hawking
-----Original Message-----
From: Yang, Stanley <[email protected]>
Sent: Tuesday, December 19, 2023 20:48
To: [email protected]; Zhang, Hawking <[email protected]>
Cc: Yang, Stanley <[email protected]>
Subject: [PATCH Review V2 1/1] drm/amdgpu: Fix ecc irq enable/disable unpaired
The ecc_irq is disabled while GPU mode2 reset suspending process, but not be enabled during GPU mode2 reset resume process.
Changed from V1:
only do sdma/gfx ras_late_init in aldebaran_mode2_restore_ip, delete amdgpu_ras_late_resume function.
--- drivers/gpu/drm/amd/amdgpu/aldebaran.c | 28 +++++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 3 +++ drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 3 +++ 4 files changed, 37 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/aldebaran.c +27 -1
@@ -330,6 +330,7 @@ aldebaran_mode2_restore_hwcontext(struct amdgpu_reset_control *reset_ctl, {struct list_head *reset_device_list = reset_context->reset_device_list;struct amdgpu_device *tmp_adev =NULL ; +struct amdgpu_ras *con;int r;if (reset_device_list ==NULL )
@@ -355,7 +356,32 @@ aldebaran_mode2_restore_hwcontext(struct amdgpu_reset_control *reset_ctl,*/ amdgpu_register_gpu_instance (tmp_adev); -/* Resume RAS */ +/* Resume RAS, ecc_irq */ + con =amdgpu_ras_get_context (tmp_adev); +if (!amdgpu_sriov_vf (tmp_adev) && con) { +if (tmp_adev->sdma.ras && +amdgpu_ras_is_supported (tmp_adev,AMDGPU_RAS_BLOCK__SDMA ) && + tmp_adev->sdma.ras->ras_block.ras_late_init) { + r = tmp_adev->sdma.ras->ras_block.ras_late_init (tmp_adev, + &tmp_adev->sdma.ras->ras_block.ras_comm); +if (r) { +dev_err (tmp_adev->dev,"SDMA failed to execute ras_late_init! ret:%d\n" , r); + goto end; + } + } + +if (tmp_adev->gfx.ras && +amdgpu_ras_is_supported (tmp_adev,AMDGPU_RAS_BLOCK__GFX ) && + tmp_adev->gfx.ras->ras_block.ras_late_init) { + r = tmp_adev->gfx.ras->ras_block.ras_late_init (tmp_adev, + &tmp_adev->gfx.ras->ras_block.ras_comm); +if (r) { +dev_err (tmp_adev->dev,"GFX failed to execute ras_late_init! ret:%d\n" , r); + goto end; + } + } + } +amdgpu_ras_resume (tmp_adev); /* Update PSP FW topology after reset */ diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
index 09cbca596bb5..b93a0baeb2d3 100644
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +3 -0
@@ -1043,6 +1043,9 @@ static int gmc_v10_0_hw_fini(void *handle)amdgpu_irq_put (adev, &adev->gmc.vm_fault,0 ); +if (adev->gmc.ecc_irq.funcs) +amdgpu_irq_put (adev, &adev->gmc.ecc_irq,0 ); +return 0 ; }
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +4 -0
@@ -941,6 +941,10 @@ static int gmc_v11_0_hw_fini(void *handle) }amdgpu_irq_put (adev, &adev->gmc.vm_fault,0 ); + +if (adev->gmc.ecc_irq.funcs) +amdgpu_irq_put (adev, &adev->gmc.ecc_irq,0 ); +gmc_v11_0_gart_disable (adev);return 0 ;
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +3 -0
@@ -2388,6 +2388,9 @@ static int gmc_v9_0_hw_fini(void *handle)amdgpu_irq_put (adev, &adev->gmc.vm_fault,0 ); +if (adev->gmc.ecc_irq.funcs) +amdgpu_irq_put (adev, &adev->gmc.ecc_irq,0 ); +return 0 ; }
--
2.25.1
[AMD Official Use Only - General]
Yes, it should add check ras cap before put gmc.ecc_irq, thanks.
Regards,
Stanley
Quoted 146 lines
-----Original Message-----
From: Zhang, Hawking <[email protected]>
Sent: Wednesday, December 20, 2023 4:12 PM
To: Yang, Stanley <[email protected]>; [email protected]
Subject: RE: [PATCH Review V2 1/1] drm/amdgpu: Fix ecc irq enable/disable unpaired[AMD Official Use Only - General]
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +3
-0+if (adev->gmc.ecc_irq.funcs) +amdgpu_irq_put (adev, &adev->gmc.ecc_irq,0 ); +This doesn't match with
amdgpu_irq_getcall for gmc.ecc_irq, where driver checks ras cap to decide whether enabling the interrupt or not (seeamdgpu_umc_ras_late_init). We do the same check foramdgpu_irq_putcall.Regards,
Hawking-----Original Message-----
From: Yang, Stanley <[email protected]>
Sent: Tuesday, December 19, 2023 20:48
To: [email protected]; Zhang, Hawking <[email protected]>
Cc: Yang, Stanley <[email protected]>
Subject: [PATCH Review V2 1/1] drm/amdgpu: Fix ecc irq enable/disable unpairedThe
ecc_irqis disabled while GPU mode2 reset suspending process, but not be enabled during GPU mode2 reset resume process.Changed from V1:
only do sdma/gfxras_late_initinaldebaran_mode2_restore_ip, deleteamdgpu_ras_late_resumefunction.Signed-off-by Stanley.Yang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/aldebaran.c | 28 +++++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 3 +++ drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 3 +++ 4 files changed, 37 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/aldebaran.c +6
-1@@ -330,6 +330,7 @@ aldebaran_mode2_restore_hwcontext(struct amdgpu_reset_control *reset_ctl, {struct list_head *reset_device_list = reset_context->reset_device_list;struct amdgpu_device *tmp_adev =NULL ; +struct amdgpu_ras *con;int r;if (reset_device_list ==NULL )@@ -355,7 +356,32 @@ aldebaran_mode2_restore_hwcontext(structamdgpu_reset_control *reset_ctl, */ amdgpu_register_gpu_instance (tmp_adev); -/* Resume RAS */ +/* Resume RAS, ecc_irq */ + con =amdgpu_ras_get_context (tmp_adev); + if (!amdgpu_sriov_vf(tmp_adev) && con) { + if (tmp_adev->sdma.ras && + amdgpu_ras_is_supported(tmp_adev,
AMDGPU_RAS_BLOCK__SDMA) &&drivers/gpu/drm/amd/amdgpu/aldebaran.c +2
-0+ tmp_adev->sdma.ras->ras_block.ras_late_init) { + r = tmp_adev->sdma.ras-Quoted 1 line
ras_block.ras_late_init(tmp_adev,
drivers/gpu/drm/amd/amdgpu/aldebaran.c +3
-0+ &tmp_adev->sdma.ras->ras_block.ras_comm); +if (r) { + dev_err(tmp_adev->dev, "SDMA failed to execute
ras_late_init! ret:%d\n", r);drivers/gpu/drm/amd/amdgpu/aldebaran.c +6
-0+ goto end; + } + } + +if (tmp_adev->gfx.ras && + amdgpu_ras_is_supported(tmp_adev,
AMDGPU_RAS_BLOCK__GFX) &&drivers/gpu/drm/amd/amdgpu/aldebaran.c +5
-0+ tmp_adev->gfx.ras->ras_block.ras_late_init) { + r = tmp_adev->gfx.ras->ras_block.ras_late_init (tmp_adev, + &tmp_adev->gfx.ras->ras_block.ras_comm); +if (r) { + dev_err(tmp_adev->dev, "GFX failed to execute
ras_late_init! ret:%d\n", r);drivers/gpu/drm/amd/amdgpu/aldebaran.c +5
-0+ goto end; + } + } + } +amdgpu_ras_resume (tmp_adev); /* Update PSP FW topology after reset */ diff --git
a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.cb/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
index09cbca596bb5..b93a0baeb2d3100644drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +3
-0@@ -1043,6 +1043,9 @@ static int gmc_v10_0_hw_fini(void *handle)amdgpu_irq_put (adev, &adev->gmc.vm_fault,0 ); +if (adev->gmc.ecc_irq.funcs) +amdgpu_irq_put (adev, &adev->gmc.ecc_irq,0 ); +return 0 ; }drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +4
-0@@ -941,6 +941,10 @@ static int gmc_v11_0_hw_fini(void *handle) }amdgpu_irq_put (adev, &adev->gmc.vm_fault,0 ); + +if (adev->gmc.ecc_irq.funcs) +amdgpu_irq_put (adev, &adev->gmc.ecc_irq,0 ); +gmc_v11_0_gart_disable (adev);return 0 ;drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +3
-1@@ -2388,6 +2388,9 @@ static int gmc_v9_0_hw_fini(void *handle)amdgpu_irq_put (adev, &adev->gmc.vm_fault,0 ); +if (adev->gmc.ecc_irq.funcs) +amdgpu_irq_put (adev, &adev->gmc.ecc_irq,0 ); +return 0 ; } --2.25.1