diff options
author | Monk Liu <Monk.Liu@amd.com> | 2017-03-24 00:07:52 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-03-29 23:55:34 -0400 |
commit | 806ba2d4f523f7414103fa0bdd2e3b17a340ac41 (patch) | |
tree | 709309e0dcaf593272f61bd3916cd546c4fa98ba | |
parent | 65333e4429c60b8bbbb7a9213cb5612761499acd (diff) |
drm/amdgpu:implement cond_exec for gfx8
when MCBP enabled for gfx8, the cond_exec must also
be implemented, otherwise there will be odds to meet
cross engine (ce and me) deadlock when world switch
happens.
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 30 |
1 files changed, 30 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 423ed68c2e52..0050b09d5883 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | |||
@@ -6781,6 +6781,34 @@ static void gfx_v8_ring_emit_cntxcntl(struct amdgpu_ring *ring, uint32_t flags) | |||
6781 | (flags & AMDGPU_VM_DOMAIN) ? AMDGPU_CSA_VADDR : ring->adev->virt.csa_vmid0_addr); | 6781 | (flags & AMDGPU_VM_DOMAIN) ? AMDGPU_CSA_VADDR : ring->adev->virt.csa_vmid0_addr); |
6782 | } | 6782 | } |
6783 | 6783 | ||
6784 | static unsigned gfx_v8_0_ring_emit_init_cond_exec(struct amdgpu_ring *ring) | ||
6785 | { | ||
6786 | unsigned ret; | ||
6787 | |||
6788 | amdgpu_ring_write(ring, PACKET3(PACKET3_COND_EXEC, 3)); | ||
6789 | amdgpu_ring_write(ring, lower_32_bits(ring->cond_exe_gpu_addr)); | ||
6790 | amdgpu_ring_write(ring, upper_32_bits(ring->cond_exe_gpu_addr)); | ||
6791 | amdgpu_ring_write(ring, 0); /* discard following DWs if *cond_exec_gpu_addr==0 */ | ||
6792 | ret = ring->wptr & ring->buf_mask; | ||
6793 | amdgpu_ring_write(ring, 0x55aa55aa); /* patch dummy value later */ | ||
6794 | return ret; | ||
6795 | } | ||
6796 | |||
6797 | static void gfx_v8_0_ring_emit_patch_cond_exec(struct amdgpu_ring *ring, unsigned offset) | ||
6798 | { | ||
6799 | unsigned cur; | ||
6800 | |||
6801 | BUG_ON(offset > ring->buf_mask); | ||
6802 | BUG_ON(ring->ring[offset] != 0x55aa55aa); | ||
6803 | |||
6804 | cur = (ring->wptr & ring->buf_mask) - 1; | ||
6805 | if (likely(cur > offset)) | ||
6806 | ring->ring[offset] = cur - offset; | ||
6807 | else | ||
6808 | ring->ring[offset] = (ring->ring_size >> 2) - offset + cur; | ||
6809 | } | ||
6810 | |||
6811 | |||
6784 | static void gfx_v8_0_ring_emit_rreg(struct amdgpu_ring *ring, uint32_t reg) | 6812 | static void gfx_v8_0_ring_emit_rreg(struct amdgpu_ring *ring, uint32_t reg) |
6785 | { | 6813 | { |
6786 | struct amdgpu_device *adev = ring->adev; | 6814 | struct amdgpu_device *adev = ring->adev; |
@@ -7070,6 +7098,8 @@ static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = { | |||
7070 | .pad_ib = amdgpu_ring_generic_pad_ib, | 7098 | .pad_ib = amdgpu_ring_generic_pad_ib, |
7071 | .emit_switch_buffer = gfx_v8_ring_emit_sb, | 7099 | .emit_switch_buffer = gfx_v8_ring_emit_sb, |
7072 | .emit_cntxcntl = gfx_v8_ring_emit_cntxcntl, | 7100 | .emit_cntxcntl = gfx_v8_ring_emit_cntxcntl, |
7101 | .init_cond_exec = gfx_v8_0_ring_emit_init_cond_exec, | ||
7102 | .patch_cond_exec = gfx_v8_0_ring_emit_patch_cond_exec, | ||
7073 | }; | 7103 | }; |
7074 | 7104 | ||
7075 | static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_compute = { | 7105 | static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_compute = { |