drm/amdgpu: clear IH_RB_W/RPTR during enabling interrupts in sriov case
Subsystems (2)
PATCH 1/1 drm/amdgpu: clear IH_RB_W/RPTR during enabling interrupts in sriov case
Clearing the IH_RB_W/RPTR during interrupts disable is not clearing the RB_OVERFLOW bit.
Adding workaround to clear the wptr when enabling interrupts in case RB_OVERFLOW bit is set.
--- drivers/gpu/drm/amd/amdgpu/ih_v6_0.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/ih_v6_0.c +6 -0
@@ -147,6 +147,12 @@ static int ih_v6_0_toggle_ring_interrupts(struct amdgpu_device *adev, }if (enable) { +if (amdgpu_sriov_vf (adev) && +REG_GET_FIELD (RREG32 (ih_regs->ih_rb_wptr),IH_RB_WPTR ,RB_OVERFLOW )) { +/* clear rptr, wptr*/ +WREG32 (ih_regs->ih_rb_rptr,0 ); +WREG32 (ih_regs->ih_rb_wptr,0 ); + } ih->enabled = true; }else {/* set rptr, wptr to 0 */
Signature · 1 line
2.34.1
Christian König
maintainerAm 20.06.24 um 15:55 schrieb Danijel Slivka:
Quoted 15 lines
Clearing the IH_RB_W/RPTR during interrupts disable is not clearing the
RB_OVERFLOWbit.
Adding workaround to clear the wptr when enabling interrupts in caseRB_OVERFLOWbit is set.Signed-off-by Danijel Slivka <[email protected]>--- drivers/gpu/drm/amd/amdgpu/ih_v6_0.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/gpu/drm/amd/amdgpu/ih_v6_0.c +0
-0
drivers/gpu/drm/amd/amdgpu/ih_v6_0.c static int ih_v6_0_toggle_ring_interrupts(struct amdgpu_device *adev, · line 155
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/ih_v6_0.c +6
-0@@ -147,6 +147,12 @@ static int ih_v6_0_toggle_ring_interrupts(struct amdgpu_device *adev, }if (enable) { +if (amdgpu_sriov_vf (adev) && +REG_GET_FIELD (RREG32 (ih_regs->ih_rb_wptr),IH_RB_WPTR ,RB_OVERFLOW )) { +/* clear rptr, wptr*/ +WREG32 (ih_regs->ih_rb_rptr,0 ); +WREG32 (ih_regs->ih_rb_wptr,0 ); + }
Well that change doesn't really make much sense. We disable the IH ring before we do any initialisation, see ih_v6_0_irq_init().
That in turn sets RPTR and WPTR to 0:
/* set rptr, wptr to 0 */
WREG32(ih_regs->ih_rb_rptr, 0);
WREG32(ih_regs->ih_rb_wptr, 0);
ih->enabled = false;
So why should this be needed here?
Regards,
Christian.
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/ih_v6_0.c +0
-0ih->enabled = true; }else {/* set rptr, wptr to 0 */
Quoted 18 lines · Danijel Slivka
Clearing the IH_RB_W/RPTR during interrupts disable is not clearing the
RB_OVERFLOWbit.
Adding workaround to clear the wptr when enabling interrupts in caseRB_OVERFLOWbit is set.Signed-off-by Danijel Slivka <[email protected]>--- drivers/gpu/drm/amd/amdgpu/ih_v6_0.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/gpu/drm/amd/amdgpu/ih_v6_0.c +0
-0@@ -147,6 +147,12 @@ static int ih_v6_0_toggle_ring_interrupts(struct amdgpu_device *adev, }
drivers/gpu/drm/amd/amdgpu/ih_v6_0.c static int ih_v6_0_toggle_ring_interrupts(struct amdgpu_device *adev, · line 158
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/ih_v6_0.c +6
-0if (enable) { +if (amdgpu_sriov_vf (adev) && +REG_GET_FIELD (RREG32 (ih_regs->ih_rb_wptr),IH_RB_WPTR ,RB_OVERFLOW )) { +/* clear rptr, wptr*/ +WREG32 (ih_regs->ih_rb_rptr,0 ); +WREG32 (ih_regs->ih_rb_wptr,0 ); + } ih->enabled = true; }else {/* set rptr, wptr to 0 */
These already get cleared in the else case and this function gets called at the start of ih_v6_0_irq_init() so these should already be cleared by the time we get here.
Alex