aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1394-Simplify-the-function-prototype-add_bo_to_vm.patch
blob: 0c661fcec750c19e57f827c3f656ddc83869760e (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
From b4298e311709beb5526e8a70cb145f03a0f86256 Mon Sep 17 00:00:00 2001
From: Yong Zhao <yong.zhao@amd.com>
Date: Wed, 20 Apr 2016 16:32:27 -0400
Subject: [PATCH 1394/4131] Simplify the function prototype add_bo_to_vm()

Change-Id: I56e13c265261ade9b78ad9360cc1e0478d00ba91
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 30 ++++++++++++------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index e0164d9..4b94ae3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -67,14 +67,20 @@ static bool check_if_add_bo_to_vm(struct amdgpu_vm *avm,
 	return true;
 }
 
-static int add_bo_to_vm(struct amdgpu_device *adev, uint64_t va,
-		struct amdgpu_vm *avm, struct amdgpu_bo *bo,
-		struct list_head *list_bo_va,
-		bool readonly, bool execute)
+static int add_bo_to_vm(struct amdgpu_device *adev, struct kgd_mem *mem,
+		struct amdgpu_vm *avm, bool is_aql)
 {
 	int ret;
 	struct kfd_bo_va_list *bo_va_entry;
 	uint32_t flags;
+	struct amdgpu_bo *bo = mem->data2.bo;
+	uint64_t va = mem->data2.va;
+	struct list_head *list_bo_va = &mem->data2.bo_va_list;
+	bool readonly = mem->data2.readonly;
+	bool execute = mem->data2.execute;
+
+	if (is_aql)
+		va += bo->tbo.mem.size;
 
 	bo_va_entry = kzalloc(sizeof(*bo_va_entry), GFP_KERNEL);
 	if (!bo_va_entry)
@@ -831,18 +837,12 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
 			&mem->data2.bo_va_list)) {
 		pr_debug("amdkfd: add new BO_VA to list 0x%llx\n",
 				mem->data2.va);
-		ret = add_bo_to_vm(adev, mem->data2.va, (struct amdgpu_vm *)vm,
-				   bo, &mem->data2.bo_va_list,
-				   mem->data2.readonly, mem->data2.execute);
+		ret = add_bo_to_vm(adev, mem, (struct amdgpu_vm *)vm, false);
 		if (ret != 0)
 			goto add_bo_to_vm_failed;
 		if (mem->data2.aql_queue) {
-			ret = add_bo_to_vm(adev,
-					   mem->data2.va + bo->tbo.mem.size,
-					   (struct amdgpu_vm *)vm,
-					   bo, &mem->data2.bo_va_list,
-					   mem->data2.readonly,
-					   mem->data2.execute);
+			ret = add_bo_to_vm(adev, mem, (struct amdgpu_vm *)vm,
+					true);
 			if (ret != 0)
 				goto add_bo_to_vm_failed;
 		}
@@ -1378,6 +1378,7 @@ int amdgpu_amdkfd_gpuvm_import_dmabuf(struct kgd_dev *kgd, int dma_buf_fd,
 
 	INIT_LIST_HEAD(&(*mem)->data2.bo_va_list);
 	mutex_init(&(*mem)->data2.lock);
+	(*mem)->data2.readonly = false;
 	(*mem)->data2.execute = true; /* executable by default */
 
 	(*mem)->data2.bo = amdgpu_bo_ref(bo);
@@ -1386,8 +1387,7 @@ int amdgpu_amdkfd_gpuvm_import_dmabuf(struct kgd_dev *kgd, int dma_buf_fd,
 		AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT;
 	(*mem)->data2.mapped_to_gpu_memory = 0;
 
-	r = add_bo_to_vm(adev, va, vm, bo, &(*mem)->data2.bo_va_list,
-			 false, true);
+	r = add_bo_to_vm(adev, *mem, vm, false);
 
 	if (r) {
 		amdgpu_bo_unref(&bo);
-- 
2.7.4