Skip to content

Commit af40154

Browse files
Jack Xiaoalexdeucher
authored andcommitted
drm/amdgpu/mes12: sw/hw fini for unified mes
Free memory for two pipes and unmap pipe0 via pipe1. Signed-off-by: Jack Xiao <[email protected]> Acked-by: Alex Deucher <[email protected]> Reviewed-by: Hawking Zhang <[email protected]> Signed-off-by: Alex Deucher <[email protected]> (cherry picked from commit 98cae69)
1 parent 7254027 commit af40154

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

drivers/gpu/drm/amd/amdgpu/mes_v12_0.c

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,18 +1305,21 @@ static int mes_v12_0_sw_fini(void *handle)
13051305
&adev->mes.eop_gpu_addr[pipe],
13061306
NULL);
13071307
amdgpu_ucode_release(&adev->mes.fw[pipe]);
1308-
}
1309-
1310-
amdgpu_bo_free_kernel(&adev->gfx.kiq[0].ring.mqd_obj,
1311-
&adev->gfx.kiq[0].ring.mqd_gpu_addr,
1312-
&adev->gfx.kiq[0].ring.mqd_ptr);
13131308

1314-
amdgpu_bo_free_kernel(&adev->mes.ring[0].mqd_obj,
1315-
&adev->mes.ring[0].mqd_gpu_addr,
1316-
&adev->mes.ring[0].mqd_ptr);
1309+
if (adev->enable_uni_mes || pipe == AMDGPU_MES_SCHED_PIPE) {
1310+
amdgpu_bo_free_kernel(&adev->mes.ring[pipe].mqd_obj,
1311+
&adev->mes.ring[pipe].mqd_gpu_addr,
1312+
&adev->mes.ring[pipe].mqd_ptr);
1313+
amdgpu_ring_fini(&adev->mes.ring[pipe]);
1314+
}
1315+
}
13171316

1318-
amdgpu_ring_fini(&adev->gfx.kiq[0].ring);
1319-
amdgpu_ring_fini(&adev->mes.ring[0]);
1317+
if (!adev->enable_uni_mes) {
1318+
amdgpu_bo_free_kernel(&adev->gfx.kiq[0].ring.mqd_obj,
1319+
&adev->gfx.kiq[0].ring.mqd_gpu_addr,
1320+
&adev->gfx.kiq[0].ring.mqd_ptr);
1321+
amdgpu_ring_fini(&adev->gfx.kiq[0].ring);
1322+
}
13201323

13211324
if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT) {
13221325
mes_v12_0_free_ucode_buffers(adev, AMDGPU_MES_KIQ_PIPE);
@@ -1433,7 +1436,13 @@ static int mes_v12_0_kiq_hw_init(struct amdgpu_device *adev)
14331436
static int mes_v12_0_kiq_hw_fini(struct amdgpu_device *adev)
14341437
{
14351438
if (adev->mes.ring[0].sched.ready) {
1436-
mes_v12_0_kiq_dequeue_sched(adev);
1439+
if (adev->enable_uni_mes)
1440+
amdgpu_mes_unmap_legacy_queue(adev,
1441+
&adev->mes.ring[AMDGPU_MES_SCHED_PIPE],
1442+
RESET_QUEUES, 0, 0);
1443+
else
1444+
mes_v12_0_kiq_dequeue_sched(adev);
1445+
14371446
adev->mes.ring[0].sched.ready = false;
14381447
}
14391448

0 commit comments

Comments
 (0)