Fix the register access in soft reset sequence to use the correct XCC
instance and per XCC sdma instance.  Soft reset is not yet supported in
SDMA v7.1 though.

Signed-off-by: Lijo Lazar <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c 
b/drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c
index 3e8facc0358d..c689e52b1d72 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c
@@ -788,8 +788,8 @@ static int sdma_v7_1_inst_load_microcode(struct 
amdgpu_device *adev,
 static int sdma_v7_1_soft_reset(struct amdgpu_ip_block *ip_block)
 {
        struct amdgpu_device *adev = ip_block->adev;
+       u32 xcc_id, sdma_xcc_inst;
        uint32_t inst_mask;
-       u32 xcc_id;
        u32 tmp;
        int i;
 
@@ -797,6 +797,8 @@ static int sdma_v7_1_soft_reset(struct amdgpu_ip_block 
*ip_block)
        sdma_v7_1_inst_gfx_stop(adev, inst_mask);
 
        for_each_inst(i, inst_mask) {
+               sdma_xcc_inst =
+                       GET_INST(SDMA0, i) % adev->sdma.num_inst_per_xcc;
                xcc_id = adev->sdma.instance[i].xcc_id;
 
                //tmp = RREG32_SOC15_OFFSET(GC, xcc_id, regSDMA0_SDMA_FREEZE,
@@ -810,14 +812,14 @@ static int sdma_v7_1_soft_reset(struct amdgpu_ip_block 
*ip_block)
 
                udelay(100);
 
-               tmp = GRBM_SOFT_RESET__SOFT_RESET_SDMA0_MASK << i;
-               WREG32_SOC15(GC, 0, regGRBM_SOFT_RESET, tmp);
-               tmp = RREG32_SOC15(GC, 0, regGRBM_SOFT_RESET);
+               tmp = GRBM_SOFT_RESET__SOFT_RESET_SDMA0_MASK << sdma_xcc_inst;
+               WREG32_SOC15(GC, xcc_id, regGRBM_SOFT_RESET, tmp);
+               tmp = RREG32_SOC15(GC, xcc_id, regGRBM_SOFT_RESET);
 
                udelay(100);
 
-               WREG32_SOC15(GC, 0, regGRBM_SOFT_RESET, 0);
-               tmp = RREG32_SOC15(GC, 0, regGRBM_SOFT_RESET);
+               WREG32_SOC15(GC, xcc_id, regGRBM_SOFT_RESET, 0);
+               tmp = RREG32_SOC15(GC, xcc_id, regGRBM_SOFT_RESET);
 
                udelay(100);
        }
-- 
2.49.0

Reply via email to