summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAingara Paramakuru <aparamakuru@nvidia.com>2014-12-11 11:06:24 -0500
committerDan Willemsen <dwillemsen@nvidia.com>2015-04-04 18:06:07 -0400
commit7e9b9c0b3ea832d9f372663c81e526a70fb65f92 (patch)
treea9de2e533bc486baaf520c9d7351a89d8a23ccfd /drivers
parent58233492fca7de69121722b6b2e89d500fcb6761 (diff)
gpu: nvgpu: move debug dump to HAL
Move the debug dump to HAL and add a stub for vgpu. Bug 1595164 Change-Id: Ifdcdd8a8caca7a41919dad075fee1c87032f53b0 Signed-off-by: Aingara Paramakuru <aparamakuru@nvidia.com> Reviewed-on: http://git-master/r/662722 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/nvgpu/Makefile4
-rw-r--r--drivers/gpu/nvgpu/gk20a/debug_gk20a.c36
-rw-r--r--drivers/gpu/nvgpu/gk20a/debug_gk20a.h12
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h7
-rw-r--r--drivers/gpu/nvgpu/gk20a/hal_gk20a.c3
-rw-r--r--drivers/gpu/nvgpu/gm20b/debug_gm20b.c21
-rw-r--r--drivers/gpu/nvgpu/gm20b/debug_gm20b.h24
-rw-r--r--drivers/gpu/nvgpu/gm20b/hal_gm20b.c4
-rw-r--r--drivers/gpu/nvgpu/vgpu/debug_vgpu.c25
-rw-r--r--drivers/gpu/nvgpu/vgpu/vgpu.c3
-rw-r--r--drivers/gpu/nvgpu/vgpu/vgpu.h6
11 files changed, 124 insertions, 21 deletions
diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile
index fd292b70..4e2ce497 100644
--- a/drivers/gpu/nvgpu/Makefile
+++ b/drivers/gpu/nvgpu/Makefile
@@ -58,7 +58,8 @@ nvgpu-y := \
58 gm20b/pmu_gm20b.o \ 58 gm20b/pmu_gm20b.o \
59 gm20b/mm_gm20b.o \ 59 gm20b/mm_gm20b.o \
60 gm20b/regops_gm20b.o \ 60 gm20b/regops_gm20b.o \
61 gm20b/mc_gm20b.o 61 gm20b/mc_gm20b.o \
62 gm20b/debug_gm20b.o
62 63
63nvgpu-$(CONFIG_TEGRA_GK20A) += gk20a/platform_gk20a_tegra.o 64nvgpu-$(CONFIG_TEGRA_GK20A) += gk20a/platform_gk20a_tegra.o
64nvgpu-$(CONFIG_SYNC) += gk20a/sync_gk20a.o 65nvgpu-$(CONFIG_SYNC) += gk20a/sync_gk20a.o
@@ -69,6 +70,7 @@ nvgpu-$(CONFIG_TEGRA_GR_VIRTUALIZATION) += \
69 vgpu/gr_vgpu.o \ 70 vgpu/gr_vgpu.o \
70 vgpu/fifo_vgpu.o \ 71 vgpu/fifo_vgpu.o \
71 vgpu/mm_vgpu.o \ 72 vgpu/mm_vgpu.o \
73 vgpu/debug_vgpu.o \
72 vgpu/vgpu.o 74 vgpu/vgpu.o
73 75
74nvgpu-$(CONFIG_TEGRA_CLK_FRAMEWORK) += \ 76nvgpu-$(CONFIG_TEGRA_CLK_FRAMEWORK) += \
diff --git a/drivers/gpu/nvgpu/gk20a/debug_gk20a.c b/drivers/gpu/nvgpu/gk20a/debug_gk20a.c
index 602d713b..1351304d 100644
--- a/drivers/gpu/nvgpu/gk20a/debug_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/debug_gk20a.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * drivers/video/tegra/host/t20/debug_gk20a.c 2 * drivers/video/tegra/host/t20/debug_gk20a.c
3 * 3 *
4 * Copyright (C) 2011-2014 NVIDIA Corporation. All rights reserved. 4 * Copyright (C) 2011-2015 NVIDIA Corporation. All rights reserved.
5 * 5 *
6 * This software is licensed under the terms of the GNU General Public 6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and 7 * License version 2, as published by the Free Software Foundation, and
@@ -34,12 +34,6 @@
34unsigned int gk20a_debug_trace_cmdbuf; 34unsigned int gk20a_debug_trace_cmdbuf;
35static struct platform_device *gk20a_device; 35static struct platform_device *gk20a_device;
36 36
37struct gk20a_debug_output {
38 void (*fn)(void *ctx, const char *str, size_t len);
39 void *ctx;
40 char buf[256];
41};
42
43static const char * const ccsr_chan_status_str[] = { 37static const char * const ccsr_chan_status_str[] = {
44 "idle", 38 "idle",
45 "pending", 39 "pending",
@@ -160,11 +154,8 @@ static void gk20a_debug_show_channel(struct gk20a *g,
160 gk20a_debug_output(o, "\n"); 154 gk20a_debug_output(o, "\n");
161} 155}
162 156
163static void gk20a_debug_show_dump(struct platform_device *pdev, 157void gk20a_debug_show_dump(struct gk20a *g, struct gk20a_debug_output *o)
164 struct gk20a_debug_output *o)
165{ 158{
166 struct gk20a_platform *platform = gk20a_get_platform(pdev);
167 struct gk20a *g = platform->g;
168 struct fifo_gk20a *f = &g->fifo; 159 struct fifo_gk20a *f = &g->fifo;
169 u32 chid; 160 u32 chid;
170 int i, err; 161 int i, err;
@@ -235,6 +226,7 @@ static void gk20a_debug_show_dump(struct platform_device *pdev,
235void gk20a_debug_dump(struct platform_device *pdev) 226void gk20a_debug_dump(struct platform_device *pdev)
236{ 227{
237 struct gk20a_platform *platform = gk20a_get_platform(pdev); 228 struct gk20a_platform *platform = gk20a_get_platform(pdev);
229 struct gk20a *g = platform->g;
238 struct gk20a_debug_output o = { 230 struct gk20a_debug_output o = {
239 .fn = gk20a_debug_write_printk 231 .fn = gk20a_debug_write_printk
240 }; 232 };
@@ -242,7 +234,9 @@ void gk20a_debug_dump(struct platform_device *pdev)
242 if (platform->dump_platform_dependencies) 234 if (platform->dump_platform_dependencies)
243 platform->dump_platform_dependencies(pdev); 235 platform->dump_platform_dependencies(pdev);
244 236
245 gk20a_debug_show_dump(pdev, &o); 237 /* HAL only initialized after 1st power-on */
238 if (g->ops.debug.show_dump)
239 g->ops.debug.show_dump(g, &o);
246} 240}
247 241
248void gk20a_debug_dump_device(struct platform_device *pdev) 242void gk20a_debug_dump_device(struct platform_device *pdev)
@@ -250,6 +244,7 @@ void gk20a_debug_dump_device(struct platform_device *pdev)
250 struct gk20a_debug_output o = { 244 struct gk20a_debug_output o = {
251 .fn = gk20a_debug_write_printk 245 .fn = gk20a_debug_write_printk
252 }; 246 };
247 struct gk20a *g;
253 248
254 /* Dump the first device if no info is provided */ 249 /* Dump the first device if no info is provided */
255 if (!pdev) { 250 if (!pdev) {
@@ -259,7 +254,10 @@ void gk20a_debug_dump_device(struct platform_device *pdev)
259 pdev = gk20a_device; 254 pdev = gk20a_device;
260 } 255 }
261 256
262 gk20a_debug_show_dump(pdev, &o); 257 g = gk20a_get_platform(pdev)->g;
258 /* HAL only initialized after 1st power-on */
259 if (g->ops.debug.show_dump)
260 g->ops.debug.show_dump(g, &o);
263} 261}
264EXPORT_SYMBOL(gk20a_debug_dump_device); 262EXPORT_SYMBOL(gk20a_debug_dump_device);
265 263
@@ -270,7 +268,12 @@ static int gk20a_debug_show(struct seq_file *s, void *unused)
270 .fn = gk20a_debug_write_to_seqfile, 268 .fn = gk20a_debug_write_to_seqfile,
271 .ctx = s, 269 .ctx = s,
272 }; 270 };
273 gk20a_debug_show_dump(pdev, &o); 271 struct gk20a *g;
272
273 g = gk20a_get_platform(pdev)->g;
274 /* HAL only initialized after 1st power-on */
275 if (g->ops.debug.show_dump)
276 g->ops.debug.show_dump(g, &o);
274 return 0; 277 return 0;
275} 278}
276 279
@@ -286,6 +289,11 @@ static const struct file_operations gk20a_debug_fops = {
286 .release = single_release, 289 .release = single_release,
287}; 290};
288 291
292void gk20a_init_debug_ops(struct gpu_ops *gops)
293{
294 gops->debug.show_dump = gk20a_debug_show_dump;
295}
296
289void gk20a_debug_init(struct platform_device *pdev) 297void gk20a_debug_init(struct platform_device *pdev)
290{ 298{
291 struct gk20a_platform *platform = platform_get_drvdata(pdev); 299 struct gk20a_platform *platform = platform_get_drvdata(pdev);
diff --git a/drivers/gpu/nvgpu/gk20a/debug_gk20a.h b/drivers/gpu/nvgpu/gk20a/debug_gk20a.h
index c70b19d9..30c87f35 100644
--- a/drivers/gpu/nvgpu/gk20a/debug_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/debug_gk20a.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * GK20A Debug functionality 2 * GK20A Debug functionality
3 * 3 *
4 * Copyright (C) 2011-2014 NVIDIA CORPORATION. All rights reserved. 4 * Copyright (C) 2011-2015 NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This software is licensed under the terms of the GNU General Public 6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and 7 * License version 2, as published by the Free Software Foundation, and
@@ -18,10 +18,20 @@
18#define _DEBUG_GK20A_H_ 18#define _DEBUG_GK20A_H_
19 19
20struct platform_device; 20struct platform_device;
21struct gk20a;
22struct gpu_ops;
21 23
22extern unsigned int gk20a_debug_trace_cmdbuf; 24extern unsigned int gk20a_debug_trace_cmdbuf;
23 25
26struct gk20a_debug_output {
27 void (*fn)(void *ctx, const char *str, size_t len);
28 void *ctx;
29 char buf[256];
30};
31
24void gk20a_debug_dump(struct platform_device *pdev); 32void gk20a_debug_dump(struct platform_device *pdev);
33void gk20a_debug_show_dump(struct gk20a *g, struct gk20a_debug_output *o);
25void gk20a_debug_init(struct platform_device *pdev); 34void gk20a_debug_init(struct platform_device *pdev);
35void gk20a_init_debug_ops(struct gpu_ops *gops);
26 36
27#endif 37#endif
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h
index 4ddea431..9bb890ca 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * GK20A Graphics 2 * GK20A Graphics
3 * 3 *
4 * Copyright (c) 2011-2014, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2011-2015, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -47,6 +47,7 @@ struct acr_gm20b;
47#include "platform_gk20a.h" 47#include "platform_gk20a.h"
48#include "gm20b/acr_gm20b.h" 48#include "gm20b/acr_gm20b.h"
49#include "cde_gk20a.h" 49#include "cde_gk20a.h"
50#include "debug_gk20a.h"
50 51
51struct cooling_device_gk20a { 52struct cooling_device_gk20a {
52 struct thermal_cooling_device *gk20a_cooling_dev; 53 struct thermal_cooling_device *gk20a_cooling_dev;
@@ -367,6 +368,10 @@ struct gpu_ops {
367 irqreturn_t (*isr_thread_nonstall)(struct gk20a *g); 368 irqreturn_t (*isr_thread_nonstall)(struct gk20a *g);
368 u32 intr_mask_restore[4]; 369 u32 intr_mask_restore[4];
369 } mc; 370 } mc;
371 struct {
372 void (*show_dump)(struct gk20a *g,
373 struct gk20a_debug_output *o);
374 } debug;
370}; 375};
371 376
372struct gk20a { 377struct gk20a {
diff --git a/drivers/gpu/nvgpu/gk20a/hal_gk20a.c b/drivers/gpu/nvgpu/gk20a/hal_gk20a.c
index ada2f034..0e97d551 100644
--- a/drivers/gpu/nvgpu/gk20a/hal_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/hal_gk20a.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * GK20A Tegra HAL interface. 4 * GK20A Tegra HAL interface.
5 * 5 *
6 * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. 6 * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License, 9 * under the terms and conditions of the GNU General Public License,
@@ -62,6 +62,7 @@ int gk20a_init_hal(struct gk20a *g)
62 gk20a_init_pmu_ops(gops); 62 gk20a_init_pmu_ops(gops);
63 gk20a_init_clk_ops(gops); 63 gk20a_init_clk_ops(gops);
64 gk20a_init_regops(gops); 64 gk20a_init_regops(gops);
65 gk20a_init_debug_ops(gops);
65 gops->name = "gk20a"; 66 gops->name = "gk20a";
66 67
67 c->twod_class = FERMI_TWOD_A; 68 c->twod_class = FERMI_TWOD_A;
diff --git a/drivers/gpu/nvgpu/gm20b/debug_gm20b.c b/drivers/gpu/nvgpu/gm20b/debug_gm20b.c
new file mode 100644
index 00000000..b266200c
--- /dev/null
+++ b/drivers/gpu/nvgpu/gm20b/debug_gm20b.c
@@ -0,0 +1,21 @@
1/*
2 * Copyright (C) 2015 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 "gk20a/gk20a.h"
16#include "debug_gm20b.h"
17
18void gm20b_init_debug_ops(struct gpu_ops *gops)
19{
20 gops->debug.show_dump = gk20a_debug_show_dump;
21}
diff --git a/drivers/gpu/nvgpu/gm20b/debug_gm20b.h b/drivers/gpu/nvgpu/gm20b/debug_gm20b.h
new file mode 100644
index 00000000..c3c5fed6
--- /dev/null
+++ b/drivers/gpu/nvgpu/gm20b/debug_gm20b.h
@@ -0,0 +1,24 @@
1/*
2 * GM20B Debug functionality
3 *
4 * Copyright (C) 2015 NVIDIA CORPORATION. All rights reserved.
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#ifndef _DEBUG_GM20B_H_
18#define _DEBUG_GM20B_H_
19
20struct gpu_ops;
21
22void gm20b_init_debug_ops(struct gpu_ops *gops);
23
24#endif
diff --git a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c
index e95f8878..5dc0c212 100644
--- a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c
+++ b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * GM20B Graphics 2 * GM20B Graphics
3 * 3 *
4 * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -30,6 +30,7 @@
30#include "mc_gm20b.h" 30#include "mc_gm20b.h"
31#include <linux/tegra-fuse.h> 31#include <linux/tegra-fuse.h>
32#include "regops_gm20b.h" 32#include "regops_gm20b.h"
33#include "debug_gm20b.h"
33 34
34#define FUSE_OPT_PRIV_SEC_DIS_0 0x264 35#define FUSE_OPT_PRIV_SEC_DIS_0 0x264
35#define PRIV_SECURITY_DISABLE 0x01 36#define PRIV_SECURITY_DISABLE 0x01
@@ -128,6 +129,7 @@ int gm20b_init_hal(struct gk20a *g)
128 gm20b_init_pmu_ops(gops); 129 gm20b_init_pmu_ops(gops);
129 gm20b_init_clk_ops(gops); 130 gm20b_init_clk_ops(gops);
130 gm20b_init_regops(gops); 131 gm20b_init_regops(gops);
132 gm20b_init_debug_ops(gops);
131 gops->name = "gm20b"; 133 gops->name = "gm20b";
132 134
133 c->twod_class = FERMI_TWOD_A; 135 c->twod_class = FERMI_TWOD_A;
diff --git a/drivers/gpu/nvgpu/vgpu/debug_vgpu.c b/drivers/gpu/nvgpu/vgpu/debug_vgpu.c
new file mode 100644
index 00000000..d48ab944
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/debug_vgpu.c
@@ -0,0 +1,25 @@
1/*
2 * Copyright (C) 2015 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 "vgpu/vgpu.h"
16
17static void vgpu_debug_show_dump(struct gk20a *g, struct gk20a_debug_output *o)
18{
19 /* debug dump not supported */
20}
21
22void vgpu_init_debug_ops(struct gpu_ops *gops)
23{
24 gops->debug.show_dump = vgpu_debug_show_dump;
25}
diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.c b/drivers/gpu/nvgpu/vgpu/vgpu.c
index 25dcd8bb..36d65ee8 100644
--- a/drivers/gpu/nvgpu/vgpu/vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/vgpu.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Virtualized GPU 2 * Virtualized GPU
3 * 3 *
4 * Copyright (c) 2014 NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2014-2015 NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -247,6 +247,7 @@ static int vgpu_init_hal(struct gk20a *g)
247 vgpu_init_gr_ops(&g->ops); 247 vgpu_init_gr_ops(&g->ops);
248 vgpu_init_ltc_ops(&g->ops); 248 vgpu_init_ltc_ops(&g->ops);
249 vgpu_init_mm_ops(&g->ops); 249 vgpu_init_mm_ops(&g->ops);
250 vgpu_init_debug_ops(&g->ops);
250 break; 251 break;
251 default: 252 default:
252 gk20a_err(&g->dev->dev, "no support for %x", ver); 253 gk20a_err(&g->dev->dev, "no support for %x", ver);
diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.h b/drivers/gpu/nvgpu/vgpu/vgpu.h
index 972c2107..4677b36c 100644
--- a/drivers/gpu/nvgpu/vgpu/vgpu.h
+++ b/drivers/gpu/nvgpu/vgpu/vgpu.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Virtualized GPU Interfaces 2 * Virtualized GPU Interfaces
3 * 3 *
4 * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -31,6 +31,7 @@ void vgpu_init_fifo_ops(struct gpu_ops *gops);
31void vgpu_init_gr_ops(struct gpu_ops *gops); 31void vgpu_init_gr_ops(struct gpu_ops *gops);
32void vgpu_init_ltc_ops(struct gpu_ops *gops); 32void vgpu_init_ltc_ops(struct gpu_ops *gops);
33void vgpu_init_mm_ops(struct gpu_ops *gops); 33void vgpu_init_mm_ops(struct gpu_ops *gops);
34void vgpu_init_debug_ops(struct gpu_ops *gops);
34int vgpu_init_mm_support(struct gk20a *g); 35int vgpu_init_mm_support(struct gk20a *g);
35int vgpu_init_gr_support(struct gk20a *g); 36int vgpu_init_gr_support(struct gk20a *g);
36int vgpu_init_fifo_support(struct gk20a *g); 37int vgpu_init_fifo_support(struct gk20a *g);
@@ -75,6 +76,9 @@ static inline void vgpu_init_ltc_ops(struct gpu_ops *gops)
75static inline void vgpu_init_mm_ops(struct gpu_ops *gops) 76static inline void vgpu_init_mm_ops(struct gpu_ops *gops)
76{ 77{
77} 78}
79static inline void vgpu_init_debug_ops(struct gpu_ops *gops)
80{
81}
78static inline int vgpu_init_mm_support(struct gk20a *g) 82static inline int vgpu_init_mm_support(struct gk20a *g)
79{ 83{
80 return -ENOSYS; 84 return -ENOSYS;