aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0836-Hybrid-kfd-adaption-Adapt-to-new-amdgpu_bo-structure.patch
blob: f2cda6a57c5df9a7cb15705094f989d17067cbab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
From 36f4c60f10bc1cebede6176736aee7a66776f441 Mon Sep 17 00:00:00 2001
From: Yong Zhao <Yong.Zhao@amd.com>
Date: Wed, 22 Feb 2017 23:17:32 -0500
Subject: [PATCH 0836/4131] Hybrid-kfd-adaption: Adapt to new amdgpu_bo
 structure introduced for KFD

Change-Id: I6f7b6b63972f5a8aa1b88d9aa78f26c5a34c1e08
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index 93075bf..8f72e6b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -308,6 +308,7 @@ int amdgpu_gem_find_bo_by_cpu_mapping_ioctl(struct drm_device *dev, void *data,
 {
 	struct drm_amdgpu_gem_find_bo *args = data;
 	struct drm_gem_object *gobj;
+	struct amdgpu_gem_object *amdgpu_gobj;
 	struct amdgpu_bo *bo;
 	struct ttm_buffer_object *tbo;
 	struct vm_area_struct *vma;
@@ -328,7 +329,17 @@ int amdgpu_gem_find_bo_by_cpu_mapping_ioctl(struct drm_device *dev, void *data,
 	tbo = vma->vm_private_data;
 	bo = container_of(tbo, struct amdgpu_bo, tbo);
 	amdgpu_bo_ref(bo);
-	gobj = &bo->gem_base;
+
+	ww_mutex_lock(&bo->tbo.resv->lock, NULL);
+	list_for_each_entry(amdgpu_gobj, &bo->gem_objects, list) {
+		if (amdgpu_gobj->base.dev != filp->minor->dev)
+			continue;
+
+		ww_mutex_unlock(&bo->tbo.resv->lock);
+		break;
+	}
+	gobj = &amdgpu_gobj->base;
+	
 	handle = amdgpu_gem_get_handle_from_object(filp, gobj);
 	if (handle == 0) {
 		r = drm_gem_handle_create(filp, gobj, &handle);
-- 
2.7.4