summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu
diff options
context:
space:
mode:
authorseshendra Gadagottu <sgadagottu@nvidia.com>2018-07-09 19:25:40 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-07-24 19:10:58 -0400
commit69be500c0b6fab324a34fc0b0f6b80f21a128c7e (patch)
tree2edc7920defdaface49b538f5a1abbd78aa03bcf /drivers/gpu/nvgpu
parent2c2d9e66710e264d251c0019258eed1dc5bb38f2 (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')
-rw-r--r--drivers/gpu/nvgpu/Makefile1
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h3
-rw-r--r--drivers/gpu/nvgpu/gv100/hal_gv100.c1
-rw-r--r--drivers/gpu/nvgpu/gv11b/hal_gv11b.c1
-rw-r--r--drivers/gpu/nvgpu/gv11b/ltc_gv11b.c23
-rw-r--r--drivers/gpu/nvgpu/gv11b/ltc_gv11b.h3
-rw-r--r--drivers/gpu/nvgpu/os/linux/debug.c2
-rw-r--r--drivers/gpu/nvgpu/os/linux/debug_ltc.c93
-rw-r--r--drivers/gpu/nvgpu/os/linux/debug_ltc.h21
-rw-r--r--drivers/gpu/nvgpu/os/linux/os_linux.h1
10 files changed, 147 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile
index 90858e55..aa780f55 100644
--- a/drivers/gpu/nvgpu/Makefile
+++ b/drivers/gpu/nvgpu/Makefile
@@ -86,6 +86,7 @@ nvgpu-$(CONFIG_DEBUG_FS) += \
86 os/linux/debug_hal.o \ 86 os/linux/debug_hal.o \
87 os/linux/debug_clk.o \ 87 os/linux/debug_clk.o \
88 os/linux/debug_bios.o \ 88 os/linux/debug_bios.o \
89 os/linux/debug_ltc.o \
89 os/linux/debug_xve.o 90 os/linux/debug_xve.o
90 91
91ifeq ($(CONFIG_NVGPU_TRACK_MEM_USAGE),y) 92ifeq ($(CONFIG_NVGPU_TRACK_MEM_USAGE),y)
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h
index 4934958c..afd18658 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.h
@@ -189,6 +189,7 @@ struct gpu_ops {
189 void (*isr)(struct gk20a *g); 189 void (*isr)(struct gk20a *g);
190 u32 (*cbc_fix_config)(struct gk20a *g, int base); 190 u32 (*cbc_fix_config)(struct gk20a *g, int base);
191 void (*flush)(struct gk20a *g); 191 void (*flush)(struct gk20a *g);
192 void (*intr_en_illegal_compstat)(struct gk20a *g, bool enable);
192 } ltc; 193 } ltc;
193 struct { 194 struct {
194 void (*isr_stall)(struct gk20a *g, u32 inst_id, u32 pri_base); 195 void (*isr_stall)(struct gk20a *g, u32 inst_id, u32 pri_base);
@@ -1547,6 +1548,8 @@ struct gk20a {
1547 1548
1548 struct gk20a_ce_app ce_app; 1549 struct gk20a_ce_app ce_app;
1549 1550
1551 bool ltc_intr_en_illegal_compstat;
1552
1550 /* PCI device identifier */ 1553 /* PCI device identifier */
1551 u16 pci_vendor_id, pci_device_id; 1554 u16 pci_vendor_id, pci_device_id;
1552 u16 pci_subsystem_vendor_id, pci_subsystem_device_id; 1555 u16 pci_subsystem_vendor_id, pci_subsystem_device_id;
diff --git a/drivers/gpu/nvgpu/gv100/hal_gv100.c b/drivers/gpu/nvgpu/gv100/hal_gv100.c
index 09a96d40..6ebf1675 100644
--- a/drivers/gpu/nvgpu/gv100/hal_gv100.c
+++ b/drivers/gpu/nvgpu/gv100/hal_gv100.c
@@ -283,6 +283,7 @@ static const struct gpu_ops gv100_ops = {
283 .cbc_fix_config = NULL, 283 .cbc_fix_config = NULL,
284 .flush = gm20b_flush_ltc, 284 .flush = gm20b_flush_ltc,
285 .set_enabled = gp10b_ltc_set_enabled, 285 .set_enabled = gp10b_ltc_set_enabled,
286 .intr_en_illegal_compstat = gv11b_ltc_intr_en_illegal_compstat,
286 }, 287 },
287 .ce2 = { 288 .ce2 = {
288 .isr_stall = gv11b_ce_isr, 289 .isr_stall = gv11b_ce_isr,
diff --git a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c
index 08c3097e..0508452c 100644
--- a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c
+++ b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c
@@ -241,6 +241,7 @@ static const struct gpu_ops gv11b_ops = {
241 .isr = gv11b_ltc_isr, 241 .isr = gv11b_ltc_isr,
242 .flush = gm20b_flush_ltc, 242 .flush = gm20b_flush_ltc,
243 .set_enabled = gp10b_ltc_set_enabled, 243 .set_enabled = gp10b_ltc_set_enabled,
244 .intr_en_illegal_compstat = gv11b_ltc_intr_en_illegal_compstat,
244 }, 245 },
245 .ce2 = { 246 .ce2 = {
246 .isr_stall = gv11b_ce_isr, 247 .isr_stall = gv11b_ce_isr,
diff --git a/drivers/gpu/nvgpu/gv11b/ltc_gv11b.c b/drivers/gpu/nvgpu/gv11b/ltc_gv11b.c
index 3cea4cd4..a040de23 100644
--- a/drivers/gpu/nvgpu/gv11b/ltc_gv11b.c
+++ b/drivers/gpu/nvgpu/gv11b/ltc_gv11b.c
@@ -70,10 +70,13 @@ void gv11b_ltc_init_fs_state(struct gk20a *g)
70 /* Disable LTC interrupts */ 70 /* Disable LTC interrupts */
71 reg = gk20a_readl(g, ltc_ltcs_ltss_intr_r()); 71 reg = gk20a_readl(g, ltc_ltcs_ltss_intr_r());
72 reg &= ~ltc_ltcs_ltss_intr_en_evicted_cb_m(); 72 reg &= ~ltc_ltcs_ltss_intr_en_evicted_cb_m();
73 reg &= ~ltc_ltcs_ltss_intr_en_illegal_compstat_m();
74 reg &= ~ltc_ltcs_ltss_intr_en_illegal_compstat_access_m(); 73 reg &= ~ltc_ltcs_ltss_intr_en_illegal_compstat_access_m();
75 nvgpu_writel_check(g, ltc_ltcs_ltss_intr_r(), reg); 74 nvgpu_writel_check(g, ltc_ltcs_ltss_intr_r(), reg);
76 75
76 if (g->ops.ltc.intr_en_illegal_compstat)
77 g->ops.ltc.intr_en_illegal_compstat(g,
78 g->ltc_intr_en_illegal_compstat);
79
77 /* Enable ECC interrupts */ 80 /* Enable ECC interrupts */
78 ltc_intr = gk20a_readl(g, ltc_ltcs_ltss_intr_r()); 81 ltc_intr = gk20a_readl(g, ltc_ltcs_ltss_intr_r());
79 ltc_intr |= ltc_ltcs_ltss_intr_en_ecc_sec_error_enabled_f() | 82 ltc_intr |= ltc_ltcs_ltss_intr_en_ecc_sec_error_enabled_f() |
@@ -82,6 +85,24 @@ void gv11b_ltc_init_fs_state(struct gk20a *g)
82 ltc_intr); 85 ltc_intr);
83} 86}
84 87
88void gv11b_ltc_intr_en_illegal_compstat(struct gk20a *g, bool enable)
89{
90 u32 val;
91
92 /* disble/enble illegal_compstat interrupt */
93 val = gk20a_readl(g, ltc_ltcs_ltss_intr_r());
94 if (enable)
95 val = set_field(val,
96 ltc_ltcs_ltss_intr_en_illegal_compstat_m(),
97 ltc_ltcs_ltss_intr_en_illegal_compstat_enabled_f());
98 else
99 val = set_field(val,
100 ltc_ltcs_ltss_intr_en_illegal_compstat_m(),
101 ltc_ltcs_ltss_intr_en_illegal_compstat_disabled_f());
102 gk20a_writel(g, ltc_ltcs_ltss_intr_r(), val);
103}
104
105
85void gv11b_ltc_isr(struct gk20a *g) 106void gv11b_ltc_isr(struct gk20a *g)
86{ 107{
87 u32 mc_intr, ltc_intr3; 108 u32 mc_intr, ltc_intr3;
diff --git a/drivers/gpu/nvgpu/gv11b/ltc_gv11b.h b/drivers/gpu/nvgpu/gv11b/ltc_gv11b.h
index 8309e662..9d33b9fb 100644
--- a/drivers/gpu/nvgpu/gv11b/ltc_gv11b.h
+++ b/drivers/gpu/nvgpu/gv11b/ltc_gv11b.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a 4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"), 5 * copy of this software and associated documentation files (the "Software"),
@@ -28,6 +28,7 @@ void gv11b_ltc_set_zbc_stencil_entry(struct gk20a *g,
28 struct zbc_entry *stencil_val, 28 struct zbc_entry *stencil_val,
29 u32 index); 29 u32 index);
30void gv11b_ltc_init_fs_state(struct gk20a *g); 30void gv11b_ltc_init_fs_state(struct gk20a *g);
31void gv11b_ltc_intr_en_illegal_compstat(struct gk20a *g, bool enable);
31void gv11b_ltc_isr(struct gk20a *g); 32void gv11b_ltc_isr(struct gk20a *g);
32 33
33#endif 34#endif
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
22static 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
38static 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
69static 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
75int 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 &ltc_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
18struct gk20a;
19int 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;