Skip to content

Commit 83033f7

Browse files
committed
drm/amdgpu/gfx11: use generic [en/dis]able_kgq() helpers
And remove the duplicate local variants. Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent f39c253 commit 83033f7

File tree

1 file changed

+2
-47
lines changed

1 file changed

+2
-47
lines changed

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

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3710,28 +3710,6 @@ static int gfx_v11_0_gfx_init_queue(struct amdgpu_ring *ring)
37103710
return 0;
37113711
}
37123712

3713-
static int gfx_v11_0_kiq_enable_kgq(struct amdgpu_device *adev)
3714-
{
3715-
struct amdgpu_kiq *kiq = &adev->gfx.kiq[0];
3716-
struct amdgpu_ring *kiq_ring = &adev->gfx.kiq[0].ring;
3717-
int r, i;
3718-
3719-
if (!kiq->pmf || !kiq->pmf->kiq_map_queues)
3720-
return -EINVAL;
3721-
3722-
r = amdgpu_ring_alloc(kiq_ring, kiq->pmf->map_queues_size *
3723-
adev->gfx.num_gfx_rings);
3724-
if (r) {
3725-
DRM_ERROR("Failed to lock KIQ (%d).\n", r);
3726-
return r;
3727-
}
3728-
3729-
for (i = 0; i < adev->gfx.num_gfx_rings; i++)
3730-
kiq->pmf->kiq_map_queues(kiq_ring, &adev->gfx.gfx_ring[i]);
3731-
3732-
return amdgpu_ring_test_helper(kiq_ring);
3733-
}
3734-
37353713
static int gfx_v11_0_cp_async_gfx_ring_resume(struct amdgpu_device *adev)
37363714
{
37373715
int r, i;
@@ -3755,7 +3733,7 @@ static int gfx_v11_0_cp_async_gfx_ring_resume(struct amdgpu_device *adev)
37553733
goto done;
37563734
}
37573735

3758-
r = gfx_v11_0_kiq_enable_kgq(adev);
3736+
r = amdgpu_gfx_enable_kgq(adev, 0);
37593737
if (r)
37603738
goto done;
37613739

@@ -4392,29 +4370,6 @@ static int gfx_v11_0_hw_init(void *handle)
43924370
return r;
43934371
}
43944372

4395-
static int gfx_v11_0_kiq_disable_kgq(struct amdgpu_device *adev)
4396-
{
4397-
struct amdgpu_kiq *kiq = &adev->gfx.kiq[0];
4398-
struct amdgpu_ring *kiq_ring = &kiq->ring;
4399-
int i, r = 0;
4400-
4401-
if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues)
4402-
return -EINVAL;
4403-
4404-
if (amdgpu_ring_alloc(kiq_ring, kiq->pmf->unmap_queues_size *
4405-
adev->gfx.num_gfx_rings))
4406-
return -ENOMEM;
4407-
4408-
for (i = 0; i < adev->gfx.num_gfx_rings; i++)
4409-
kiq->pmf->kiq_unmap_queues(kiq_ring, &adev->gfx.gfx_ring[i],
4410-
PREEMPT_QUEUES, 0, 0);
4411-
4412-
if (adev->gfx.kiq[0].ring.sched.ready)
4413-
r = amdgpu_ring_test_helper(kiq_ring);
4414-
4415-
return r;
4416-
}
4417-
44184373
static int gfx_v11_0_hw_fini(void *handle)
44194374
{
44204375
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -4426,7 +4381,7 @@ static int gfx_v11_0_hw_fini(void *handle)
44264381

44274382
if (!adev->no_hw_access) {
44284383
if (amdgpu_async_gfx_ring) {
4429-
r = gfx_v11_0_kiq_disable_kgq(adev);
4384+
r = amdgpu_gfx_disable_kgq(adev, 0);
44304385
if (r)
44314386
DRM_ERROR("KGQ disable failed\n");
44324387
}

0 commit comments

Comments
 (0)