From 7e9b9c0b3ea832d9f372663c81e526a70fb65f92 Mon Sep 17 00:00:00 2001 From: Aingara Paramakuru Date: Thu, 11 Dec 2014 11:06:24 -0500 Subject: 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 Reviewed-on: http://git-master/r/662722 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/Makefile | 4 +++- drivers/gpu/nvgpu/gk20a/debug_gk20a.c | 36 +++++++++++++++++++++-------------- drivers/gpu/nvgpu/gk20a/debug_gk20a.h | 12 +++++++++++- drivers/gpu/nvgpu/gk20a/gk20a.h | 7 ++++++- drivers/gpu/nvgpu/gk20a/hal_gk20a.c | 3 ++- drivers/gpu/nvgpu/gm20b/debug_gm20b.c | 21 ++++++++++++++++++++ drivers/gpu/nvgpu/gm20b/debug_gm20b.h | 24 +++++++++++++++++++++++ drivers/gpu/nvgpu/gm20b/hal_gm20b.c | 4 +++- drivers/gpu/nvgpu/vgpu/debug_vgpu.c | 25 ++++++++++++++++++++++++ drivers/gpu/nvgpu/vgpu/vgpu.c | 3 ++- drivers/gpu/nvgpu/vgpu/vgpu.h | 6 +++++- 11 files changed, 124 insertions(+), 21 deletions(-) create mode 100644 drivers/gpu/nvgpu/gm20b/debug_gm20b.c create mode 100644 drivers/gpu/nvgpu/gm20b/debug_gm20b.h create mode 100644 drivers/gpu/nvgpu/vgpu/debug_vgpu.c (limited to 'drivers/gpu') 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 := \ gm20b/pmu_gm20b.o \ gm20b/mm_gm20b.o \ gm20b/regops_gm20b.o \ - gm20b/mc_gm20b.o + gm20b/mc_gm20b.o \ + gm20b/debug_gm20b.o nvgpu-$(CONFIG_TEGRA_GK20A) += gk20a/platform_gk20a_tegra.o nvgpu-$(CONFIG_SYNC) += gk20a/sync_gk20a.o @@ -69,6 +70,7 @@ nvgpu-$(CONFIG_TEGRA_GR_VIRTUALIZATION) += \ vgpu/gr_vgpu.o \ vgpu/fifo_vgpu.o \ vgpu/mm_vgpu.o \ + vgpu/debug_vgpu.o \ vgpu/vgpu.o nvgpu-$(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 @@ /* * drivers/video/tegra/host/t20/debug_gk20a.c * - * Copyright (C) 2011-2014 NVIDIA Corporation. All rights reserved. + * Copyright (C) 2011-2015 NVIDIA Corporation. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and @@ -34,12 +34,6 @@ unsigned int gk20a_debug_trace_cmdbuf; static struct platform_device *gk20a_device; -struct gk20a_debug_output { - void (*fn)(void *ctx, const char *str, size_t len); - void *ctx; - char buf[256]; -}; - static const char * const ccsr_chan_status_str[] = { "idle", "pending", @@ -160,11 +154,8 @@ static void gk20a_debug_show_channel(struct gk20a *g, gk20a_debug_output(o, "\n"); } -static void gk20a_debug_show_dump(struct platform_device *pdev, - struct gk20a_debug_output *o) +void gk20a_debug_show_dump(struct gk20a *g, struct gk20a_debug_output *o) { - struct gk20a_platform *platform = gk20a_get_platform(pdev); - struct gk20a *g = platform->g; struct fifo_gk20a *f = &g->fifo; u32 chid; int i, err; @@ -235,6 +226,7 @@ static void gk20a_debug_show_dump(struct platform_device *pdev, void gk20a_debug_dump(struct platform_device *pdev) { struct gk20a_platform *platform = gk20a_get_platform(pdev); + struct gk20a *g = platform->g; struct gk20a_debug_output o = { .fn = gk20a_debug_write_printk }; @@ -242,7 +234,9 @@ void gk20a_debug_dump(struct platform_device *pdev) if (platform->dump_platform_dependencies) platform->dump_platform_dependencies(pdev); - gk20a_debug_show_dump(pdev, &o); + /* HAL only initialized after 1st power-on */ + if (g->ops.debug.show_dump) + g->ops.debug.show_dump(g, &o); } void gk20a_debug_dump_device(struct platform_device *pdev) @@ -250,6 +244,7 @@ void gk20a_debug_dump_device(struct platform_device *pdev) struct gk20a_debug_output o = { .fn = gk20a_debug_write_printk }; + struct gk20a *g; /* Dump the first device if no info is provided */ if (!pdev) { @@ -259,7 +254,10 @@ void gk20a_debug_dump_device(struct platform_device *pdev) pdev = gk20a_device; } - gk20a_debug_show_dump(pdev, &o); + g = gk20a_get_platform(pdev)->g; + /* HAL only initialized after 1st power-on */ + if (g->ops.debug.show_dump) + g->ops.debug.show_dump(g, &o); } EXPORT_SYMBOL(gk20a_debug_dump_device); @@ -270,7 +268,12 @@ static int gk20a_debug_show(struct seq_file *s, void *unused) .fn = gk20a_debug_write_to_seqfile, .ctx = s, }; - gk20a_debug_show_dump(pdev, &o); + struct gk20a *g; + + g = gk20a_get_platform(pdev)->g; + /* HAL only initialized after 1st power-on */ + if (g->ops.debug.show_dump) + g->ops.debug.show_dump(g, &o); return 0; } @@ -286,6 +289,11 @@ static const struct file_operations gk20a_debug_fops = { .release = single_release, }; +void gk20a_init_debug_ops(struct gpu_ops *gops) +{ + gops->debug.show_dump = gk20a_debug_show_dump; +} + void gk20a_debug_init(struct platform_device *pdev) { 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 @@ /* * GK20A Debug functionality * - * Copyright (C) 2011-2014 NVIDIA CORPORATION. All rights reserved. + * Copyright (C) 2011-2015 NVIDIA CORPORATION. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and @@ -18,10 +18,20 @@ #define _DEBUG_GK20A_H_ struct platform_device; +struct gk20a; +struct gpu_ops; extern unsigned int gk20a_debug_trace_cmdbuf; +struct gk20a_debug_output { + void (*fn)(void *ctx, const char *str, size_t len); + void *ctx; + char buf[256]; +}; + void gk20a_debug_dump(struct platform_device *pdev); +void gk20a_debug_show_dump(struct gk20a *g, struct gk20a_debug_output *o); void gk20a_debug_init(struct platform_device *pdev); +void gk20a_init_debug_ops(struct gpu_ops *gops); #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 @@ /* * GK20A Graphics * - * Copyright (c) 2011-2014, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2011-2015, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -47,6 +47,7 @@ struct acr_gm20b; #include "platform_gk20a.h" #include "gm20b/acr_gm20b.h" #include "cde_gk20a.h" +#include "debug_gk20a.h" struct cooling_device_gk20a { struct thermal_cooling_device *gk20a_cooling_dev; @@ -367,6 +368,10 @@ struct gpu_ops { irqreturn_t (*isr_thread_nonstall)(struct gk20a *g); u32 intr_mask_restore[4]; } mc; + struct { + void (*show_dump)(struct gk20a *g, + struct gk20a_debug_output *o); + } debug; }; struct 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 @@ * * GK20A Tegra HAL interface. * - * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -62,6 +62,7 @@ int gk20a_init_hal(struct gk20a *g) gk20a_init_pmu_ops(gops); gk20a_init_clk_ops(gops); gk20a_init_regops(gops); + gk20a_init_debug_ops(gops); gops->name = "gk20a"; 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 @@ +/* + * Copyright (C) 2015 NVIDIA Corporation. All rights reserved. + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include "gk20a/gk20a.h" +#include "debug_gm20b.h" + +void gm20b_init_debug_ops(struct gpu_ops *gops) +{ + gops->debug.show_dump = gk20a_debug_show_dump; +} 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 @@ +/* + * GM20B Debug functionality + * + * Copyright (C) 2015 NVIDIA CORPORATION. All rights reserved. + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef _DEBUG_GM20B_H_ +#define _DEBUG_GM20B_H_ + +struct gpu_ops; + +void gm20b_init_debug_ops(struct gpu_ops *gops); + +#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 @@ /* * GM20B Graphics * - * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -30,6 +30,7 @@ #include "mc_gm20b.h" #include #include "regops_gm20b.h" +#include "debug_gm20b.h" #define FUSE_OPT_PRIV_SEC_DIS_0 0x264 #define PRIV_SECURITY_DISABLE 0x01 @@ -128,6 +129,7 @@ int gm20b_init_hal(struct gk20a *g) gm20b_init_pmu_ops(gops); gm20b_init_clk_ops(gops); gm20b_init_regops(gops); + gm20b_init_debug_ops(gops); gops->name = "gm20b"; 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 @@ +/* + * Copyright (C) 2015 NVIDIA Corporation. All rights reserved. + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include "vgpu/vgpu.h" + +static void vgpu_debug_show_dump(struct gk20a *g, struct gk20a_debug_output *o) +{ + /* debug dump not supported */ +} + +void vgpu_init_debug_ops(struct gpu_ops *gops) +{ + gops->debug.show_dump = vgpu_debug_show_dump; +} 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 @@ /* * Virtualized GPU * - * Copyright (c) 2014 NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2015 NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -247,6 +247,7 @@ static int vgpu_init_hal(struct gk20a *g) vgpu_init_gr_ops(&g->ops); vgpu_init_ltc_ops(&g->ops); vgpu_init_mm_ops(&g->ops); + vgpu_init_debug_ops(&g->ops); break; default: 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 @@ /* * Virtualized GPU Interfaces * - * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -31,6 +31,7 @@ void vgpu_init_fifo_ops(struct gpu_ops *gops); void vgpu_init_gr_ops(struct gpu_ops *gops); void vgpu_init_ltc_ops(struct gpu_ops *gops); void vgpu_init_mm_ops(struct gpu_ops *gops); +void vgpu_init_debug_ops(struct gpu_ops *gops); int vgpu_init_mm_support(struct gk20a *g); int vgpu_init_gr_support(struct gk20a *g); int vgpu_init_fifo_support(struct gk20a *g); @@ -75,6 +76,9 @@ static inline void vgpu_init_ltc_ops(struct gpu_ops *gops) static inline void vgpu_init_mm_ops(struct gpu_ops *gops) { } +static inline void vgpu_init_debug_ops(struct gpu_ops *gops) +{ +} static inline int vgpu_init_mm_support(struct gk20a *g) { return -ENOSYS; -- cgit v1.2.2