aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu
diff options
context:
space:
mode:
authorChunming Zhou <David1.Zhou@amd.com>2016-07-15 03:18:25 -0400
committerAlex Deucher <alexander.deucher@amd.com>2016-08-08 11:32:04 -0400
commit1057f20c2252c5eba17e4a9bbf74ea990411f46c (patch)
treeb2b38aa11ffe9bf1fa7b327a42eb3ed74f8f7039 /drivers/gpu/drm/amd/amdgpu
parentd31a501ead7fb21b85c6f34a9dd79b07c6417711 (diff)
drm/amdgpu: add gfx8 pre soft reset
Signed-off-by: Chunming Zhou <David1.Zhou@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 87232397dbd0..62ba7e550aee 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -5111,6 +5111,63 @@ static int gfx_v8_0_check_soft_reset(void *handle)
5111 return 0; 5111 return 0;
5112} 5112}
5113 5113
5114static void gfx_v8_0_inactive_hqd(struct amdgpu_device *adev,
5115 struct amdgpu_ring *ring)
5116{
5117 int i;
5118
5119 vi_srbm_select(adev, ring->me, ring->pipe, ring->queue, 0);
5120 if (RREG32(mmCP_HQD_ACTIVE) & CP_HQD_ACTIVE__ACTIVE_MASK) {
5121 u32 tmp;
5122 tmp = RREG32(mmCP_HQD_DEQUEUE_REQUEST);
5123 tmp = REG_SET_FIELD(tmp, CP_HQD_DEQUEUE_REQUEST,
5124 DEQUEUE_REQ, 2);
5125 WREG32(mmCP_HQD_DEQUEUE_REQUEST, tmp);
5126 for (i = 0; i < adev->usec_timeout; i++) {
5127 if (!(RREG32(mmCP_HQD_ACTIVE) & CP_HQD_ACTIVE__ACTIVE_MASK))
5128 break;
5129 udelay(1);
5130 }
5131 }
5132}
5133
5134static int gfx_v8_0_pre_soft_reset(void *handle)
5135{
5136 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
5137 u32 grbm_soft_reset = 0, srbm_soft_reset = 0;
5138
5139 if (!adev->ip_block_status[AMD_IP_BLOCK_TYPE_GFX].hang)
5140 return 0;
5141
5142 grbm_soft_reset = adev->gfx.grbm_soft_reset;
5143 srbm_soft_reset = adev->gfx.srbm_soft_reset;
5144
5145 /* stop the rlc */
5146 gfx_v8_0_rlc_stop(adev);
5147
5148 if (REG_GET_FIELD(grbm_soft_reset, GRBM_SOFT_RESET, SOFT_RESET_CP) ||
5149 REG_GET_FIELD(grbm_soft_reset, GRBM_SOFT_RESET, SOFT_RESET_GFX))
5150 /* Disable GFX parsing/prefetching */
5151 gfx_v8_0_cp_gfx_enable(adev, false);
5152
5153 if (REG_GET_FIELD(grbm_soft_reset, GRBM_SOFT_RESET, SOFT_RESET_CP) ||
5154 REG_GET_FIELD(grbm_soft_reset, GRBM_SOFT_RESET, SOFT_RESET_CPF) ||
5155 REG_GET_FIELD(grbm_soft_reset, GRBM_SOFT_RESET, SOFT_RESET_CPC) ||
5156 REG_GET_FIELD(grbm_soft_reset, GRBM_SOFT_RESET, SOFT_RESET_CPG)) {
5157 int i;
5158
5159 for (i = 0; i < adev->gfx.num_compute_rings; i++) {
5160 struct amdgpu_ring *ring = &adev->gfx.compute_ring[i];
5161
5162 gfx_v8_0_inactive_hqd(adev, ring);
5163 }
5164 /* Disable MEC parsing/prefetching */
5165 gfx_v8_0_cp_compute_enable(adev, false);
5166 }
5167
5168 return 0;
5169}
5170
5114static int gfx_v8_0_soft_reset(void *handle) 5171static int gfx_v8_0_soft_reset(void *handle)
5115{ 5172{
5116 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 5173 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -6357,6 +6414,7 @@ const struct amd_ip_funcs gfx_v8_0_ip_funcs = {
6357 .is_idle = gfx_v8_0_is_idle, 6414 .is_idle = gfx_v8_0_is_idle,
6358 .wait_for_idle = gfx_v8_0_wait_for_idle, 6415 .wait_for_idle = gfx_v8_0_wait_for_idle,
6359 .check_soft_reset = gfx_v8_0_check_soft_reset, 6416 .check_soft_reset = gfx_v8_0_check_soft_reset,
6417 .pre_soft_reset = gfx_v8_0_pre_soft_reset,
6360 .soft_reset = gfx_v8_0_soft_reset, 6418 .soft_reset = gfx_v8_0_soft_reset,
6361 .set_clockgating_state = gfx_v8_0_set_clockgating_state, 6419 .set_clockgating_state = gfx_v8_0_set_clockgating_state,
6362 .set_powergating_state = gfx_v8_0_set_powergating_state, 6420 .set_powergating_state = gfx_v8_0_set_powergating_state,