summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRichard Zhao <rizhao@nvidia.com>2015-12-02 20:21:47 -0500
committerVladislav Buzov <vbuzov@nvidia.com>2016-01-10 23:06:57 -0500
commit3484fd0d1365c6f97723d97cb45664aa75c45f32 (patch)
tree17eb997ad8092b009e689155c0ff75f7b2b88edf /drivers
parent476447ec554637a623169b5447e7b303ccd8ab98 (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')
-rw-r--r--drivers/gpu/nvgpu/Makefile1
-rw-r--r--drivers/gpu/nvgpu/vgpu/dbg_vgpu.c74
-rw-r--r--drivers/gpu/nvgpu/vgpu/vgpu.c1
-rw-r--r--drivers/gpu/nvgpu/vgpu/vgpu.h2
4 files changed, 78 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile
index 966c5eea..f6b3a673 100644
--- a/drivers/gpu/nvgpu/Makefile
+++ b/drivers/gpu/nvgpu/Makefile
@@ -77,6 +77,7 @@ nvgpu-$(CONFIG_TEGRA_GR_VIRTUALIZATION) += \
77 vgpu/mm_vgpu.o \ 77 vgpu/mm_vgpu.o \
78 vgpu/debug_vgpu.o \ 78 vgpu/debug_vgpu.o \
79 vgpu/vgpu.o \ 79 vgpu/vgpu.o \
80 vgpu/dbg_vgpu.o \
80 vgpu/gk20a/vgpu_hal_gk20a.o \ 81 vgpu/gk20a/vgpu_hal_gk20a.o \
81 vgpu/gk20a/vgpu_gr_gk20a.o \ 82 vgpu/gk20a/vgpu_gr_gk20a.o \
82 vgpu/gm20b/vgpu_hal_gm20b.o \ 83 vgpu/gm20b/vgpu_hal_gm20b.o \
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
25static 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
66fail:
67 tegra_gr_comm_oob_put_ptr(handle);
68 return err;
69}
70
71void vgpu_dbg_init(void)
72{
73 dbg_gpu_session_ops_gk20a.exec_reg_ops = vgpu_exec_regops;
74}
diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.c b/drivers/gpu/nvgpu/vgpu/vgpu.c
index 6f91db4c..3791d8a7 100644
--- a/drivers/gpu/nvgpu/vgpu/vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/vgpu.c
@@ -408,6 +408,7 @@ int vgpu_probe(struct platform_device *dev)
408 return err; 408 return err;
409 409
410 vgpu_init_support(dev); 410 vgpu_init_support(dev);
411 vgpu_dbg_init();
411 412
412 init_rwsem(&gk20a->busy_lock); 413 init_rwsem(&gk20a->busy_lock);
413 414
diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.h b/drivers/gpu/nvgpu/vgpu/vgpu.h
index ffb863cd..32f4b110 100644
--- a/drivers/gpu/nvgpu/vgpu/vgpu.h
+++ b/drivers/gpu/nvgpu/vgpu/vgpu.h
@@ -58,6 +58,8 @@ int vgpu_comm_sendrecv(struct tegra_vgpu_cmd_msg *msg, size_t size_in,
58void vgpu_init_hal_common(struct gk20a *g); 58void vgpu_init_hal_common(struct gk20a *g);
59int vgpu_gk20a_init_hal(struct gk20a *g); 59int vgpu_gk20a_init_hal(struct gk20a *g);
60int vgpu_gm20b_init_hal(struct gk20a *g); 60int vgpu_gm20b_init_hal(struct gk20a *g);
61
62void vgpu_dbg_init(void);
61#else 63#else
62static inline int vgpu_pm_prepare_poweroff(struct device *dev) 64static inline int vgpu_pm_prepare_poweroff(struct device *dev)
63{ 65{