mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
drm/amdgpu: Use a common KGQ and KCQ reset helper for gfx11/12
They are all the same so use a common implementation. Reviewed-by: Jesse Zhang <jesse.zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
0268259988
commit
b5ded03135
|
|
@ -377,7 +377,7 @@ int amdgpu_gfx_kiq_init(struct amdgpu_device *adev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
void amdgpu_gfx_mqd_reset_restore(struct amdgpu_ring *ring)
|
||||
static void amdgpu_gfx_mqd_reset_restore(struct amdgpu_ring *ring)
|
||||
{
|
||||
struct amdgpu_device *adev = ring->adev;
|
||||
int mqd_idx, mqd_size;
|
||||
|
|
@ -1988,6 +1988,37 @@ static ssize_t amdgpu_gfx_get_compute_reset_mask(struct device *dev,
|
|||
return amdgpu_show_reset_mask(buf, adev->gfx.compute_supported_reset);
|
||||
}
|
||||
|
||||
int amdgpu_gfx_mes_reset_queue(struct amdgpu_ring *ring,
|
||||
unsigned int vmid,
|
||||
struct amdgpu_fence *timedout_fence,
|
||||
bool use_mmio)
|
||||
{
|
||||
struct amdgpu_device *adev = ring->adev;
|
||||
int r;
|
||||
|
||||
amdgpu_ring_reset_helper_begin(ring, timedout_fence);
|
||||
|
||||
r = amdgpu_mes_reset_legacy_queue(ring->adev, ring, vmid, use_mmio, 0);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
if (use_mmio) {
|
||||
r = amdgpu_mes_unmap_legacy_queue(adev, ring,
|
||||
RESET_QUEUES, 0, 0, 0);
|
||||
if (r)
|
||||
return r;
|
||||
amdgpu_gfx_mqd_reset_restore(ring);
|
||||
|
||||
r = amdgpu_mes_map_legacy_queue(adev, ring, 0);
|
||||
if (r) {
|
||||
dev_err(adev->dev, "failed to remap kgq\n");
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
return amdgpu_ring_reset_helper_end(ring, timedout_fence);
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(run_cleaner_shader, 0200,
|
||||
NULL, amdgpu_gfx_set_run_cleaner_shader);
|
||||
|
||||
|
|
|
|||
|
|
@ -588,7 +588,6 @@ 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);
|
||||
|
|
@ -670,6 +669,11 @@ void amdgpu_debugfs_compute_sched_mask_init(struct amdgpu_device *adev);
|
|||
|
||||
int amdgpu_gfx_ring_preempt_ib(struct amdgpu_ring *ring);
|
||||
|
||||
int amdgpu_gfx_mes_reset_queue(struct amdgpu_ring *ring,
|
||||
unsigned int vmid,
|
||||
struct amdgpu_fence *timedout_fence,
|
||||
bool use_mmio);
|
||||
|
||||
static inline const char *amdgpu_gfx_compute_mode_desc(int mode)
|
||||
{
|
||||
switch (mode) {
|
||||
|
|
|
|||
|
|
@ -6823,29 +6823,8 @@ static int gfx_v11_0_reset_kgq(struct amdgpu_ring *ring,
|
|||
{
|
||||
struct amdgpu_device *adev = ring->adev;
|
||||
bool use_mmio = adev->gfx.me.use_mmio_for_reset;
|
||||
int r;
|
||||
|
||||
amdgpu_ring_reset_helper_begin(ring, timedout_fence);
|
||||
|
||||
r = amdgpu_mes_reset_legacy_queue(ring->adev, ring, vmid, use_mmio, 0);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
if (use_mmio) {
|
||||
r = amdgpu_mes_unmap_legacy_queue(adev, ring,
|
||||
RESET_QUEUES, 0, 0, 0);
|
||||
if (r)
|
||||
return r;
|
||||
amdgpu_gfx_mqd_reset_restore(ring);
|
||||
|
||||
r = amdgpu_mes_map_legacy_queue(adev, ring, 0);
|
||||
if (r) {
|
||||
dev_err(adev->dev, "failed to remap kgq\n");
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
return amdgpu_ring_reset_helper_end(ring, timedout_fence);
|
||||
return amdgpu_gfx_mes_reset_queue(ring, vmid, timedout_fence, use_mmio);
|
||||
}
|
||||
|
||||
static int gfx_v11_0_reset_kcq(struct amdgpu_ring *ring,
|
||||
|
|
@ -6854,29 +6833,8 @@ static int gfx_v11_0_reset_kcq(struct amdgpu_ring *ring,
|
|||
{
|
||||
struct amdgpu_device *adev = ring->adev;
|
||||
bool use_mmio = adev->gfx.mec.use_mmio_for_reset;
|
||||
int r = 0;
|
||||
|
||||
amdgpu_ring_reset_helper_begin(ring, timedout_fence);
|
||||
|
||||
r = amdgpu_mes_reset_legacy_queue(ring->adev, ring, vmid, use_mmio, 0);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
if (use_mmio) {
|
||||
r = amdgpu_mes_unmap_legacy_queue(adev, ring,
|
||||
RESET_QUEUES, 0, 0, 0);
|
||||
if (r)
|
||||
return r;
|
||||
amdgpu_gfx_mqd_reset_restore(ring);
|
||||
|
||||
r = amdgpu_mes_map_legacy_queue(adev, ring, 0);
|
||||
if (r) {
|
||||
dev_err(adev->dev, "failed to remap kcq\n");
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
return amdgpu_ring_reset_helper_end(ring, timedout_fence);
|
||||
return amdgpu_gfx_mes_reset_queue(ring, vmid, timedout_fence, use_mmio);
|
||||
}
|
||||
|
||||
static void gfx_v11_ip_print(struct amdgpu_ip_block *ip_block, struct drm_printer *p)
|
||||
|
|
|
|||
|
|
@ -5249,29 +5249,8 @@ static int gfx_v12_0_reset_kgq(struct amdgpu_ring *ring,
|
|||
{
|
||||
struct amdgpu_device *adev = ring->adev;
|
||||
bool use_mmio = adev->gfx.me.use_mmio_for_reset;
|
||||
int r;
|
||||
|
||||
amdgpu_ring_reset_helper_begin(ring, timedout_fence);
|
||||
|
||||
r = amdgpu_mes_reset_legacy_queue(ring->adev, ring, vmid, use_mmio, 0);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
if (use_mmio) {
|
||||
r = amdgpu_mes_unmap_legacy_queue(adev, ring,
|
||||
RESET_QUEUES, 0, 0, 0);
|
||||
if (r)
|
||||
return r;
|
||||
amdgpu_gfx_mqd_reset_restore(ring);
|
||||
|
||||
r = amdgpu_mes_map_legacy_queue(adev, ring, 0);
|
||||
if (r) {
|
||||
dev_err(adev->dev, "failed to remap kgq\n");
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
return amdgpu_ring_reset_helper_end(ring, timedout_fence);
|
||||
return amdgpu_gfx_mes_reset_queue(ring, vmid, timedout_fence, use_mmio);
|
||||
}
|
||||
|
||||
static int gfx_v12_0_reset_kcq(struct amdgpu_ring *ring,
|
||||
|
|
@ -5280,29 +5259,8 @@ static int gfx_v12_0_reset_kcq(struct amdgpu_ring *ring,
|
|||
{
|
||||
struct amdgpu_device *adev = ring->adev;
|
||||
bool use_mmio = adev->gfx.mec.use_mmio_for_reset;
|
||||
int r;
|
||||
|
||||
amdgpu_ring_reset_helper_begin(ring, timedout_fence);
|
||||
|
||||
r = amdgpu_mes_reset_legacy_queue(ring->adev, ring, vmid, use_mmio, 0);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
if (use_mmio) {
|
||||
r = amdgpu_mes_unmap_legacy_queue(adev, ring,
|
||||
RESET_QUEUES, 0, 0, 0);
|
||||
if (r)
|
||||
return r;
|
||||
amdgpu_gfx_mqd_reset_restore(ring);
|
||||
|
||||
r = amdgpu_mes_map_legacy_queue(adev, ring, 0);
|
||||
if (r) {
|
||||
dev_err(adev->dev, "failed to remap kcq\n");
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
return amdgpu_ring_reset_helper_end(ring, timedout_fence);
|
||||
return amdgpu_gfx_mes_reset_queue(ring, vmid, timedout_fence, use_mmio);
|
||||
}
|
||||
|
||||
static void gfx_v12_0_ring_begin_use(struct amdgpu_ring *ring)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user