aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3498-drm-amdgpu-fix-dma_fence_wait-without-reference.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3498-drm-amdgpu-fix-dma_fence_wait-without-reference.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3498-drm-amdgpu-fix-dma_fence_wait-without-reference.patch60
1 files changed, 60 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3498-drm-amdgpu-fix-dma_fence_wait-without-reference.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3498-drm-amdgpu-fix-dma_fence_wait-without-reference.patch
new file mode 100644
index 00000000..8813b00a
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3498-drm-amdgpu-fix-dma_fence_wait-without-reference.patch
@@ -0,0 +1,60 @@
+From 00542cdf235ad60a9e54fc953814e137b95af2c4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com>
+Date: Fri, 16 Aug 2019 14:56:35 +0200
+Subject: [PATCH 3498/4256] drm/amdgpu: fix dma_fence_wait without reference
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+We need to grab a reference to the fence we wait for.
+
+Signed-off-by: Christian König <christian.koenig@amd.com>
+Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 27 ++++++++++++++-----------
+ 1 file changed, 15 insertions(+), 12 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+index 54b9b955f12f..acd44860c7d5 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+@@ -547,21 +547,24 @@ int amdgpu_ctx_wait_prev_fence(struct amdgpu_ctx *ctx,
+ struct drm_sched_entity *entity)
+ {
+ struct amdgpu_ctx_entity *centity = to_amdgpu_ctx_entity(entity);
+- unsigned idx = centity->sequence & (amdgpu_sched_jobs - 1);
+- struct dma_fence *other = centity->fences[idx];
++ struct dma_fence *other;
++ unsigned idx;
++ long r;
+
+- if (other) {
+- signed long r;
+- r = dma_fence_wait(other, true);
+- if (r < 0) {
+- if (r != -ERESTARTSYS)
+- DRM_ERROR("Error (%ld) waiting for fence!\n", r);
++ spin_lock(&ctx->ring_lock);
++ idx = centity->sequence & (amdgpu_sched_jobs - 1);
++ other = dma_fence_get(centity->fences[idx]);
++ spin_unlock(&ctx->ring_lock);
+
+- return r;
+- }
+- }
++ if (!other)
++ return 0;
+
+- return 0;
++ r = dma_fence_wait(other, true);
++ if (r < 0 && r != -ERESTARTSYS)
++ DRM_ERROR("Error (%ld) waiting for fence!\n", r);
++
++ dma_fence_put(other);
++ return r;
+ }
+
+ void amdgpu_ctx_mgr_init(struct amdgpu_ctx_mgr *mgr)
+--
+2.17.1
+