From 6090a8a7ee347f92d806f104d3a0082208f5df64 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Wed, 24 May 2017 17:37:04 +0530 Subject: gpu: nvgpu: move debugfs code to linux module Since all debugfs code is Linux specific, remove it from common code and move it to Linux module Debugfs code is now divided into below module specific files : common/linux/debug.c common/linux/debug_cde.c common/linux/debug_ce.c common/linux/debug_fifo.c common/linux/debug_gr.c common/linux/debug_mm.c common/linux/debug_allocator.c common/linux/debug_kmem.c common/linux/debug_pmu.c common/linux/debug_sched.c Add corresponding header files for above modules too And compile all of above files only if CONFIG_DEBUG_FS is set Some more details of the changes made - Move and rename gk20a/debug_gk20a.c to common/linux/debug.c - Move and rename gk20a/debug_gk20a.h to include/nvgpu/debug.h - Remove gm20b/debug_gm20b.c and gm20b/debug_gm20b.h and call gk20a_init_debug_ops() directly from gm20b_init_hal() - Update all debug APIs to receive struct gk20a as parameter instead of receiving struct device pointer - Update API gk20a_dmabuf_get_state() to receive struct gk20a pointer instead of struct device - Include explicitly in all files where debug operations are used - Remove "gk20a/platform_gk20a.h" include from HAL files which no longer need this include - Add new API gk20a_debug_deinit() to deinitialize debugfs and call it from gk20a_remove() - Move API gk20a_debug_dump_all_channel_status_ramfc() to gk20a/fifo_gk20a.c Jira NVGPU-62 Change-Id: I076975d3d7f669bdbe9212fa33d98529377feeb6 Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/1488902 Reviewed-by: svccoveritychecker GVS: Gerrit_Virtual_Submit Reviewed-by: Bharat Nihalani --- drivers/gpu/nvgpu/include/nvgpu/allocator.h | 7 +--- drivers/gpu/nvgpu/include/nvgpu/debug.h | 55 ++++++++++++++++++++++++++++ drivers/gpu/nvgpu/include/nvgpu/linux/kmem.h | 6 --- 3 files changed, 57 insertions(+), 11 deletions(-) create mode 100644 drivers/gpu/nvgpu/include/nvgpu/debug.h (limited to 'drivers/gpu/nvgpu/include') diff --git a/drivers/gpu/nvgpu/include/nvgpu/allocator.h b/drivers/gpu/nvgpu/include/nvgpu/allocator.h index 3579b0fb..567c4422 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/allocator.h +++ b/drivers/gpu/nvgpu/include/nvgpu/allocator.h @@ -256,11 +256,13 @@ static inline struct gk20a *nvgpu_alloc_to_gpu(struct nvgpu_allocator *a) return a->g; } +#ifdef CONFIG_DEBUG_FS /* * Common functionality for the internals of the allocators. */ void nvgpu_init_alloc_debug(struct gk20a *g, struct nvgpu_allocator *a); void nvgpu_fini_alloc_debug(struct nvgpu_allocator *a); +#endif int __nvgpu_alloc_common_init(struct nvgpu_allocator *a, struct gk20a *g, const char *name, void *priv, bool dbg, @@ -281,11 +283,6 @@ static inline void nvgpu_alloc_disable_dbg(struct nvgpu_allocator *a) */ extern u32 nvgpu_alloc_tracing_on; -#ifdef CONFIG_DEBUG_FS -struct device; -void nvgpu_alloc_debugfs_init(struct device *dev); -#endif - #define nvgpu_alloc_trace_func() \ do { \ if (nvgpu_alloc_tracing_on) \ diff --git a/drivers/gpu/nvgpu/include/nvgpu/debug.h b/drivers/gpu/nvgpu/include/nvgpu/debug.h new file mode 100644 index 00000000..70a03978 --- /dev/null +++ b/drivers/gpu/nvgpu/include/nvgpu/debug.h @@ -0,0 +1,55 @@ +/* + * GK20A Debug functionality + * + * Copyright (C) 2011-2017 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 __NVGPU_DEBUG_H__ +#define __NVGPU_DEBUG_H__ + +struct gk20a; +struct gpu_ops; + +struct gk20a_debug_output { + void (*fn)(void *ctx, const char *str, size_t len); + void *ctx; + char buf[256]; +}; + +#ifdef CONFIG_DEBUG_FS +extern unsigned int gk20a_debug_trace_cmdbuf; + +void gk20a_debug_output(struct gk20a_debug_output *o, + const char *fmt, ...); + +void gk20a_debug_dump(struct gk20a *g); +void gk20a_debug_show_dump(struct gk20a *g, struct gk20a_debug_output *o); +int gk20a_gr_debug_dump(struct gk20a *g); +void gk20a_init_debug_ops(struct gpu_ops *gops); + +void gk20a_debug_init(struct gk20a *g, const char *debugfs_symlink); +void gk20a_debug_deinit(struct gk20a *g); +#else +static inline void gk20a_debug_output(struct gk20a_debug_output *o, + const char *fmt, ...) {} + +static inline void gk20a_debug_dump(struct gk20a *g) {} +static inline void gk20a_debug_show_dump(struct gk20a *g, struct gk20a_debug_output *o) {} +static inline int gk20a_gr_debug_dump(struct gk20a *g) { return 0;} +static inline void gk20a_init_debug_ops(struct gpu_ops *gops) {} + +static inline void gk20a_debug_init(struct gk20a *g, const char *debugfs_symlink) {} +static inline void gk20a_debug_deinit(struct gk20a *g) {} +#endif + +#endif /* __NVGPU_DEBUG_H__ */ diff --git a/drivers/gpu/nvgpu/include/nvgpu/linux/kmem.h b/drivers/gpu/nvgpu/include/nvgpu/linux/kmem.h index dc198a04..611854f2 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/linux/kmem.h +++ b/drivers/gpu/nvgpu/include/nvgpu/linux/kmem.h @@ -31,12 +31,6 @@ void *__nvgpu_track_kcalloc(struct gk20a *g, size_t n, size_t size, unsigned long ip); void __nvgpu_track_vfree(struct gk20a *g, void *addr); void __nvgpu_track_kfree(struct gk20a *g, void *addr); - -void nvgpu_kmem_debugfs_init(struct device *dev); -#else -static inline void nvgpu_kmem_debugfs_init(struct device *dev) -{ -} #endif /** -- cgit v1.2.2