aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/4256-drm-amdkfd-CMA-Support-for-diff.-devices.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.14.71/4256-drm-amdkfd-CMA-Support-for-diff.-devices.patch')
-rw-r--r--common/recipes-kernel/linux/linux-yocto-4.14.71/4256-drm-amdkfd-CMA-Support-for-diff.-devices.patch40
1 files changed, 40 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.14.71/4256-drm-amdkfd-CMA-Support-for-diff.-devices.patch b/common/recipes-kernel/linux/linux-yocto-4.14.71/4256-drm-amdkfd-CMA-Support-for-diff.-devices.patch
new file mode 100644
index 00000000..147d7aba
--- /dev/null
+++ b/common/recipes-kernel/linux/linux-yocto-4.14.71/4256-drm-amdkfd-CMA-Support-for-diff.-devices.patch
@@ -0,0 +1,40 @@
+From 6c5d72666e8df579b1d136158e44bf219d3f0e97 Mon Sep 17 00:00:00 2001
+From: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
+Date: Mon, 9 Apr 2018 16:27:07 -0400
+Subject: [PATCH 4256/5725] drm/amdkfd: CMA: Support for diff. devices
+
+Support CMA between System Memory BO and Local Memory BO even if they
+are registered to separate devices. The copy will be done by the device
+to which Local Memory BO belongs to. The system memory BO will be
+temporarily mapped into this device's gart.
+
+Change-Id: Ief4af0db8b5f6af1a2fa1ed0596cf9e2fd953841
+Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
+---
+ drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+index 0972243..9be0ac1 100644
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+@@ -2159,8 +2159,14 @@ static int kfd_copy_bos(struct cma_iter *si, struct cma_iter *di,
+ dst_offset = di->bo_offset & (PAGE_SIZE - 1);
+ list_add_tail(&di->cma_bo->list, &di->cma_list);
+ } else if (src_bo->dev->kgd != dst_bo->dev->kgd) {
+- pr_err("CMA %d fail. Not same dev\n", cma_write);
+- return -EINVAL;
++ /* This indicates that either or/both BOs are in local mem. */
++ if (src_bo->mem_type == KFD_IOC_ALLOC_MEM_FLAGS_VRAM &&
++ dst_bo->mem_type == KFD_IOC_ALLOC_MEM_FLAGS_VRAM) {
++ pr_err("CMA fail. Local mem & not in same dev\n");
++ return -EINVAL;
++ } else if (src_bo->mem_type == KFD_IOC_ALLOC_MEM_FLAGS_VRAM)
++ dev = src_bo->dev;
++ /* else already set to dst_bo->dev */
+ }
+
+ if (err) {
+--
+2.7.4
+