aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/3044-drm-amdgpu-Return-mmap-offset-for-private-vram.patch
blob: 2fa0d5d82c4117e0c6ed26ffc681299ca5d8ab28 (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
From a559cdf328e9c5e90e50fd0ad1dc8de7d63bfaba Mon Sep 17 00:00:00 2001
From: Oak Zeng <Oak.Zeng@amd.com>
Date: Mon, 11 Dec 2017 15:42:52 -0500
Subject: [PATCH 3044/4131] drm/amdgpu: Return mmap offset for private vram

Previously mmap offset is not returned for private
vram allocation, because there is no need for user
space to mmap for this type of buffer. This change
returns mmap offset even for private vram allocation,
so user space can essentially mmap the buffer(with
PROT_NONE flag) for ptrace access

Change-Id: I458059ce7dd19f17830ac50d2297eaf504526293
Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index 3648269..606677a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -1065,7 +1065,6 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
 	bool aql_queue, public, readonly, execute, coherent, no_sub, userptr;
 	u64 alloc_flag;
 	uint32_t domain;
-	uint64_t *temp_offset;
 	struct sg_table *sg = NULL;
 
 	if (!(flags & ALLOC_MEM_FLAGS_NONPAGED)) {
@@ -1075,7 +1074,6 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
 
 	domain = 0;
 	alloc_flag = 0;
-	temp_offset = NULL;
 
 	aql_queue = (flags & ALLOC_MEM_FLAGS_AQL_QUEUE_MEM) ? true : false;
 	public    = (flags & ALLOC_MEM_FLAGS_PUBLIC) ? true : false;
@@ -1093,17 +1091,14 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
 		alloc_flag = AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
 		if (public) {
 			alloc_flag = AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
-			temp_offset = offset;
 		}
 		alloc_flag |= AMDGPU_GEM_CREATE_VRAM_CLEARED;
 	} else if (flags & (ALLOC_MEM_FLAGS_GTT | ALLOC_MEM_FLAGS_USERPTR)) {
 		domain = AMDGPU_GEM_DOMAIN_GTT;
 		alloc_flag = 0;
-		temp_offset = offset;
 	} else if (flags & ALLOC_MEM_FLAGS_DOORBELL) {
 		domain = AMDGPU_GEM_DOMAIN_GTT;
 		alloc_flag = 0;
-		temp_offset = offset;
 		if (size > UINT_MAX)
 			return -EINVAL;
 		sg = create_doorbell_sg(*offset, size);
@@ -1124,7 +1119,7 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
 			BOOL_TO_STR(coherent), BOOL_TO_STR(no_sub));
 
 	return __alloc_memory_of_gpu(kgd, va, size, vm, mem,
-			temp_offset, domain,
+			offset, domain,
 			alloc_flag, sg,
 			aql_queue, readonly, execute,
 			coherent, no_sub, userptr);
-- 
2.7.4