diff options
author | Richard Zhao <rizhao@nvidia.com> | 2015-12-02 20:21:47 -0500 |
---|---|---|
committer | Vladislav Buzov <vbuzov@nvidia.com> | 2016-01-10 23:06:57 -0500 |
commit | 3484fd0d1365c6f97723d97cb45664aa75c45f32 (patch) | |
tree | 17eb997ad8092b009e689155c0ff75f7b2b88edf /drivers/gpu/nvgpu/vgpu/dbg_vgpu.c | |
parent | 476447ec554637a623169b5447e7b303ccd8ab98 (diff) |
gpu: nvgpu: vgpu: add regops support
Added new RM Server command for regops.
JIRA VFND-1128
Bug 1700139
Change-Id: Ia1cc63e993c29c91f87440c241077fa91edb9e53
Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Reviewed-on: http://git-master/r/923235
(cherry picked from commit 7de22e42cfd2e419ad64178b9f1f1ee16273bd03)
Reviewed-on: http://git-master/r/841330
Reviewed-by: Aingara Paramakuru <aparamakuru@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vladislav Buzov <vbuzov@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/vgpu/dbg_vgpu.c')
-rw-r--r-- | drivers/gpu/nvgpu/vgpu/dbg_vgpu.c | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/dbg_vgpu.c b/drivers/gpu/nvgpu/vgpu/dbg_vgpu.c new file mode 100644 index 00000000..ef12c3fd --- /dev/null +++ b/drivers/gpu/nvgpu/vgpu/dbg_vgpu.c | |||
@@ -0,0 +1,74 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2015, 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 <linux/tegra_gr_comm.h> | ||
18 | #include <linux/tegra_vgpu.h> | ||
19 | |||
20 | #include "gk20a/gk20a.h" | ||
21 | #include "gk20a/channel_gk20a.h" | ||
22 | #include "gk20a/dbg_gpu_gk20a.h" | ||
23 | #include "vgpu.h" | ||
24 | |||
25 | static int vgpu_exec_regops(struct dbg_session_gk20a *dbg_s, | ||
26 | struct nvgpu_dbg_gpu_reg_op *ops, | ||
27 | u64 num_ops) | ||
28 | { | ||
29 | struct channel_gk20a *ch = dbg_s->ch; | ||
30 | struct gk20a_platform *platform = gk20a_get_platform(dbg_s->g->dev); | ||
31 | struct tegra_vgpu_cmd_msg msg; | ||
32 | struct tegra_vgpu_reg_ops_params *p = &msg.params.reg_ops; | ||
33 | void *oob; | ||
34 | size_t oob_size; | ||
35 | void *handle = NULL; | ||
36 | int ops_size, err = 0; | ||
37 | |||
38 | gk20a_dbg_fn(""); | ||
39 | BUG_ON(sizeof(*ops) != sizeof(struct tegra_vgpu_reg_op)); | ||
40 | |||
41 | handle = tegra_gr_comm_oob_get_ptr(TEGRA_GR_COMM_CTX_CLIENT, | ||
42 | tegra_gr_comm_get_server_vmid(), | ||
43 | TEGRA_VGPU_QUEUE_CMD, | ||
44 | &oob, &oob_size); | ||
45 | if (!handle) | ||
46 | return -EINVAL; | ||
47 | |||
48 | ops_size = sizeof(*ops) * num_ops; | ||
49 | if (oob_size < ops_size) { | ||
50 | err = -ENOMEM; | ||
51 | goto fail; | ||
52 | } | ||
53 | |||
54 | memcpy(oob, ops, ops_size); | ||
55 | |||
56 | msg.cmd = TEGRA_VGPU_CMD_REG_OPS; | ||
57 | msg.handle = platform->virt_handle; | ||
58 | p->handle = ch ? ch->virt_ctx : 0; | ||
59 | p->num_ops = num_ops; | ||
60 | p->is_profiler = dbg_s->is_profiler; | ||
61 | err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg)); | ||
62 | err = err ? err : msg.ret; | ||
63 | if (!err) | ||
64 | memcpy(ops, oob, ops_size); | ||
65 | |||
66 | fail: | ||
67 | tegra_gr_comm_oob_put_ptr(handle); | ||
68 | return err; | ||
69 | } | ||
70 | |||
71 | void vgpu_dbg_init(void) | ||
72 | { | ||
73 | dbg_gpu_session_ops_gk20a.exec_reg_ops = vgpu_exec_regops; | ||
74 | } | ||