Skip to contentSkip to conversation

drm/amdgpu: fix GRBM read timeout when do mes_self_test

PATCH In review Tim Huang 2 participants 2 messages Nov 1, 2023 – Nov 2, 2023

Subsystems (2)
lore
Share & tools
lore

Tim Huang

author
#0 lore raw

PATCH v2 1/1 drm/amdgpu: fix GRBM read timeout when do mes_self_test

Use a proper MEID to make sure the CP_HQD_* and CP_GFX_HQD_* registers can be touched when initialize the compute and gfx mqd in mes_self_test. Otherwise, we expect no response from CP and an GRBM eventual timeout.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +16 -0
index 70fe3b39c004..45280fb0e00c 100644
@@ -556,8 +556,20 @@ static void amdgpu_mes_queue_init_mqd(struct amdgpu_device *adev,
 	mqd_prop.hqd_queue_priority = p->hqd_queue_priority;
 	mqd_prop.hqd_active = false;
 
+	if (p->queue_type == AMDGPU_RING_TYPE_GFX ||
+	    p->queue_type == AMDGPU_RING_TYPE_COMPUTE) {
+		mutex_lock(&adev->srbm_mutex);
+		amdgpu_gfx_select_me_pipe_q(adev, p->ring->me, p->ring->pipe, 0, 0, 0);
+	}
+
 	mqd_mgr->init_mqd(adev, q->mqd_cpu_ptr, &mqd_prop);
 
+	if (p->queue_type == AMDGPU_RING_TYPE_GFX ||
+	    p->queue_type == AMDGPU_RING_TYPE_COMPUTE) {
+		amdgpu_gfx_select_me_pipe_q(adev, 0, 0, 0, 0, 0);
+		mutex_unlock(&adev->srbm_mutex);
+	}
+
 	amdgpu_bo_unreserve(q->mqd_obj);
 }
 
@@ -993,9 +1005,13 @@ int amdgpu_mes_add_ring(struct amdgpu_device *adev, int gang_id,
 	switch (queue_type) {
 	case AMDGPU_RING_TYPE_GFX:
 		ring->funcs = adev->gfx.gfx_ring[0].funcs;
+		ring->me = adev->gfx.gfx_ring[0].me;
+		ring->pipe = adev->gfx.gfx_ring[0].pipe;
 		break;
 	case AMDGPU_RING_TYPE_COMPUTE:
 		ring->funcs = adev->gfx.compute_ring[0].funcs;
+		ring->me = adev->gfx.compute_ring[0].me;
+		ring->pipe = adev->gfx.compute_ring[0].pipe;
 		break;
 	case AMDGPU_RING_TYPE_SDMA:
 		ring->funcs = adev->sdma.instance[0].ring.funcs;
Signature · 1 line
2.39.2
Reviewed-by on v2 1/1
#1 lore raw

[AMD Official Use Only - General]

This patch is :

-----Original Message-----
From: Huang, Tim <[email protected]>
Sent: Wednesday, November 1, 2023 4:53 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhang, Yifan <[email protected]>; Xiao, Jack <[email protected]>; Huang, Tim <[email protected]>
Subject: [PATCH v2] drm/amdgpu: fix GRBM read timeout when do mes_self_test

Use a proper MEID to make sure the CP_HQD_* and CP_GFX_HQD_* registers can be touched when initialize the compute and gfx mqd in mes_self_test. Otherwise, we expect no response from CP and an GRBM eventual timeout.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +16 -0
index 70fe3b39c004..45280fb0e00c 100644
@@ -556,8 +556,20 @@ static void amdgpu_mes_queue_init_mqd(struct amdgpu_device *adev,
        mqd_prop.hqd_queue_priority = p->hqd_queue_priority;
        mqd_prop.hqd_active = false;
 
+       if (p->queue_type == AMDGPU_RING_TYPE_GFX ||
+           p->queue_type == AMDGPU_RING_TYPE_COMPUTE) {
+               mutex_lock(&adev->srbm_mutex);
+               amdgpu_gfx_select_me_pipe_q(adev, p->ring->me, p->ring->pipe, 0, 0, 0);
+       }
+
        mqd_mgr->init_mqd(adev, q->mqd_cpu_ptr, &mqd_prop);
 
+       if (p->queue_type == AMDGPU_RING_TYPE_GFX ||
+           p->queue_type == AMDGPU_RING_TYPE_COMPUTE) {
+               amdgpu_gfx_select_me_pipe_q(adev, 0, 0, 0, 0, 0);
+               mutex_unlock(&adev->srbm_mutex);
+       }
+
        amdgpu_bo_unreserve(q->mqd_obj);
 }
 
@@ -993,9 +1005,13 @@ int amdgpu_mes_add_ring(struct amdgpu_device *adev, int gang_id,
        switch (queue_type) {
        case AMDGPU_RING_TYPE_GFX:
                ring->funcs = adev->gfx.gfx_ring[0].funcs;
+               ring->me = adev->gfx.gfx_ring[0].me;
+               ring->pipe = adev->gfx.gfx_ring[0].pipe;
                break;
        case AMDGPU_RING_TYPE_COMPUTE:
                ring->funcs = adev->gfx.compute_ring[0].funcs;
+               ring->me = adev->gfx.compute_ring[0].me;
+               ring->pipe = adev->gfx.compute_ring[0].pipe;
                break;
        case AMDGPU_RING_TYPE_SDMA:
                ring->funcs = adev->sdma.instance[0].ring.funcs;

--
2.39.2