mirror of
https://github.com/torvalds/linux.git
synced 2026-09-26 18:12:03 +02:00
drm/amdgpu/gfx: add a helper for MQD restore
The handling is common so extract it to a helper. Reviewed-by: Jesse Zhang <jesse.zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
c3e8df87af
commit
a3cc796501
|
|
@ -377,6 +377,30 @@ int amdgpu_gfx_kiq_init(struct amdgpu_device *adev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
void amdgpu_gfx_mqd_reset_restore(struct amdgpu_ring *ring)
|
||||
{
|
||||
struct amdgpu_device *adev = ring->adev;
|
||||
int mqd_idx, mqd_size;
|
||||
|
||||
/* restore mqd with the backup copy */
|
||||
if (ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE) {
|
||||
mqd_idx = ring - &adev->gfx.compute_ring[0];
|
||||
mqd_size = adev->mqds[AMDGPU_HW_IP_COMPUTE].mqd_size;
|
||||
if (adev->gfx.mec.mqd_backup[mqd_idx])
|
||||
memcpy_toio(ring->mqd_ptr, adev->gfx.mec.mqd_backup[mqd_idx], mqd_size);
|
||||
} else if (ring->funcs->type == AMDGPU_RING_TYPE_GFX) {
|
||||
mqd_size = adev->mqds[AMDGPU_HW_IP_GFX].mqd_size;
|
||||
mqd_idx = ring - &adev->gfx.gfx_ring[0];
|
||||
|
||||
if (adev->gfx.me.mqd_backup[mqd_idx])
|
||||
memcpy_toio(ring->mqd_ptr, adev->gfx.me.mqd_backup[mqd_idx], mqd_size);
|
||||
}
|
||||
/* reset the ring */
|
||||
ring->wptr = 0;
|
||||
atomic64_set((atomic64_t *)ring->wptr_cpu_addr, 0);
|
||||
amdgpu_ring_clear_ring(ring);
|
||||
}
|
||||
|
||||
/* create MQD for each compute/gfx queue */
|
||||
int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev,
|
||||
unsigned int mqd_size, int xcc_id)
|
||||
|
|
|
|||
|
|
@ -586,6 +586,7 @@ void amdgpu_gfx_kiq_fini(struct amdgpu_device *adev, int xcc_id);
|
|||
int amdgpu_gfx_kiq_init(struct amdgpu_device *adev,
|
||||
unsigned hpd_size, int xcc_id);
|
||||
|
||||
void amdgpu_gfx_mqd_reset_restore(struct amdgpu_ring *ring);
|
||||
int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev,
|
||||
unsigned mqd_size, int xcc_id);
|
||||
void amdgpu_gfx_mqd_sw_fini(struct amdgpu_device *adev, int xcc_id);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user