summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/vgpu/fecs_trace_vgpu.c
diff options
context:
space:
mode:
authorRichard Zhao <rizhao@nvidia.com>2018-01-26 20:56:34 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2018-02-27 17:29:58 -0500
commit5025350b80f4ded30d6ab2ed3590c6a61937eef7 (patch)
tree22194fe37aa96d9c003a3a5bdc995ab280e2df58 /drivers/gpu/nvgpu/common/linux/vgpu/fecs_trace_vgpu.c
parent649ba2a4b3fcbea2135ce4d0d00feb7563b14270 (diff)
gpu: nvgpu: vgpu: add ivm wrappers
Added vgpu_ivm_*() functions to be used by os agnostic code. Jira EVLR-2364 Change-Id: I4a2baebcff9723950c4fba99d0879a0c61e3e3a2 Signed-off-by: Richard Zhao <rizhao@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1649935 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/vgpu/fecs_trace_vgpu.c')
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/fecs_trace_vgpu.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/fecs_trace_vgpu.c b/drivers/gpu/nvgpu/common/linux/vgpu/fecs_trace_vgpu.c
index bf692c4d..67a00c36 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/fecs_trace_vgpu.c
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/fecs_trace_vgpu.c
@@ -15,7 +15,6 @@
15 */ 15 */
16 16
17#include <linux/string.h> 17#include <linux/string.h>
18#include <linux/tegra-ivc.h>
19#include <linux/tegra_vgpu.h> 18#include <linux/tegra_vgpu.h>
20 19
21#include <uapi/linux/nvgpu.h> 20#include <uapi/linux/nvgpu.h>
@@ -24,6 +23,7 @@
24#include <nvgpu/bug.h> 23#include <nvgpu/bug.h>
25#include <nvgpu/enabled.h> 24#include <nvgpu/enabled.h>
26#include <nvgpu/ctxsw_trace.h> 25#include <nvgpu/ctxsw_trace.h>
26#include <nvgpu/vgpu/vgpu_ivm.h>
27 27
28#include "gk20a/gk20a.h" 28#include "gk20a/gk20a.h"
29#include "vgpu.h" 29#include "vgpu.h"
@@ -62,7 +62,7 @@ int vgpu_fecs_trace_init(struct gk20a *g)
62 __nvgpu_set_enabled(g, NVGPU_SUPPORT_FECS_CTXSW_TRACE, true); 62 __nvgpu_set_enabled(g, NVGPU_SUPPORT_FECS_CTXSW_TRACE, true);
63 63
64 mempool = args.args[0]; 64 mempool = args.args[0];
65 vcst->cookie = tegra_hv_mempool_reserve(mempool); 65 vcst->cookie = vgpu_ivm_mempool_reserve(mempool);
66 if (IS_ERR(vcst->cookie)) { 66 if (IS_ERR(vcst->cookie)) {
67 dev_info(dev_from_gk20a(g), 67 dev_info(dev_from_gk20a(g),
68 "mempool %u reserve failed\n", mempool); 68 "mempool %u reserve failed\n", mempool);
@@ -71,7 +71,8 @@ int vgpu_fecs_trace_init(struct gk20a *g)
71 goto fail; 71 goto fail;
72 } 72 }
73 73
74 vcst->buf = ioremap_cache(vcst->cookie->ipa, vcst->cookie->size); 74 vcst->buf = ioremap_cache(vgpu_ivm_get_ipa(vcst->cookie),
75 vgpu_ivm_get_size(vcst->cookie));
75 if (!vcst->buf) { 76 if (!vcst->buf) {
76 dev_info(dev_from_gk20a(g), "ioremap_cache failed\n"); 77 dev_info(dev_from_gk20a(g), "ioremap_cache failed\n");
77 err = -EINVAL; 78 err = -EINVAL;
@@ -91,7 +92,7 @@ int vgpu_fecs_trace_init(struct gk20a *g)
91fail: 92fail:
92 iounmap(vcst->buf); 93 iounmap(vcst->buf);
93 if (vcst->cookie) 94 if (vcst->cookie)
94 tegra_hv_mempool_unreserve(vcst->cookie); 95 vgpu_ivm_mempool_unreserve(vcst->cookie);
95 nvgpu_kfree(g, vcst); 96 nvgpu_kfree(g, vcst);
96 return err; 97 return err;
97} 98}
@@ -101,7 +102,7 @@ int vgpu_fecs_trace_deinit(struct gk20a *g)
101 struct vgpu_fecs_trace *vcst = (struct vgpu_fecs_trace *)g->fecs_trace; 102 struct vgpu_fecs_trace *vcst = (struct vgpu_fecs_trace *)g->fecs_trace;
102 103
103 iounmap(vcst->buf); 104 iounmap(vcst->buf);
104 tegra_hv_mempool_unreserve(vcst->cookie); 105 vgpu_ivm_mempool_unreserve(vcst->cookie);
105 nvgpu_kfree(g, vcst); 106 nvgpu_kfree(g, vcst);
106 return 0; 107 return 0;
107} 108}
@@ -164,7 +165,7 @@ int vgpu_alloc_user_buffer(struct gk20a *g, void **buf, size_t *size)
164 struct vgpu_fecs_trace *vcst = (struct vgpu_fecs_trace *)g->fecs_trace; 165 struct vgpu_fecs_trace *vcst = (struct vgpu_fecs_trace *)g->fecs_trace;
165 166
166 *buf = vcst->buf; 167 *buf = vcst->buf;
167 *size = vcst->cookie->size; 168 *size = vgpu_ivm_get_size(vcst->cookie);
168 return 0; 169 return 0;
169} 170}
170 171
@@ -176,14 +177,14 @@ int vgpu_free_user_buffer(struct gk20a *g)
176int vgpu_mmap_user_buffer(struct gk20a *g, struct vm_area_struct *vma) 177int vgpu_mmap_user_buffer(struct gk20a *g, struct vm_area_struct *vma)
177{ 178{
178 struct vgpu_fecs_trace *vcst = (struct vgpu_fecs_trace *)g->fecs_trace; 179 struct vgpu_fecs_trace *vcst = (struct vgpu_fecs_trace *)g->fecs_trace;
179 unsigned long size = vcst->cookie->size; 180 unsigned long size = vgpu_ivm_get_size(vcst->cookie);
180 unsigned long vsize = vma->vm_end - vma->vm_start; 181 unsigned long vsize = vma->vm_end - vma->vm_start;
181 182
182 size = min(size, vsize); 183 size = min(size, vsize);
183 size = round_up(size, PAGE_SIZE); 184 size = round_up(size, PAGE_SIZE);
184 185
185 return remap_pfn_range(vma, vma->vm_start, 186 return remap_pfn_range(vma, vma->vm_start,
186 vcst->cookie->ipa >> PAGE_SHIFT, 187 vgpu_ivm_get_ipa(vcst->cookie) >> PAGE_SHIFT,
187 size, 188 size,
188 vma->vm_page_prot); 189 vma->vm_page_prot);
189} 190}