summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_subctx_gv11b.c
diff options
context:
space:
mode:
authorRichard Zhao <rizhao@nvidia.com>2018-01-30 02:24:37 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2018-02-27 17:30:52 -0500
commit6393eddfa996fba03464f897b85aa5ec79860fed (patch)
tree557ebe9be93e2b0464118e7d8ec019d9d5dbae5f /drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_subctx_gv11b.c
parent7932568b7fe9e16b2b83bc58b2b3686c0d5e52d4 (diff)
gpu: nvgpu: vgpu: move common files out of linux folder
Most of files have been moved out of linux folder. More code could be common as halifying going on. Jira EVLR-2364 Change-Id: Ia9dbdbc82f45ceefe5c788eac7517000cd455d5e Signed-off-by: Richard Zhao <rizhao@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1649947 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/gv11b/vgpu_subctx_gv11b.c')
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_subctx_gv11b.c73
1 files changed, 0 insertions, 73 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_subctx_gv11b.c b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_subctx_gv11b.c
deleted file mode 100644
index 5fbc7bbe..00000000
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_subctx_gv11b.c
+++ /dev/null
@@ -1,73 +0,0 @@
1/*
2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "gk20a/gk20a.h"
18#include "common/linux/vgpu/vgpu.h"
19#include <nvgpu/vgpu/tegra_vgpu.h>
20#include <nvgpu/hw/gv11b/hw_ctxsw_prog_gv11b.h>
21
22int vgpu_gv11b_alloc_subctx_header(struct channel_gk20a *c)
23{
24 struct ctx_header_desc *ctx = &c->ctx_header;
25 struct tegra_vgpu_cmd_msg msg = {};
26 struct tegra_vgpu_alloc_ctx_header_params *p =
27 &msg.params.alloc_ctx_header;
28 int err;
29
30 msg.cmd = TEGRA_VGPU_CMD_ALLOC_CTX_HEADER;
31 msg.handle = vgpu_get_handle(c->g);
32 p->ch_handle = c->virt_ctx;
33 p->ctx_header_va = __nvgpu_vm_alloc_va(c->vm,
34 ctxsw_prog_fecs_header_v(),
35 gmmu_page_size_kernel);
36 if (!p->ctx_header_va) {
37 nvgpu_err(c->g, "alloc va failed for ctx_header");
38 return -ENOMEM;
39 }
40 err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg));
41 err = err ? err : msg.ret;
42 if (unlikely(err)) {
43 nvgpu_err(c->g, "alloc ctx_header failed err %d", err);
44 __nvgpu_vm_free_va(c->vm, p->ctx_header_va,
45 gmmu_page_size_kernel);
46 return err;
47 }
48 ctx->mem.gpu_va = p->ctx_header_va;
49
50 return err;
51}
52
53void vgpu_gv11b_free_subctx_header(struct channel_gk20a *c)
54{
55 struct ctx_header_desc *ctx = &c->ctx_header;
56 struct tegra_vgpu_cmd_msg msg = {};
57 struct tegra_vgpu_free_ctx_header_params *p =
58 &msg.params.free_ctx_header;
59 int err;
60
61 if (ctx->mem.gpu_va) {
62 msg.cmd = TEGRA_VGPU_CMD_FREE_CTX_HEADER;
63 msg.handle = vgpu_get_handle(c->g);
64 p->ch_handle = c->virt_ctx;
65 err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg));
66 err = err ? err : msg.ret;
67 if (unlikely(err))
68 nvgpu_err(c->g, "free ctx_header failed err %d", err);
69 __nvgpu_vm_free_va(c->vm, ctx->mem.gpu_va,
70 gmmu_page_size_kernel);
71 ctx->mem.gpu_va = 0;
72 }
73}