aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/4265-drm-amdfd-Don-t-hard-code-wait-time.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.14.71/4265-drm-amdfd-Don-t-hard-code-wait-time.patch')
-rw-r--r--common/recipes-kernel/linux/linux-yocto-4.14.71/4265-drm-amdfd-Don-t-hard-code-wait-time.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.14.71/4265-drm-amdfd-Don-t-hard-code-wait-time.patch b/common/recipes-kernel/linux/linux-yocto-4.14.71/4265-drm-amdfd-Don-t-hard-code-wait-time.patch
new file mode 100644
index 00000000..89988dd2
--- /dev/null
+++ b/common/recipes-kernel/linux/linux-yocto-4.14.71/4265-drm-amdfd-Don-t-hard-code-wait-time.patch
@@ -0,0 +1,56 @@
+From 807d1e07d5c965134b482c04314141d444dd75a7 Mon Sep 17 00:00:00 2001
+From: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
+Date: Fri, 13 Apr 2018 14:48:10 -0400
+Subject: [PATCH 4265/5725] drm/amdfd: Don't hard code wait time
+
+Also dma_fence_wait_timeout() returns 0 if fence timed out. Handle that.
+
+Change-Id: Ia5f4f97f35d3dac0b5263449a366d9a051664598
+Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
+---
+ drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 21 ++++++++++++++++++---
+ 1 file changed, 18 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+index 98d9b1b..9426a66 100644
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+@@ -1838,6 +1838,21 @@ static void kfd_free_cma_bos(struct cma_iter *ci)
+ }
+ }
+
++/* 1 second timeout */
++#define CMA_WAIT_TIMEOUT msecs_to_jiffies(1000)
++
++static int kfd_cma_fence_wait(struct dma_fence *f)
++{
++ int ret;
++
++ ret = dma_fence_wait_timeout(f, false, CMA_WAIT_TIMEOUT);
++ if (likely(ret > 0))
++ return 0;
++ if (!ret)
++ ret = -ETIME;
++ return ret;
++}
++
+ /* Create a system BO by pinning underlying system pages of the given userptr
+ * BO @ubo
+ * @ubo: Userptr BO
+@@ -2366,10 +2381,10 @@ static int kfd_ioctl_cross_memory_copy(struct file *filep,
+
+ /* Wait for the last fence irrespective of error condition */
+ if (lfence) {
+- if (dma_fence_wait_timeout(lfence, false,
+- msecs_to_jiffies(1000)) < 0)
+- pr_err("CMA %s failed. BO timed out\n", cma_op);
++ err = kfd_cma_fence_wait(lfence);
+ dma_fence_put(lfence);
++ if (err)
++ pr_err("CMA %s failed. BO timed out\n", cma_op);
+ }
+
+ kfd_free_cma_bos(&si);
+--
+2.7.4
+