diff --git a/drivers/gpu/nvgpu/common/linux/ctxsw_trace.c b/drivers/gpu/nvgpu/common/linux/ctxsw_trace.c index 81a54b7e4..a4a07a4cb 100644 --- a/drivers/gpu/nvgpu/common/linux/ctxsw_trace.c +++ b/drivers/gpu/nvgpu/common/linux/ctxsw_trace.c @@ -1,26 +1,19 @@ /* * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. + * This program is distributed in the hope 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. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ -#include #include #include #include @@ -30,7 +23,6 @@ #include "gk20a/gk20a.h" #include "gk20a/gr_gk20a.h" -#include "gk20a/ctxsw_trace_gk20a.h" #include "gk20a/platform_gk20a.h" #include @@ -39,6 +31,7 @@ #include #include "os_linux.h" +#include "ctxsw_trace.h" #include #include diff --git a/drivers/gpu/nvgpu/common/linux/ctxsw_trace.h b/drivers/gpu/nvgpu/common/linux/ctxsw_trace.h new file mode 100644 index 000000000..88ca7f25d --- /dev/null +++ b/drivers/gpu/nvgpu/common/linux/ctxsw_trace.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2016-2017, 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, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef __CTXSW_TRACE_H__ +#define __CTXSW_TRACE_H__ + +#include + +#define GK20A_CTXSW_TRACE_NUM_DEVS 1 + +struct file; +struct inode; +struct poll_table_struct; + +struct gk20a; + +int gk20a_ctxsw_dev_release(struct inode *inode, struct file *filp); +int gk20a_ctxsw_dev_open(struct inode *inode, struct file *filp); +long gk20a_ctxsw_dev_ioctl(struct file *filp, + unsigned int cmd, unsigned long arg); +ssize_t gk20a_ctxsw_dev_read(struct file *filp, char __user *buf, + size_t size, loff_t *offs); +unsigned int gk20a_ctxsw_dev_poll(struct file *filp, + struct poll_table_struct *pts); + +#endif /* __CTXSW_TRACE_H__ */ diff --git a/drivers/gpu/nvgpu/common/linux/ioctl.c b/drivers/gpu/nvgpu/common/linux/ioctl.c index 7e6df9dfe..c10532687 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl.c @@ -19,11 +19,12 @@ #include #include +#include #include "gk20a/gk20a.h" #include "gk20a/platform_gk20a.h" #include "gk20a/dbg_gpu_gk20a.h" -#include "gk20a/ctxsw_trace_gk20a.h" + #include "ioctl_channel.h" #include "ioctl_ctrl.h" #include "ioctl_as.h" @@ -31,6 +32,7 @@ #include "ioctl_dbg.h" #include "module.h" #include "os_linux.h" +#include "ctxsw_trace.h" #define GK20A_NUM_CDEVS 7 diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c index 7814aea51..91dfc630f 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c @@ -31,12 +31,13 @@ #include #include "gk20a/gk20a.h" -#include "gk20a/ctxsw_trace_gk20a.h" #include "gk20a/dbg_gpu_gk20a.h" #include "gk20a/fence_gk20a.h" #include "gk20a/platform_gk20a.h" + #include "ioctl_channel.h" #include "os_linux.h" +#include "ctxsw_trace.h" static const char *gr_gk20a_graphics_preempt_mode_name(u32 graphics_preempt_mode) { diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c index d0abc8369..b06f86ab9 100644 --- a/drivers/gpu/nvgpu/common/linux/module.c +++ b/drivers/gpu/nvgpu/common/linux/module.c @@ -31,12 +31,12 @@ #include #include #include +#include #include "gk20a/platform_gk20a.h" #include "sysfs.h" #include "vgpu/vgpu.h" #include "scale.h" -#include "gk20a/ctxsw_trace_gk20a.h" #include "pci.h" #include "module.h" #include "intr.h" @@ -48,9 +48,11 @@ #include "vgpu/vgpu_t19x.h" #endif #endif + #include "os_linux.h" #include "cde_gm20b.h" #include "cde_gp10b.h" +#include "ctxsw_trace.h" #define CLASS_NAME "nvidia-gpu" /* TODO: Change to e.g. "nvidia-gpu%s" once we have symlinks in place. */ diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 546f41649..00d203575 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c @@ -42,6 +42,7 @@ #include #include #include +#include /* * This is required for nvgpu_vm_find_buf() which is used in the tracing @@ -51,7 +52,6 @@ #include #include "gk20a.h" -#include "ctxsw_trace_gk20a.h" #include "dbg_gpu_gk20a.h" #include "fence_gk20a.h" diff --git a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c index 1517d25a2..cd206c2a3 100644 --- a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c @@ -34,8 +34,8 @@ #include #include #include +#include -#include "ctxsw_trace_gk20a.h" #include "fecs_trace_gk20a.h" #include "gk20a.h" #include "gr_gk20a.h" diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c index f3ed2efbb..58a4180f1 100644 --- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c @@ -37,9 +37,9 @@ #include #include #include +#include #include "gk20a.h" -#include "ctxsw_trace_gk20a.h" #include "mm_gk20a.h" #include diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 6ca0362b8..f2bb6dcfb 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c @@ -35,13 +35,13 @@ #include #include #include +#include #include #include "gk20a.h" #include "channel_sync_gk20a.h" -#include "ctxsw_trace_gk20a.h" #include "dbg_gpu_gk20a.h" #include "mc_gk20a.h" #include "hal.h" diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index ef7136fee..a95368c3d 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c @@ -38,6 +38,7 @@ #include #include #include +#include #include "gk20a.h" #include "kind_gk20a.h" @@ -45,7 +46,7 @@ #include "gr_pri_gk20a.h" #include "regops_gk20a.h" #include "dbg_gpu_gk20a.h" -#include "ctxsw_trace_gk20a.h" + #include "common/linux/os_linux.h" #include diff --git a/drivers/gpu/nvgpu/gp106/hal_gp106.c b/drivers/gpu/nvgpu/gp106/hal_gp106.c index 3193a6297..0c431385d 100644 --- a/drivers/gpu/nvgpu/gp106/hal_gp106.c +++ b/drivers/gpu/nvgpu/gp106/hal_gp106.c @@ -24,7 +24,6 @@ #include "gk20a/gk20a.h" #include "gk20a/fifo_gk20a.h" -#include "gk20a/ctxsw_trace_gk20a.h" #include "gk20a/fecs_trace_gk20a.h" #include "gk20a/mm_gk20a.h" #include "gk20a/dbg_gpu_gk20a.h" @@ -87,6 +86,7 @@ #include #include #include +#include #include #include diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c index bb95f6dbe..a54a3297b 100644 --- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c @@ -24,7 +24,6 @@ #include "gk20a/gk20a.h" #include "gk20a/fifo_gk20a.h" -#include "gk20a/ctxsw_trace_gk20a.h" #include "gk20a/fecs_trace_gk20a.h" #include "gk20a/mm_gk20a.h" #include "gk20a/dbg_gpu_gk20a.h" @@ -70,6 +69,7 @@ #include #include #include +#include #include #include diff --git a/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.h b/drivers/gpu/nvgpu/include/nvgpu/ctxsw_trace.h similarity index 71% rename from drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.h rename to drivers/gpu/nvgpu/include/nvgpu/ctxsw_trace.h index dddb8603b..cc6edb491 100644 --- a/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.h +++ b/drivers/gpu/nvgpu/include/nvgpu/ctxsw_trace.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -20,45 +20,34 @@ * DEALINGS IN THE SOFTWARE. */ -#ifndef __CTXSW_TRACE_GK20A_H -#define __CTXSW_TRACE_GK20A_H +#ifndef __NVGPU_CTXSW_TRACE_H__ +#define __NVGPU_CTXSW_TRACE_H__ #include -#define GK20A_CTXSW_TRACE_NUM_DEVS 1 - -struct file; -struct inode; struct gk20a; -struct gpu_ops; -struct nvgpu_ctxsw_trace_entry; -struct channel_gk20a; -struct channel_ctx_gk20a; -struct gk20a_ctxsw_dev; -struct gk20a_fecs_trace; struct tsg_gk20a; -struct poll_table_struct; - -int gk20a_ctxsw_dev_release(struct inode *inode, struct file *filp); -int gk20a_ctxsw_dev_open(struct inode *inode, struct file *filp); -long gk20a_ctxsw_dev_ioctl(struct file *filp, - unsigned int cmd, unsigned long arg); -ssize_t gk20a_ctxsw_dev_read(struct file *filp, char __user *buf, - size_t size, loff_t *offs); -unsigned int gk20a_ctxsw_dev_poll(struct file *filp, - struct poll_table_struct *pts); -int gk20a_ctxsw_dev_mmap(struct file *filp, struct vm_area_struct *vma); -int gk20a_ctxsw_dev_ring_alloc(struct gk20a *g, void **buf, size_t *size); -int gk20a_ctxsw_dev_ring_free(struct gk20a *g); -int gk20a_ctxsw_dev_mmap_buffer(struct gk20a *g, struct vm_area_struct *vma); +struct channel_gk20a; +struct nvgpu_ctxsw_trace_entry; int gk20a_ctxsw_trace_init(struct gk20a *g); + +void gk20a_ctxsw_trace_channel_reset(struct gk20a *g, struct channel_gk20a *ch); +void gk20a_ctxsw_trace_tsg_reset(struct gk20a *g, struct tsg_gk20a *tsg); + void gk20a_ctxsw_trace_cleanup(struct gk20a *g); int gk20a_ctxsw_trace_write(struct gk20a *g, struct nvgpu_ctxsw_trace_entry *entry); void gk20a_ctxsw_trace_wake_up(struct gk20a *g, int vmid); -void gk20a_ctxsw_trace_channel_reset(struct gk20a *g, struct channel_gk20a *ch); -void gk20a_ctxsw_trace_tsg_reset(struct gk20a *g, struct tsg_gk20a *tsg); +#ifdef CONFIG_GK20A_CTXSW_TRACE +struct file; +struct vm_area_struct; -#endif /* __CTXSW_TRACE_GK20A_H */ +int gk20a_ctxsw_dev_mmap(struct file *filp, struct vm_area_struct *vma); +int gk20a_ctxsw_dev_ring_alloc(struct gk20a *g, void **buf, size_t *size); +int gk20a_ctxsw_dev_ring_free(struct gk20a *g); +int gk20a_ctxsw_dev_mmap_buffer(struct gk20a *g, struct vm_area_struct *vma); +#endif + +#endif diff --git a/drivers/gpu/nvgpu/vgpu/fecs_trace_vgpu.c b/drivers/gpu/nvgpu/vgpu/fecs_trace_vgpu.c index 72f2ae8b5..dc7608ff0 100644 --- a/drivers/gpu/nvgpu/vgpu/fecs_trace_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/fecs_trace_vgpu.c @@ -24,12 +24,14 @@ #include #include +#include + #include #include #include +#include #include "gk20a/gk20a.h" -#include "gk20a/ctxsw_trace_gk20a.h" #include "vgpu.h" #include "fecs_trace_vgpu.h" diff --git a/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c index 121a52f16..149a51c01 100644 --- a/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c @@ -33,7 +33,6 @@ #include "vgpu/vgpu.h" #include "vgpu/fifo_vgpu.h" -#include "gk20a/ctxsw_trace_gk20a.h" #include #include diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.c b/drivers/gpu/nvgpu/vgpu/vgpu.c index 702146760..93f9eaf4b 100644 --- a/drivers/gpu/nvgpu/vgpu/vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/vgpu.c @@ -34,11 +34,11 @@ #include #include #include +#include #include "vgpu/vgpu.h" #include "vgpu/fecs_trace_vgpu.h" #include "vgpu/clk_vgpu.h" -#include "gk20a/ctxsw_trace_gk20a.h" #include "gk20a/tsg_gk20a.h" #include "gk20a/channel_gk20a.h" #include "gm20b/hal_gm20b.h"