Rather than setting a higher queue priority which could starve a lower priority queue, enable longer quantums for high priority kernel queues. This will avoid starvation, but provide longer runtime for high priority queues.
Signed-off-by: Alex Deucher <[email protected]> --- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c index 58c69dcb527f7..3618e68222458 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c @@ -6794,6 +6794,12 @@ static int gfx_v10_0_gfx_mqd_init(struct amdgpu_device *adev, void *m, /* set up time quantum */ tmp = RREG32_SOC15(GC, 0, mmCP_GFX_HQD_QUANTUM); tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_QUANTUM, QUANTUM_EN, 1); + /* increase the duration of a high priority kernel queue */ + if (prop->kernel_queue && + (prop->hqd_pipe_priority == AMDGPU_GFX_PIPE_PRIO_HIGH)) + tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_QUANTUM, QUANTUM_DURATION, 20); + else + tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_QUANTUM, QUANTUM_DURATION, 10); mqd->cp_gfx_hqd_quantum = tmp; /* set up gfx hqd base. this is similar as CP_RB_BASE */ @@ -7013,7 +7019,12 @@ static int gfx_v10_0_compute_mqd_init(struct amdgpu_device *adev, void *m, tmp = REG_SET_FIELD(0, CP_HQD_QUANTUM, QUANTUM_EN, 1); tmp = REG_SET_FIELD(tmp, CP_HQD_QUANTUM, QUANTUM_SCALE, 1); - tmp = REG_SET_FIELD(tmp, CP_HQD_QUANTUM, QUANTUM_DURATION, 1); + /* increase the duration of a high priority kernel queue */ + if (prop->kernel_queue && + (prop->hqd_pipe_priority == AMDGPU_GFX_PIPE_PRIO_HIGH)) + tmp = REG_SET_FIELD(tmp, CP_HQD_QUANTUM, QUANTUM_DURATION, 2); + else + tmp = REG_SET_FIELD(tmp, CP_HQD_QUANTUM, QUANTUM_DURATION, 1); mqd->cp_hqd_quantum = tmp; /* set static priority for a compute queue/ring */ -- 2.53.0
