diff options
author | Felix Kuehling <Felix.Kuehling@amd.com> | 2016-07-15 18:37:05 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-07-14 11:06:36 -0400 |
commit | a667386cb997a136e169de3cf70f007223bb74ee (patch) | |
tree | 54dc2a27b23cf5889ea7e47e521430f0a3dc5251 /drivers/gpu/drm/amd/amdgpu/cik_sdma.c | |
parent | 763dbbfa5f678ceec59b81bc13bc9dc445920e9b (diff) |
drm/amdgpu: Make SDMA phase quantum configurable
Set a configurable SDMA phase quantum when enabling SDMA context
switching. The default value significantly reduces SDMA latency
in page table updates when user-mode SDMA queues have concurrent
activity, compared to the initial HW setting.
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Andres Rodriguez <andres.rodriguez@amd.com>
Reviewed-by: Shaoyun Liu <shaoyun.liu@amd.com>
Acked-by: Chunming Zhou <david1.zhou@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/cik_sdma.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/cik_sdma.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c index 4a9cea03f54f..f508f4d01e4a 100644 --- a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c +++ b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c | |||
@@ -351,14 +351,44 @@ static void cik_sdma_rlc_stop(struct amdgpu_device *adev) | |||
351 | */ | 351 | */ |
352 | static void cik_ctx_switch_enable(struct amdgpu_device *adev, bool enable) | 352 | static void cik_ctx_switch_enable(struct amdgpu_device *adev, bool enable) |
353 | { | 353 | { |
354 | u32 f32_cntl; | 354 | u32 f32_cntl, phase_quantum = 0; |
355 | int i; | 355 | int i; |
356 | 356 | ||
357 | if (amdgpu_sdma_phase_quantum) { | ||
358 | unsigned value = amdgpu_sdma_phase_quantum; | ||
359 | unsigned unit = 0; | ||
360 | |||
361 | while (value > (SDMA0_PHASE0_QUANTUM__VALUE_MASK >> | ||
362 | SDMA0_PHASE0_QUANTUM__VALUE__SHIFT)) { | ||
363 | value = (value + 1) >> 1; | ||
364 | unit++; | ||
365 | } | ||
366 | if (unit > (SDMA0_PHASE0_QUANTUM__UNIT_MASK >> | ||
367 | SDMA0_PHASE0_QUANTUM__UNIT__SHIFT)) { | ||
368 | value = (SDMA0_PHASE0_QUANTUM__VALUE_MASK >> | ||
369 | SDMA0_PHASE0_QUANTUM__VALUE__SHIFT); | ||
370 | unit = (SDMA0_PHASE0_QUANTUM__UNIT_MASK >> | ||
371 | SDMA0_PHASE0_QUANTUM__UNIT__SHIFT); | ||
372 | WARN_ONCE(1, | ||
373 | "clamping sdma_phase_quantum to %uK clock cycles\n", | ||
374 | value << unit); | ||
375 | } | ||
376 | phase_quantum = | ||
377 | value << SDMA0_PHASE0_QUANTUM__VALUE__SHIFT | | ||
378 | unit << SDMA0_PHASE0_QUANTUM__UNIT__SHIFT; | ||
379 | } | ||
380 | |||
357 | for (i = 0; i < adev->sdma.num_instances; i++) { | 381 | for (i = 0; i < adev->sdma.num_instances; i++) { |
358 | f32_cntl = RREG32(mmSDMA0_CNTL + sdma_offsets[i]); | 382 | f32_cntl = RREG32(mmSDMA0_CNTL + sdma_offsets[i]); |
359 | if (enable) { | 383 | if (enable) { |
360 | f32_cntl = REG_SET_FIELD(f32_cntl, SDMA0_CNTL, | 384 | f32_cntl = REG_SET_FIELD(f32_cntl, SDMA0_CNTL, |
361 | AUTO_CTXSW_ENABLE, 1); | 385 | AUTO_CTXSW_ENABLE, 1); |
386 | if (amdgpu_sdma_phase_quantum) { | ||
387 | WREG32(mmSDMA0_PHASE0_QUANTUM + sdma_offsets[i], | ||
388 | phase_quantum); | ||
389 | WREG32(mmSDMA0_PHASE1_QUANTUM + sdma_offsets[i], | ||
390 | phase_quantum); | ||
391 | } | ||
362 | } else { | 392 | } else { |
363 | f32_cntl = REG_SET_FIELD(f32_cntl, SDMA0_CNTL, | 393 | f32_cntl = REG_SET_FIELD(f32_cntl, SDMA0_CNTL, |
364 | AUTO_CTXSW_ENABLE, 0); | 394 | AUTO_CTXSW_ENABLE, 0); |