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/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 ++- 4 files changed, 41 insertions(+), 17 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a') 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; -- cgit v1.2.2