Skip to contentSkip to conversation

drm/amdgpu doorbell range should be set when gpu recovery

PATCH In review Lin.Cao 2 participants 2 messages Oct 30, 2023 – Oct 31, 2023

Subsystems (2)
lore
Share & tools
lore

Lin.Cao

author
#0 lore raw

PATCH v2 1/1 drm/amdgpu doorbell range should be set when gpu recovery

GFX doorbell range should be set after flr otherwise the gfx doorbell range will be overlap with MEC.

v2: remove "amdgpu_sriov_vf" and "amdgpu_in_reset" check, and add grbm select for the case of 2 gfx rings.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +7 -0
index d9ccacd06fba..c9f4e8252070 100644
@@ -6467,6 +6467,13 @@ static int gfx_v10_0_gfx_init_queue(struct amdgpu_ring *ring)
 		if (adev->gfx.me.mqd_backup[mqd_idx])
 			memcpy(adev->gfx.me.mqd_backup[mqd_idx], mqd, sizeof(*mqd));
 	} else {
+		mutex_lock(&adev->srbm_mutex);
+		nv_grbm_select(adev, ring->me, ring->pipe, ring->queue, 0);
+		if (ring->doorbell_index == adev->doorbell_index.gfx_ring0 << 1)
+			gfx_v10_0_cp_gfx_set_doorbell(adev, ring);
+
+		nv_grbm_select(adev, 0, 0, 0, 0);
+		mutex_unlock(&adev->srbm_mutex);
 		/* restore mqd with the backup copy */
 		if (adev->gfx.me.mqd_backup[mqd_idx])
 			memcpy(mqd, adev->gfx.me.mqd_backup[mqd_idx], sizeof(*mqd));
Signature · 1 line
2.25.1
Acked-by ZhenGuo Yin on v2 1/1
#1 lore raw
Quoted 29 lines · Lin.Cao

GFX doorbell range should be set after flr otherwise the gfx doorbell range will be overlap with MEC.

v2: remove "amdgpu_sriov_vf" and "amdgpu_in_reset" check, and add grbm select for the case of 2 gfx rings.

---
  drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 7 +++++++
  1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +7 -0
index d9ccacd06fba..c9f4e8252070 100644
@@ -6467,6 +6467,13 @@ static int gfx_v10_0_gfx_init_queue(struct amdgpu_ring *ring)
  		if (adev->gfx.me.mqd_backup[mqd_idx])
  			memcpy(adev->gfx.me.mqd_backup[mqd_idx], mqd, sizeof(*mqd));
  	} else {
+		mutex_lock(&adev->srbm_mutex);
+		nv_grbm_select(adev, ring->me, ring->pipe, ring->queue, 0);
+		if (ring->doorbell_index == adev->doorbell_index.gfx_ring0 << 1)
+			gfx_v10_0_cp_gfx_set_doorbell(adev, ring);
+
+		nv_grbm_select(adev, 0, 0, 0, 0);
+		mutex_unlock(&adev->srbm_mutex);
  		/* restore mqd with the backup copy */
  		if (adev->gfx.me.mqd_backup[mqd_idx])
  			memcpy(mqd, adev->gfx.me.mqd_backup[mqd_idx], sizeof(*mqd));