Skip to content

Commit 4246b10

Browse files
Jack Xiaoalexdeucher
authored andcommitted
drm/amdgpu/mes12: fix suspend issue
Use mes pipe to unmap kcq and kgq. 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 f7fb9d6)
1 parent af40154 commit 4246b10

File tree

2 files changed

+23
-26
lines changed

2 files changed

+23
-26
lines changed

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,16 @@ int amdgpu_gfx_disable_kcq(struct amdgpu_device *adev, int xcc_id)
509509
int i, r = 0;
510510
int j;
511511

512+
if (adev->enable_mes) {
513+
for (i = 0; i < adev->gfx.num_compute_rings; i++) {
514+
j = i + xcc_id * adev->gfx.num_compute_rings;
515+
amdgpu_mes_unmap_legacy_queue(adev,
516+
&adev->gfx.compute_ring[j],
517+
RESET_QUEUES, 0, 0);
518+
}
519+
return 0;
520+
}
521+
512522
if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues)
513523
return -EINVAL;
514524

@@ -551,6 +561,18 @@ int amdgpu_gfx_disable_kgq(struct amdgpu_device *adev, int xcc_id)
551561
int i, r = 0;
552562
int j;
553563

564+
if (adev->enable_mes) {
565+
if (amdgpu_gfx_is_master_xcc(adev, xcc_id)) {
566+
for (i = 0; i < adev->gfx.num_gfx_rings; i++) {
567+
j = i + xcc_id * adev->gfx.num_gfx_rings;
568+
amdgpu_mes_unmap_legacy_queue(adev,
569+
&adev->gfx.gfx_ring[j],
570+
PREEMPT_QUEUES, 0, 0);
571+
}
572+
}
573+
return 0;
574+
}
575+
554576
if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues)
555577
return -EINVAL;
556578

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

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3546,42 +3546,17 @@ static int gfx_v12_0_hw_init(void *handle)
35463546
return r;
35473547
}
35483548

3549-
static int gfx_v12_0_kiq_disable_kgq(struct amdgpu_device *adev)
3550-
{
3551-
struct amdgpu_kiq *kiq = &adev->gfx.kiq[0];
3552-
struct amdgpu_ring *kiq_ring = &kiq->ring;
3553-
int i, r = 0;
3554-
3555-
if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues)
3556-
return -EINVAL;
3557-
3558-
if (amdgpu_ring_alloc(kiq_ring, kiq->pmf->unmap_queues_size *
3559-
adev->gfx.num_gfx_rings))
3560-
return -ENOMEM;
3561-
3562-
for (i = 0; i < adev->gfx.num_gfx_rings; i++)
3563-
kiq->pmf->kiq_unmap_queues(kiq_ring, &adev->gfx.gfx_ring[i],
3564-
PREEMPT_QUEUES, 0, 0);
3565-
3566-
if (adev->gfx.kiq[0].ring.sched.ready)
3567-
r = amdgpu_ring_test_helper(kiq_ring);
3568-
3569-
return r;
3570-
}
3571-
35723549
static int gfx_v12_0_hw_fini(void *handle)
35733550
{
35743551
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
3575-
int r;
35763552
uint32_t tmp;
35773553

35783554
amdgpu_irq_put(adev, &adev->gfx.priv_reg_irq, 0);
35793555
amdgpu_irq_put(adev, &adev->gfx.priv_inst_irq, 0);
35803556

35813557
if (!adev->no_hw_access) {
35823558
if (amdgpu_async_gfx_ring) {
3583-
r = gfx_v12_0_kiq_disable_kgq(adev);
3584-
if (r)
3559+
if (amdgpu_gfx_disable_kgq(adev, 0))
35853560
DRM_ERROR("KGQ disable failed\n");
35863561
}
35873562

0 commit comments

Comments
 (0)