diff options
author | seshendra Gadagottu <sgadagottu@nvidia.com> | 2018-07-09 19:25:40 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-07-24 19:10:58 -0400 |
commit | 69be500c0b6fab324a34fc0b0f6b80f21a128c7e (patch) | |
tree | 2edc7920defdaface49b538f5a1abbd78aa03bcf /drivers/gpu/nvgpu/os/linux | |
parent | 2c2d9e66710e264d251c0019258eed1dc5bb38f2 (diff) |
gpu: nvgpu: debugfs node to enable/disable ltc_illegal_compstat intr
Added debugfs node under ltc directory with name:
intr_illegal_compstat_enable
Enabling/disabling of ltc_illegal_compstat intr is
possible through debugfs node.
Since ltc state is lost with rail gate, this setting is
cached and will be populated during ltc initialization.
Bug 2099406
Change-Id: I4bf62228dfd2bbb94f87f923f9f4f6e5ad0b07f0
Signed-off-by: seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1774683
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/os/linux')
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/debug.c | 2 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/debug_ltc.c | 93 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/debug_ltc.h | 21 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/os_linux.h | 1 |
4 files changed, 117 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/debug.c b/drivers/gpu/nvgpu/os/linux/debug.c index c4dae9e6..9403e72e 100644 --- a/drivers/gpu/nvgpu/os/linux/debug.c +++ b/drivers/gpu/nvgpu/os/linux/debug.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include "debug_sched.h" | 22 | #include "debug_sched.h" |
23 | #include "debug_hal.h" | 23 | #include "debug_hal.h" |
24 | #include "debug_xve.h" | 24 | #include "debug_xve.h" |
25 | #include "debug_ltc.h" | ||
25 | #include "debug_bios.h" | 26 | #include "debug_bios.h" |
26 | #include "os_linux.h" | 27 | #include "os_linux.h" |
27 | #include "platform_gk20a.h" | 28 | #include "platform_gk20a.h" |
@@ -435,6 +436,7 @@ void gk20a_debug_init(struct gk20a *g, const char *debugfs_symlink) | |||
435 | #ifdef CONFIG_NVGPU_TRACK_MEM_USAGE | 436 | #ifdef CONFIG_NVGPU_TRACK_MEM_USAGE |
436 | nvgpu_kmem_debugfs_init(g); | 437 | nvgpu_kmem_debugfs_init(g); |
437 | #endif | 438 | #endif |
439 | nvgpu_ltc_debugfs_init(g); | ||
438 | if (g->pci_vendor_id) { | 440 | if (g->pci_vendor_id) { |
439 | nvgpu_xve_debugfs_init(g); | 441 | nvgpu_xve_debugfs_init(g); |
440 | nvgpu_bios_debugfs_init(g); | 442 | nvgpu_bios_debugfs_init(g); |
diff --git a/drivers/gpu/nvgpu/os/linux/debug_ltc.c b/drivers/gpu/nvgpu/os/linux/debug_ltc.c new file mode 100644 index 00000000..88fb45f4 --- /dev/null +++ b/drivers/gpu/nvgpu/os/linux/debug_ltc.c | |||
@@ -0,0 +1,93 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2018 NVIDIA Corporation. All rights reserved. | ||
3 | * | ||
4 | * This software is licensed under the terms of the GNU General Public | ||
5 | * License version 2, as published by the Free Software Foundation, and | ||
6 | * may be copied, distributed, and modified under those terms. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #include "debug_ltc.h" | ||
16 | #include "os_linux.h" | ||
17 | #include "gk20a/gk20a.h" | ||
18 | |||
19 | #include <linux/debugfs.h> | ||
20 | #include <linux/uaccess.h> | ||
21 | |||
22 | static ssize_t ltc_intr_illegal_compstat_read(struct file *file, | ||
23 | char __user *user_buf, size_t count, loff_t *ppos) | ||
24 | { | ||
25 | char buf[3]; | ||
26 | struct gk20a *g = file->private_data; | ||
27 | |||
28 | if (g->ltc_intr_en_illegal_compstat) | ||
29 | buf[0] = 'Y'; | ||
30 | else | ||
31 | buf[0] = 'N'; | ||
32 | buf[1] = '\n'; | ||
33 | buf[2] = 0x00; | ||
34 | |||
35 | return simple_read_from_buffer(user_buf, count, ppos, buf, 2); | ||
36 | } | ||
37 | |||
38 | static ssize_t ltc_intr_illegal_compstat_write(struct file *file, | ||
39 | const char __user *user_buf, size_t count, loff_t *ppos) | ||
40 | { | ||
41 | char buf[3]; | ||
42 | int buf_size; | ||
43 | bool intr_illegal_compstat_enabled; | ||
44 | struct gk20a *g = file->private_data; | ||
45 | int err; | ||
46 | |||
47 | if (!g->ops.ltc.intr_en_illegal_compstat) | ||
48 | return -EINVAL; | ||
49 | |||
50 | buf_size = min(count, (sizeof(buf)-1)); | ||
51 | if (copy_from_user(buf, user_buf, buf_size)) | ||
52 | return -EFAULT; | ||
53 | |||
54 | err = gk20a_busy(g); | ||
55 | if (err) | ||
56 | return err; | ||
57 | |||
58 | if (strtobool(buf, &intr_illegal_compstat_enabled) == 0) { | ||
59 | g->ops.ltc.intr_en_illegal_compstat(g, | ||
60 | intr_illegal_compstat_enabled); | ||
61 | g->ltc_intr_en_illegal_compstat = intr_illegal_compstat_enabled; | ||
62 | } | ||
63 | |||
64 | gk20a_idle(g); | ||
65 | |||
66 | return buf_size; | ||
67 | } | ||
68 | |||
69 | static const struct file_operations ltc_intr_illegal_compstat_fops = { | ||
70 | .open = simple_open, | ||
71 | .read = ltc_intr_illegal_compstat_read, | ||
72 | .write = ltc_intr_illegal_compstat_write, | ||
73 | }; | ||
74 | |||
75 | int nvgpu_ltc_debugfs_init(struct gk20a *g) | ||
76 | { | ||
77 | struct dentry *d; | ||
78 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); | ||
79 | struct dentry *gpu_root = l->debugfs; | ||
80 | |||
81 | l->debugfs_ltc = debugfs_create_dir("ltc", gpu_root); | ||
82 | if (IS_ERR_OR_NULL(l->debugfs_ltc)) | ||
83 | return -ENODEV; | ||
84 | |||
85 | /* Debug fs node to enable/disable illegal_compstat */ | ||
86 | d = debugfs_create_file("intr_illegal_compstat_enable", 0600, | ||
87 | l->debugfs_ltc, g, | ||
88 | <c_intr_illegal_compstat_fops); | ||
89 | if (!d) | ||
90 | return -ENOMEM; | ||
91 | |||
92 | return 0; | ||
93 | } | ||
diff --git a/drivers/gpu/nvgpu/os/linux/debug_ltc.h b/drivers/gpu/nvgpu/os/linux/debug_ltc.h new file mode 100644 index 00000000..3ad734ce --- /dev/null +++ b/drivers/gpu/nvgpu/os/linux/debug_ltc.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2018 NVIDIA Corporation. All rights reserved. | ||
3 | * | ||
4 | * This software is licensed under the terms of the GNU General Public | ||
5 | * License version 2, as published by the Free Software Foundation, and | ||
6 | * may be copied, distributed, and modified under those terms. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #ifndef __NVGPU_DEBUG_LTC_H__ | ||
16 | #define __NVGPU_DEBUG_LTC_H__ | ||
17 | |||
18 | struct gk20a; | ||
19 | int nvgpu_ltc_debugfs_init(struct gk20a *g); | ||
20 | |||
21 | #endif /* __NVGPU_DEBUG_LTC_H__ */ | ||
diff --git a/drivers/gpu/nvgpu/os/linux/os_linux.h b/drivers/gpu/nvgpu/os/linux/os_linux.h index 85d697bd..13c20a81 100644 --- a/drivers/gpu/nvgpu/os/linux/os_linux.h +++ b/drivers/gpu/nvgpu/os/linux/os_linux.h | |||
@@ -135,6 +135,7 @@ struct nvgpu_os_linux { | |||
135 | struct dentry *debugfs_xve; | 135 | struct dentry *debugfs_xve; |
136 | struct dentry *debugfs_kmem; | 136 | struct dentry *debugfs_kmem; |
137 | struct dentry *debugfs_hal; | 137 | struct dentry *debugfs_hal; |
138 | struct dentry *debugfs_ltc; | ||
138 | 139 | ||
139 | struct dentry *debugfs_force_preemption_cilp; | 140 | struct dentry *debugfs_force_preemption_cilp; |
140 | struct dentry *debugfs_force_preemption_gfxp; | 141 | struct dentry *debugfs_force_preemption_gfxp; |