diff options
author | Peter Daifuku <pdaifuku@nvidia.com> | 2016-06-09 19:09:52 -0400 |
---|---|---|
committer | Vladislav Buzov <vbuzov@nvidia.com> | 2016-07-06 18:26:22 -0400 |
commit | 1b04326f400489f25399167ef9f1c931a576656e (patch) | |
tree | 0dca7cf0982773647ca7bee54b2e190e02a97f97 /drivers/gpu/nvgpu/vgpu/dbg_vgpu.c | |
parent | da4d5130e81b68d9773c8d64c7a6d944acfac0c8 (diff) |
gpu: nvgpu: vgpu: dbg_set_powergate support
Add support for dbg_set_powergate when virtualized
Jira VFND-1905
Change-Id: I0d81c8863b3eda4ae4fee42e5a95d2fc9d78b174
Signed-off-by: Peter Daifuku <pdaifuku@nvidia.com>
Reviewed-on: http://git-master/r/1162048
(cherry picked from commit 0dfc55f390a10e21ae13e14dd2f16e89a3bddfa7)
Reviewed-on: http://git-master/r/1167182
(cherry picked from commit 4e34a1844558d93da5ad208532ec28aeda228f95)
Reviewed-on: http://git-master/r/1174701
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Richard Zhao <rizhao@nvidia.com>
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 | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/dbg_vgpu.c b/drivers/gpu/nvgpu/vgpu/dbg_vgpu.c index a9533e03..38f072de 100644 --- a/drivers/gpu/nvgpu/vgpu/dbg_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/dbg_vgpu.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 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, | 5 | * under the terms and conditions of the GNU General Public License, |
@@ -69,7 +69,41 @@ fail: | |||
69 | return err; | 69 | return err; |
70 | } | 70 | } |
71 | 71 | ||
72 | static int vgpu_dbg_set_powergate(struct dbg_session_gk20a *dbg_s, __u32 mode) | ||
73 | { | ||
74 | struct gk20a_platform *platform = gk20a_get_platform(dbg_s->g->dev); | ||
75 | struct tegra_vgpu_cmd_msg msg; | ||
76 | struct tegra_vgpu_set_powergate_params *p = &msg.params.set_powergate; | ||
77 | int err = 0; | ||
78 | |||
79 | gk20a_dbg_fn(""); | ||
80 | |||
81 | /* Just return if requested mode is the same as the session's mode */ | ||
82 | switch (mode) { | ||
83 | case NVGPU_DBG_GPU_POWERGATE_MODE_DISABLE: | ||
84 | if (dbg_s->is_pg_disabled) | ||
85 | return 0; | ||
86 | dbg_s->is_pg_disabled = true; | ||
87 | break; | ||
88 | case NVGPU_DBG_GPU_POWERGATE_MODE_ENABLE: | ||
89 | if (!dbg_s->is_pg_disabled) | ||
90 | return 0; | ||
91 | dbg_s->is_pg_disabled = false; | ||
92 | break; | ||
93 | default: | ||
94 | return -EINVAL; | ||
95 | } | ||
96 | |||
97 | msg.cmd = TEGRA_VGPU_CMD_SET_POWERGATE; | ||
98 | msg.handle = platform->virt_handle; | ||
99 | p->mode = mode; | ||
100 | err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg)); | ||
101 | err = err ? err : msg.ret; | ||
102 | return err; | ||
103 | } | ||
104 | |||
72 | void vgpu_dbg_init(void) | 105 | void vgpu_dbg_init(void) |
73 | { | 106 | { |
74 | dbg_gpu_session_ops_gk20a.exec_reg_ops = vgpu_exec_regops; | 107 | dbg_gpu_session_ops_gk20a.exec_reg_ops = vgpu_exec_regops; |
108 | dbg_gpu_session_ops_gk20a.dbg_set_powergate = vgpu_dbg_set_powergate; | ||
75 | } | 109 | } |