Added bif doorbell interrupt setting and applied different
settings for BACO reset for RAS recovery.

Change-Id: I823b2d478699d469ecc7746e2a8fb1110a4a146f
Signed-off-by: Evan Quan <evan.q...@amd.com>
---
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 30 ++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c 
b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
index 928877f73dfd..71e2bbe25cf6 100644
--- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
@@ -1667,6 +1667,10 @@ int smu_v11_0_baco_set_state(struct smu_context *smu, 
enum smu_baco_state state)
 {
 
        struct smu_baco_context *smu_baco = &smu->smu_baco;
+       struct amdgpu_device *adev = smu->adev;
+       struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
+       uint32_t bif_doorbell_intr_cntl;
+       uint32_t data;
        int ret = 0;
 
        if (smu_v11_0_baco_get_state(smu) == state)
@@ -1674,10 +1678,30 @@ int smu_v11_0_baco_set_state(struct smu_context *smu, 
enum smu_baco_state state)
 
        mutex_lock(&smu_baco->mutex);
 
-       if (state == SMU_BACO_STATE_ENTER)
-               ret = smu_send_smc_msg_with_param(smu, SMU_MSG_EnterBaco, 
BACO_SEQ_BACO);
-       else
+       bif_doorbell_intr_cntl = RREG32_SOC15(NBIO, 0, mmBIF_DOORBELL_INT_CNTL);
+
+       if (state == SMU_BACO_STATE_ENTER) {
+               bif_doorbell_intr_cntl = REG_SET_FIELD(bif_doorbell_intr_cntl,
+                                               BIF_DOORBELL_INT_CNTL,
+                                               DOORBELL_INTERRUPT_DISABLE, 1);
+               WREG32_SOC15(NBIO, 0, mmBIF_DOORBELL_INT_CNTL, 
bif_doorbell_intr_cntl);
+
+               if (!ras || !ras->supported) {
+                       data = RREG32_SOC15(THM, 0, mmTHM_BACO_CNTL);
+                       data |= 0x80000000;
+                       WREG32_SOC15(THM, 0, mmTHM_BACO_CNTL, data);
+
+                       ret = smu_send_smc_msg_with_param(smu, 
SMU_MSG_EnterBaco, 0);
+               } else {
+                       ret = smu_send_smc_msg_with_param(smu, 
SMU_MSG_EnterBaco, 1);
+               }
+       } else {
                ret = smu_send_smc_msg(smu, SMU_MSG_ExitBaco);
+               bif_doorbell_intr_cntl = REG_SET_FIELD(bif_doorbell_intr_cntl,
+                                               BIF_DOORBELL_INT_CNTL,
+                                               DOORBELL_INTERRUPT_DISABLE, 0);
+               WREG32_SOC15(NBIO, 0, mmBIF_DOORBELL_INT_CNTL, 
bif_doorbell_intr_cntl);
+       }
        if (ret)
                goto out;
 
-- 
2.24.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to