aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0189-drm-amdgpu-fix-userptr-BO-unpin-bug-v2.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/files/0189-drm-amdgpu-fix-userptr-BO-unpin-bug-v2.patch')
-rw-r--r--common/recipes-kernel/linux/files/0189-drm-amdgpu-fix-userptr-BO-unpin-bug-v2.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/files/0189-drm-amdgpu-fix-userptr-BO-unpin-bug-v2.patch b/common/recipes-kernel/linux/files/0189-drm-amdgpu-fix-userptr-BO-unpin-bug-v2.patch
new file mode 100644
index 00000000..fa8b0f3c
--- /dev/null
+++ b/common/recipes-kernel/linux/files/0189-drm-amdgpu-fix-userptr-BO-unpin-bug-v2.patch
@@ -0,0 +1,49 @@
+From dd08fae1e9b2466380d9447a0643c182cd142149 Mon Sep 17 00:00:00 2001
+From: "monk.liu" <monk.liu@amd.com>
+Date: Thu, 7 May 2015 14:19:18 -0400
+Subject: [PATCH 0189/1050] drm/amdgpu: fix userptr BO unpin bug (v2)
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+sg could point to array of contigiouse page*, only free page could lead
+to memory leak.
+
+v2: use iterator
+
+Signed-off-by: monk.liu <monk.liu@amd.com>
+Reviewed-by: Christian König <christian.koenig@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 +++-----
+ 1 file changed, 3 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+index 120e6e7..729e0bb 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+@@ -555,8 +555,7 @@ static void amdgpu_ttm_tt_unpin_userptr(struct ttm_tt *ttm)
+ {
+ struct amdgpu_device *adev = amdgpu_get_adev(ttm->bdev);
+ struct amdgpu_ttm_tt *gtt = (void *)ttm;
+- struct scatterlist *sg;
+- int i;
++ struct sg_page_iter sg_iter;
+
+ int write = !(gtt->userflags & AMDGPU_GEM_USERPTR_READONLY);
+ enum dma_data_direction direction = write ?
+@@ -569,9 +568,8 @@ static void amdgpu_ttm_tt_unpin_userptr(struct ttm_tt *ttm)
+ /* free the sg table and pages again */
+ dma_unmap_sg(adev->dev, ttm->sg->sgl, ttm->sg->nents, direction);
+
+- for_each_sg(ttm->sg->sgl, sg, ttm->sg->nents, i) {
+- struct page *page = sg_page(sg);
+-
++ for_each_sg_page(ttm->sg->sgl, &sg_iter, ttm->sg->nents, 0) {
++ struct page *page = sg_page_iter_page(&sg_iter);
+ if (!(gtt->userflags & AMDGPU_GEM_USERPTR_READONLY))
+ set_page_dirty(page);
+
+--
+1.9.1
+