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>
This commit is contained in:
Aingara Paramakuru
2014-12-11 11:06:24 -05:00
committed by Dan Willemsen
parent 58233492fc
commit 7e9b9c0b3e
11 changed files with 124 additions and 21 deletions

View File

@@ -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) += \

View File

@@ -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);

View File

@@ -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

View File

@@ -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 {

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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 <linux/tegra-fuse.h>
#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;

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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;