Skip to contentSkip to conversation

drm/amdgpu/mes: zero the sdma_hqd_mask of 2nd SDMA engine for SDMA 6.0.1

PATCH Superseded Yifan Zhang 2 participants 3 messages Aug 30, 2022 – Aug 31, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu/mes: zero the sdma_hqd_mask of 2nd SDMA engine for SDMA 6.0.1

there is only one SDMA engine in SDMA 6.0.1, the sdma_hqd_mask has to be zeroed for the 2nd engine, otherwise MES scheduler will consider 2nd engine exists and map/unmap SDMA queues to the non-existent engine.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +8 -0
index fe82b8b19a4e..f876fd62ab81 100644
@@ -185,6 +185,14 @@ int amdgpu_mes_init(struct amdgpu_device *adev)
 			adev->mes.sdma_hqd_mask[i] = 0xfc;
 	}
 
+	/* there is only one SDMA engine in SDMA 6.0.1, the sdma_hqd_mask
+	 * has to be zeroed for the 2nd engine, otherwise MES scheduler will
+	 * consider 2nd engine exists and map/unmap SDMA queues to the non-existent
+	 * engine.
+	 */
+	if (adev->ip_versions[SDMA0_HWIP][0] == IP_VERSION(6, 0, 1))
+		adev->mes.sdma_hqd_mask[AMDGPU_MES_MAX_SDMA_PIPES - 1] = 0;
+
 	r = amdgpu_device_wb_get(adev, &adev->mes.sch_ctx_offs);
 	if (r) {
 		dev_err(adev->dev,
Signature · 1 line
2.37.1
#1 lore raw
Quoted 15 lines · Yifan Zhang

there is only one SDMA engine in SDMA 6.0.1, the sdma_hqd_mask has to be zeroed for the 2nd engine, otherwise MES scheduler will consider 2nd engine exists and map/unmap SDMA queues to the non-existent engine.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +0 -0
index fe82b8b19a4e..f876fd62ab81 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c int amdgpu_mes_init(struct amdgpu_device *adev) · line 193

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +6 -0
@@ -185,6 +185,14 @@ int amdgpu_mes_init(struct amdgpu_device *adev)
                        adev->mes.sdma_hqd_mask[i] = 0xfc;
        }
 
+       /* there is only one SDMA engine in SDMA 6.0.1, the sdma_hqd_mask
+        * has to be zeroed for the 2nd engine, otherwise MES scheduler will
+        * consider 2nd engine exists and map/unmap SDMA queues to the non-existent
+        * engine.
+        */
+       if (adev->ip_versions[SDMA0_HWIP][0] == IP_VERSION(6, 0, 1))

How about checking for the number of instances rather than a specific IP version?
E.g.,
if (adev->sdma.num_instances == 1)

This makes things more future proof for newer SDMA 6.x IPs.

Alex

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +2 -1
+               adev->mes.sdma_hqd_mask[AMDGPU_MES_MAX_SDMA_PIPES - 1] = 0;
+
        r = amdgpu_device_wb_get(adev, &adev->mes.sch_ctx_offs);
        if (r) {
                dev_err(adev->dev,
--

2.37.1

#2 lore raw

[Public]

OK, that's a better solution.

Best Regards,
Yifan

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, August 30, 2022 11:31 PM
To: Zhang, Yifan <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; Huang, Tim <[email protected]>; Xiao, Jack <[email protected]>; Du, Xiaojian <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/mes: zero the sdma_hqd_mask of 2nd SDMA engine for SDMA 6.0.1

Quoted 16 lines · Yifan Zhang

there is only one SDMA engine in SDMA 6.0.1, the sdma_hqd_mask has to be zeroed for the 2nd engine, otherwise MES scheduler will consider 2nd engine exists and map/unmap SDMA queues to the non-existent engine.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +0 -0
index fe82b8b19a4e..f876fd62ab81 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c int amdgpu_mes_init(struct amdgpu_device *adev) · line 193

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +6 -0
@@ -185,6 +185,14 @@ int amdgpu_mes_init(struct amdgpu_device *adev)
                        adev->mes.sdma_hqd_mask[i] = 0xfc;
        }
 
+       /* there is only one SDMA engine in SDMA 6.0.1, the sdma_hqd_mask
+        * has to be zeroed for the 2nd engine, otherwise MES scheduler will
+        * consider 2nd engine exists and map/unmap SDMA queues to the non-existent
+        * engine.
+        */
+       if (adev->ip_versions[SDMA0_HWIP][0] == IP_VERSION(6, 0, 1))

How about checking for the number of instances rather than a specific IP version? E.g.,
if (adev->sdma.num_instances == 1)

This makes things more future proof for newer SDMA 6.x IPs.

Alex

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +3 -1
+               adev->mes.sdma_hqd_mask[AMDGPU_MES_MAX_SDMA_PIPES - 1] 
+ = 0;
+
        r = amdgpu_device_wb_get(adev, &adev->mes.sch_ctx_offs);
        if (r) {
                dev_err(adev->dev,
--

2.37.1