diff options
Diffstat (limited to 'drivers/gpu/nvgpu/vgpu')
-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 | } |