aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0545-drm-amdgpu-validate-duplicates-in-the-CS-as-well.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/files/0545-drm-amdgpu-validate-duplicates-in-the-CS-as-well.patch')
-rw-r--r--common/recipes-kernel/linux/files/0545-drm-amdgpu-validate-duplicates-in-the-CS-as-well.patch94
1 files changed, 94 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/files/0545-drm-amdgpu-validate-duplicates-in-the-CS-as-well.patch b/common/recipes-kernel/linux/files/0545-drm-amdgpu-validate-duplicates-in-the-CS-as-well.patch
new file mode 100644
index 00000000..09682d08
--- /dev/null
+++ b/common/recipes-kernel/linux/files/0545-drm-amdgpu-validate-duplicates-in-the-CS-as-well.patch
@@ -0,0 +1,94 @@
+From a5b750583eb4af69da1e659c7684b6d370b2ae97 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com>
+Date: Thu, 3 Sep 2015 16:40:39 +0200
+Subject: [PATCH 0545/1050] drm/amdgpu: validate duplicates in the CS as well
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This allows for multiple BOs to have the same reservation object.
+
+Signed-off-by: Christian König <christian.koenig@amd.com>
+Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
+Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 34 ++++++++++++++++++++--------------
+ 1 file changed, 20 insertions(+), 14 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+index 3b355ae..4b92e38 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+@@ -321,25 +321,17 @@ static u64 amdgpu_cs_get_threshold_for_moves(struct amdgpu_device *adev)
+ return max(bytes_moved_threshold, 1024*1024ull);
+ }
+
+-int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p)
++int amdgpu_cs_list_validate(struct amdgpu_device *adev,
++ struct amdgpu_vm *vm,
++ struct list_head *validated)
+ {
+- struct amdgpu_fpriv *fpriv = p->filp->driver_priv;
+- struct amdgpu_vm *vm = &fpriv->vm;
+- struct amdgpu_device *adev = p->adev;
+ struct amdgpu_bo_list_entry *lobj;
+- struct list_head duplicates;
+ struct amdgpu_bo *bo;
+ u64 bytes_moved = 0, initial_bytes_moved;
+ u64 bytes_moved_threshold = amdgpu_cs_get_threshold_for_moves(adev);
+ int r;
+
+- INIT_LIST_HEAD(&duplicates);
+- r = ttm_eu_reserve_buffers(&p->ticket, &p->validated, true, &duplicates);
+- if (unlikely(r != 0)) {
+- return r;
+- }
+-
+- list_for_each_entry(lobj, &p->validated, tv.head) {
++ list_for_each_entry(lobj, validated, tv.head) {
+ bo = lobj->robj;
+ if (!bo->pin_count) {
+ u32 domain = lobj->prefered_domains;
+@@ -373,7 +365,6 @@ int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p)
+ domain = lobj->allowed_domains;
+ goto retry;
+ }
+- ttm_eu_backoff_reservation(&p->ticket, &p->validated);
+ return r;
+ }
+ }
+@@ -386,6 +377,7 @@ static int amdgpu_cs_parser_relocs(struct amdgpu_cs_parser *p)
+ {
+ struct amdgpu_fpriv *fpriv = p->filp->driver_priv;
+ struct amdgpu_cs_buckets buckets;
++ struct list_head duplicates;
+ bool need_mmap_lock = false;
+ int i, r;
+
+@@ -405,8 +397,22 @@ static int amdgpu_cs_parser_relocs(struct amdgpu_cs_parser *p)
+ if (need_mmap_lock)
+ down_read(&current->mm->mmap_sem);
+
+- r = amdgpu_cs_list_validate(p);
++ INIT_LIST_HEAD(&duplicates);
++ r = ttm_eu_reserve_buffers(&p->ticket, &p->validated, true, &duplicates);
++ if (unlikely(r != 0))
++ goto error_reserve;
++
++ r = amdgpu_cs_list_validate(p->adev, &fpriv->vm, &p->validated);
++ if (r)
++ goto error_validate;
++
++ r = amdgpu_cs_list_validate(p->adev, &fpriv->vm, &duplicates);
++
++error_validate:
++ if (r)
++ ttm_eu_backoff_reservation(&p->ticket, &p->validated);
+
++error_reserve:
+ if (need_mmap_lock)
+ up_read(&current->mm->mmap_sem);
+
+--
+1.9.1
+