diff options
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.c | 73 |
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 | |||
22 | int 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 | |||
53 | void 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 | } | ||