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
83
84
|
From 4f8e156b719b25df3af1caf02ecdd4e50a6b5f46 Mon Sep 17 00:00:00 2001
From: Yong Zhao <yong.zhao@amd.com>
Date: Fri, 15 Jul 2016 18:05:59 -0400
Subject: [PATCH 1166/4131] drm/amdkfd: Simplify kfd_map_memory_to_gpu function
Change-Id: I3b64feb67c30f4e58bce3ced782c5838128088f4
Signed-off-by: Yong Zhao <yong.zhao@amd.com>
---
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 10 +++++-----
drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 3 +--
drivers/gpu/drm/amd/amdkfd/kfd_process.c | 2 +-
3 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index 314c178..50e32bd 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -1344,10 +1344,10 @@ static int kfd_ioctl_free_memory_of_gpu(struct file *filep,
return ret;
}
-int kfd_map_memory_to_gpu(struct kfd_dev *dev, void *mem,
- struct kfd_process *p, struct kfd_process_device *pdd)
+int kfd_map_memory_to_gpu(void *mem, struct kfd_process_device *pdd)
{
int err;
+ struct kfd_dev *dev = pdd->dev;
BUG_ON(!dev);
BUG_ON(!pdd);
@@ -1358,7 +1358,7 @@ int kfd_map_memory_to_gpu(struct kfd_dev *dev, void *mem,
if (err != 0)
return err;
- radeon_flush_tlb(dev, p->pasid);
+ radeon_flush_tlb(dev, pdd->process->pasid);
err = dev->dqm->ops.set_page_directory_base(dev->dqm, &pdd->qpd);
if (err != 0) {
@@ -1441,12 +1441,12 @@ static int kfd_ioctl_map_memory_to_gpu(struct file *filep,
err = -EFAULT;
goto get_mem_obj_from_handle_failed;
}
- err = kfd_map_memory_to_gpu(peer, mem, p, peer_pdd);
+ err = kfd_map_memory_to_gpu(mem, peer_pdd);
if (err != 0)
pr_err("amdkfd: failed to map\n");
}
} else {
- err = kfd_map_memory_to_gpu(dev, mem, p, pdd);
+ err = kfd_map_memory_to_gpu(mem, pdd);
if (err != 0)
pr_err("amdkfd: failed to map\n");
}
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
index 420aa64..56840ea 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
@@ -717,8 +717,7 @@ void run_rdma_free_callback(struct kfd_bo *buf_obj);
struct kfd_process *kfd_lookup_process_by_pid(struct pid *pid);
/* kfd dgpu memory */
-int kfd_map_memory_to_gpu(struct kfd_dev *dev, void *mem,
- struct kfd_process *p, struct kfd_process_device *pdd);
+int kfd_map_memory_to_gpu(void *mem, struct kfd_process_device *pdd);
/* Process device data iterator */
struct kfd_process_device *kfd_get_first_process_device_data(struct kfd_process *p);
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
index 03b701a..d87ff6a 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
@@ -109,7 +109,7 @@ static int kfd_process_alloc_gpuvm(struct kfd_process *p,
if (err)
goto err_alloc_mem;
- err = kfd_map_memory_to_gpu(kdev, mem, p, pdd);
+ err = kfd_map_memory_to_gpu(mem, pdd);
if (err)
goto err_map_mem;
--
2.7.4
|