diff options
author | 2023-06-28 16:02:02 -0400 | |
---|---|---|
committer | 2023-07-07 13:51:48 -0400 | |
commit | 9041b53a59d77039c69fa61be8575fa232cd3bcd (patch) | |
tree | d01b50769857935503f2c47248c2d4f0ba168128 /drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | |
parent | drm/amd/display: Clean up warnings in amdgpu_dm _mst_types, _plane, _psr.c (diff) | |
download | linux-9041b53a59d77039c69fa61be8575fa232cd3bcd.tar.gz linux-9041b53a59d77039c69fa61be8575fa232cd3bcd.tar.bz2 linux-9041b53a59d77039c69fa61be8575fa232cd3bcd.zip |
drm/amdkfd: Use KIQ to unmap HIQ
Currently, we unmap HIQ by directly writing to HQD
registers. This doesn't work for GFX9.4.3. Instead,
use KIQ to unmap HIQ, similar to how we use KIQ to
map HIQ. Using KIQ to unmap HIQ works for all GFX
series post GFXv9.
Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c index b4fcad0e62f7..0040c63e2356 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c @@ -830,3 +830,39 @@ u64 amdgpu_amdkfd_xcp_memory_size(struct amdgpu_device *adev, int xcp_id) return adev->gmc.real_vram_size; } } + +int amdgpu_amdkfd_unmap_hiq(struct amdgpu_device *adev, u32 doorbell_off, + u32 inst) +{ + struct amdgpu_kiq *kiq = &adev->gfx.kiq[inst]; + struct amdgpu_ring *kiq_ring = &kiq->ring; + struct amdgpu_ring_funcs ring_funcs; + struct amdgpu_ring ring; + int r = 0; + + if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues) + return -EINVAL; + + memset(&ring, 0x0, sizeof(struct amdgpu_ring)); + memset(&ring_funcs, 0x0, sizeof(struct amdgpu_ring_funcs)); + + ring_funcs.type = AMDGPU_RING_TYPE_COMPUTE; + ring.doorbell_index = doorbell_off; + ring.funcs = &ring_funcs; + + spin_lock(&kiq->ring_lock); + + if (amdgpu_ring_alloc(kiq_ring, kiq->pmf->unmap_queues_size)) { + spin_unlock(&kiq->ring_lock); + return -ENOMEM; + } + + kiq->pmf->kiq_unmap_queues(kiq_ring, &ring, RESET_QUEUES, 0, 0); + + if (kiq_ring->sched.ready && !adev->job_hang) + r = amdgpu_ring_test_helper(kiq_ring); + + spin_unlock(&kiq->ring_lock); + + return r; +} |