diff options
Diffstat (limited to 'drivers/gpu/nvgpu/common')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/debug.c | 7 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/ltc.c | 42 |
2 files changed, 43 insertions, 6 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/debug.c b/drivers/gpu/nvgpu/common/linux/debug.c index e085aed4..a846493e 100644 --- a/drivers/gpu/nvgpu/common/linux/debug.c +++ b/drivers/gpu/nvgpu/common/linux/debug.c | |||
@@ -275,15 +275,10 @@ void gk20a_debug_init(struct gk20a *g, const char *debugfs_symlink) | |||
275 | debugfs_create_u32("log_trace", S_IRUGO|S_IWUSR, | 275 | debugfs_create_u32("log_trace", S_IRUGO|S_IWUSR, |
276 | platform->debugfs, &g->log_trace); | 276 | platform->debugfs, &g->log_trace); |
277 | 277 | ||
278 | nvgpu_spinlock_init(&g->debugfs_lock); | ||
279 | |||
280 | g->mm.ltc_enabled = true; | ||
281 | g->mm.ltc_enabled_debug = true; | ||
282 | |||
283 | g->debugfs_ltc_enabled = | 278 | g->debugfs_ltc_enabled = |
284 | debugfs_create_bool("ltc_enabled", S_IRUGO|S_IWUSR, | 279 | debugfs_create_bool("ltc_enabled", S_IRUGO|S_IWUSR, |
285 | platform->debugfs, | 280 | platform->debugfs, |
286 | &g->mm.ltc_enabled_debug); | 281 | &g->mm.ltc_enabled_target); |
287 | 282 | ||
288 | g->debugfs_gr_idle_timeout_default = | 283 | g->debugfs_gr_idle_timeout_default = |
289 | debugfs_create_u32("gr_idle_timeout_default_us", | 284 | debugfs_create_u32("gr_idle_timeout_default_us", |
diff --git a/drivers/gpu/nvgpu/common/ltc.c b/drivers/gpu/nvgpu/common/ltc.c new file mode 100644 index 00000000..0965caa3 --- /dev/null +++ b/drivers/gpu/nvgpu/common/ltc.c | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2017, 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 <nvgpu/ltc.h> | ||
18 | |||
19 | #include "gk20a/gk20a.h" | ||
20 | |||
21 | int nvgpu_init_ltc_support(struct gk20a *g) | ||
22 | { | ||
23 | nvgpu_spinlock_init(&g->ltc_enabled_lock); | ||
24 | |||
25 | g->mm.ltc_enabled_current = true; | ||
26 | g->mm.ltc_enabled_target = true; | ||
27 | |||
28 | if (g->ops.ltc.init_fs_state) | ||
29 | g->ops.ltc.init_fs_state(g); | ||
30 | |||
31 | return 0; | ||
32 | } | ||
33 | |||
34 | void nvgpu_ltc_sync_enabled(struct gk20a *g) | ||
35 | { | ||
36 | nvgpu_spinlock_acquire(&g->ltc_enabled_lock); | ||
37 | if (g->mm.ltc_enabled_current != g->mm.ltc_enabled_target) { | ||
38 | g->ops.ltc.set_enabled(g, g->mm.ltc_enabled_target); | ||
39 | g->mm.ltc_enabled_current = g->mm.ltc_enabled_target; | ||
40 | } | ||
41 | nvgpu_spinlock_release(&g->ltc_enabled_lock); | ||
42 | } | ||