summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2016-06-24 22:11:51 +0300
committerAlex Deucher <alexander.deucher@amd.com>2016-07-14 23:46:03 +0300
commit4f399a082866e137cd3c3bdf329f5c7ce1dca5d7 (patch)
tree86bbb14bdab95da34646cdca911926e95445b71f /drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
parent737a44b106b9aafa8f0ca16ecd15eea2d4c5283e (diff)
downloadlinux-4f399a082866e137cd3c3bdf329f5c7ce1dca5d7.tar.xz
drm/amdgpu: sanitize fence numbers
Looks like the VCE block sometimes still sends nonsense fence numbers on startup. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
index d1558768cfb7..e320b5b73ac6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
@@ -204,16 +204,22 @@ void amdgpu_fence_process(struct amdgpu_ring *ring)
if (seq != ring->fence_drv.sync_seq)
amdgpu_fence_schedule_fallback(ring);
+ last_seq &= drv->num_fences_mask;
+ seq &= drv->num_fences_mask;
+
while (last_seq != seq) {
struct fence *fence, **ptr;
- ptr = &drv->fences[++last_seq & drv->num_fences_mask];
+ ++last_seq;
+ last_seq &= drv->num_fences_mask;
+ ptr = &drv->fences[last_seq];
/* There is always exactly one thread signaling this fence slot */
fence = rcu_dereference_protected(*ptr, 1);
RCU_INIT_POINTER(*ptr, NULL);
- BUG_ON(!fence);
+ if (!fence)
+ continue;
r = fence_signal(fence);
if (!r)