mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
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>
This commit is contained in:
committed by
Alex Deucher
parent
788dbb6b41
commit
9041b53a59
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user