aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
diff options
context:
space:
mode:
authorYong Zhao <Yong.Zhao@amd.com>2019-02-05 15:17:40 -0500
committerAlex Deucher <alexander.deucher@amd.com>2019-02-13 17:51:02 -0500
commit74b9b3ea0cb355d668eb0309d1ab57f403d52c69 (patch)
treecea92b3a1675e39cea67e41d9e8460af190c76f6 /drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
parent2d086fded1021d6b482dfc705bab8f085d10a496 (diff)
drm/amdgpu: Fix bugs in setting CP RB/MEC DOORBELL_RANGE registers
CP_RB_DOORBELL_RANGE_LOWER/UPPER and CP_MEC_DOORBELL_RANGE_LOWER/UPPER are used for waking up an idle scheduler and for power gating support. Usually the first few doorbells in pci doorbell bar are used for RB and all leftover for MEC. This patch fixes the incorrect settings. Theoretically, gfx ring doorbells should come before all MEC doorbells to be consistent with the design. However, since the doorbell allocations are agreed by all and we are not free to change them, also considering the kernel MEC ring doorbells which are before gfx ring doorbells are not used often, we compromise by leaving the doorbell allocations unchanged. Signed-off-by: Yong Zhao <Yong.Zhao@amd.com> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index b8e50a34bdb3..41cf9d0224d9 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -4223,8 +4223,8 @@ static void gfx_v8_0_set_cpg_door_bell(struct amdgpu_device *adev, struct amdgpu
4223 adev->doorbell_index.gfx_ring0); 4223 adev->doorbell_index.gfx_ring0);
4224 WREG32(mmCP_RB_DOORBELL_RANGE_LOWER, tmp); 4224 WREG32(mmCP_RB_DOORBELL_RANGE_LOWER, tmp);
4225 4225
4226 WREG32(mmCP_RB_DOORBELL_RANGE_UPPER, 4226 /* There is only one GFX queue */
4227 CP_RB_DOORBELL_RANGE_UPPER__DOORBELL_RANGE_UPPER_MASK); 4227 WREG32(mmCP_RB_DOORBELL_RANGE_UPPER, tmp);
4228} 4228}
4229 4229
4230static int gfx_v8_0_cp_gfx_resume(struct amdgpu_device *adev) 4230static int gfx_v8_0_cp_gfx_resume(struct amdgpu_device *adev)
@@ -4646,8 +4646,19 @@ static int gfx_v8_0_kcq_init_queue(struct amdgpu_ring *ring)
4646static void gfx_v8_0_set_mec_doorbell_range(struct amdgpu_device *adev) 4646static void gfx_v8_0_set_mec_doorbell_range(struct amdgpu_device *adev)
4647{ 4647{
4648 if (adev->asic_type > CHIP_TONGA) { 4648 if (adev->asic_type > CHIP_TONGA) {
4649 WREG32(mmCP_MEC_DOORBELL_RANGE_LOWER, adev->doorbell_index.kiq << 2); 4649 /* The first few doorbells in pci doorbell bar are for GFX RB
4650 WREG32(mmCP_MEC_DOORBELL_RANGE_UPPER, adev->doorbell_index.mec_ring7 << 2); 4650 * rings and all the leftover for MEC.
4651 * So CP_MEC_DOORBELL_RANGE_LOWER should be set one index after
4652 * CP_RB_DOORBELL_RANGE_UPPER, as we assume there is only one
4653 * GFX RB rings.
4654 */
4655 u32 tmp = REG_SET_FIELD(0, CP_MEC_DOORBELL_RANGE_LOWER,
4656 DOORBELL_RANGE_LOWER,
4657 adev->gfx.gfx_ring[0].doorbell_index + 1);
4658
4659 WREG32(mmCP_MEC_DOORBELL_RANGE_LOWER, tmp);
4660 WREG32(mmCP_MEC_DOORBELL_RANGE_UPPER,
4661 CP_MEC_DOORBELL_RANGE_UPPER__DOORBELL_RANGE_UPPER_MASK);
4651 } 4662 }
4652 /* enable doorbells */ 4663 /* enable doorbells */
4653 WREG32_FIELD(CP_PQ_STATUS, DOORBELL_ENABLE, 1); 4664 WREG32_FIELD(CP_PQ_STATUS, DOORBELL_ENABLE, 1);