Skip to contentSkip to conversation

drm/amdgpu: Stop clearing kiq position during unload

PATCH In review YuBiao Wang 2 participants 2 messages Nov 10, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Stop clearing kiq position during unload

Do not clear kiq position in RLC_CP_SCHEDULER so that CP could perform IDLE-SAVE after VF fini. CPG also needs to be active in save command.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 14 ++++++--------
 drivers/gpu/drm/amd/amdgpu/mes_v11_0.c |  4 +++-
 2 files changed, 9 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +6 -8
index 9447999a3a48..232ccd639184 100644
@@ -4411,15 +4411,13 @@ static int gfx_v11_0_hw_fini(void *handle)
 		amdgpu_mes_kiq_hw_fini(adev);
 	}
 
-	if (amdgpu_sriov_vf(adev)) {
-		gfx_v11_0_cp_gfx_enable(adev, false);
-		/* Program KIQ position of RLC_CP_SCHEDULERS during destroy */
-		tmp = RREG32_SOC15(GC, 0, regRLC_CP_SCHEDULERS);
-		tmp &= 0xffffff00;
-		WREG32_SOC15(GC, 0, regRLC_CP_SCHEDULERS, tmp);
-
+	if (amdgpu_sriov_vf(adev))
+		/* Remove the steps disabling CPG and clearing KIQ position,
+		 * so that CP could perform IDLE-SAVE during switch.
+		 * Those steps were to avoid a DMAR error in gfx9 but it is not reproduced on gfx11.
+		 */
 		return 0;
-	}
+
 	gfx_v11_0_cp_enable(adev, false);
 	gfx_v11_0_enable_gui_idle_interrupt(adev, false);
 
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +3 -1
index 7bfe862aa83e..02ad84a1526a 100644
@@ -1248,7 +1248,9 @@ static int mes_v11_0_kiq_hw_fini(struct amdgpu_device *adev)
 	if (adev->mes.ring.sched.ready)
 		mes_v11_0_kiq_dequeue_sched(adev);
 
-	mes_v11_0_enable(adev, false);
+	if (!amdgpu_sriov_vf(adev))
+		mes_v11_0_enable(adev, false);
+
 	return 0;
 }
 
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 21 lines · YuBiao Wang

Do not clear kiq position in RLC_CP_SCHEDULER so that CP could perform IDLE-SAVE after VF fini. CPG also needs to be active in save command.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 14 ++++++--------
 drivers/gpu/drm/amd/amdgpu/mes_v11_0.c |  4 +++-
 2 files changed, 9 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +0 -4
index 9447999a3a48..232ccd639184 100644
@@ -4411,15 +4411,13 @@ static int gfx_v11_0_hw_fini(void *handle)
 		amdgpu_mes_kiq_hw_fini(adev);
 	}
 
-	if (amdgpu_sriov_vf(adev)) {
-		gfx_v11_0_cp_gfx_enable(adev, false);
-		/* Program KIQ position of RLC_CP_SCHEDULERS during destroy */
-		tmp = RREG32_SOC15(GC, 0, regRLC_CP_SCHEDULERS);

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c static int gfx_v11_0_hw_fini(void *handle) · line 4422

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +5 -4
-		tmp &= 0xffffff00;
-		WREG32_SOC15(GC, 0, regRLC_CP_SCHEDULERS, tmp);
-
+	if (amdgpu_sriov_vf(adev))
+		/* Remove the steps disabling CPG and clearing KIQ position,
+		 * so that CP could perform IDLE-SAVE during switch.
+		 * Those steps were to avoid a DMAR error in gfx9 but it is not reproduced on gfx11.
+		 */
 		return 0;
-	}

Wrap this comment to the 80-char limit. If you're using Emacs, set the pointer (cursor) anywhere in the comment, then the following key sequence, C-u 78 C-x f M-q, reformats the comment to look like this:

/* Remove the steps disabling CPG and clearing KIQ position,
* so that CP could perform IDLE-SAVE during switch. Those
* steps are necessary to avoid a DMAR error in gfx9 but it is
* not reproduced on gfx11.
*/

From then on, you can just press M-q anywhere as often as you'd like for format anything.

Also note the change from "Those steps were to avoid ..." to "Those steps are necessary to avoid ...".

With that fixed, this patch is,

Regards,
Luben

Quoted 19 lines
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +1 -0
+
 	gfx_v11_0_cp_enable(adev, false);
 	gfx_v11_0_enable_gui_idle_interrupt(adev, false);
 
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +3 -1
index 7bfe862aa83e..02ad84a1526a 100644
@@ -1248,7 +1248,9 @@ static int mes_v11_0_kiq_hw_fini(struct amdgpu_device *adev)
 	if (adev->mes.ring.sched.ready)
 		mes_v11_0_kiq_dequeue_sched(adev);
 
-	mes_v11_0_enable(adev, false);
+	if (!amdgpu_sriov_vf(adev))
+		mes_v11_0_enable(adev, false);
+
 	return 0;
 }