gpu: nvgpu: Split ctxsw_trace API into non-Linux component

Split the ctxsw trace "core" API code into <nvgpu/ctxsw_trace.h>. This
is not perect though since there's some Linuxisms present in the HAL
and as such that code has to be hidden by the ctxsw tracing CONFIG. But
this patch should work for QNX such that it will allow the code to
build as long as CONFIG_GK20A_CTXSW_TRACE is not set.

Also fix the copywrite notice in the ctxsw code present under
common/linux to be GPL.

JIRA NVGPU-287

Change-Id: I94715864caf335b7220185492e4629d713b025e0
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1589429
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Alex Waterman
2017-10-31 12:21:07 -07:00
committed by mobile promotions
parent 5eedf06bf5
commit 31e594befe
16 changed files with 88 additions and 60 deletions

View File

@@ -1,26 +1,19 @@
/* /*
* Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms and conditions of the GNU General Public License,
* to deal in the Software without restriction, including without limitation * version 2, as published by the Free Software Foundation.
* 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:
* *
* The above copyright notice and this permission notice shall be included in * This program is distributed in the hope it will be useful, but WITHOUT
* all copies or substantial portions of the Software. * 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 * You should have received a copy of the GNU General Public License
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * along with this program. If not, see <http://www.gnu.org/licenses/>.
* 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.
*/ */
#include <asm/barrier.h>
#include <linux/wait.h> #include <linux/wait.h>
#include <linux/ktime.h> #include <linux/ktime.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
@@ -30,7 +23,6 @@
#include "gk20a/gk20a.h" #include "gk20a/gk20a.h"
#include "gk20a/gr_gk20a.h" #include "gk20a/gr_gk20a.h"
#include "gk20a/ctxsw_trace_gk20a.h"
#include "gk20a/platform_gk20a.h" #include "gk20a/platform_gk20a.h"
#include <nvgpu/kmem.h> #include <nvgpu/kmem.h>
@@ -39,6 +31,7 @@
#include <nvgpu/barrier.h> #include <nvgpu/barrier.h>
#include "os_linux.h" #include "os_linux.h"
#include "ctxsw_trace.h"
#include <nvgpu/hw/gk20a/hw_ctxsw_prog_gk20a.h> #include <nvgpu/hw/gk20a/hw_ctxsw_prog_gk20a.h>
#include <nvgpu/hw/gk20a/hw_gr_gk20a.h> #include <nvgpu/hw/gk20a/hw_gr_gk20a.h>

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef __CTXSW_TRACE_H__
#define __CTXSW_TRACE_H__
#include <nvgpu/types.h>
#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__ */

View File

@@ -19,11 +19,12 @@
#include <linux/file.h> #include <linux/file.h>
#include <nvgpu/nvgpu_common.h> #include <nvgpu/nvgpu_common.h>
#include <nvgpu/ctxsw_trace.h>
#include "gk20a/gk20a.h" #include "gk20a/gk20a.h"
#include "gk20a/platform_gk20a.h" #include "gk20a/platform_gk20a.h"
#include "gk20a/dbg_gpu_gk20a.h" #include "gk20a/dbg_gpu_gk20a.h"
#include "gk20a/ctxsw_trace_gk20a.h"
#include "ioctl_channel.h" #include "ioctl_channel.h"
#include "ioctl_ctrl.h" #include "ioctl_ctrl.h"
#include "ioctl_as.h" #include "ioctl_as.h"
@@ -31,6 +32,7 @@
#include "ioctl_dbg.h" #include "ioctl_dbg.h"
#include "module.h" #include "module.h"
#include "os_linux.h" #include "os_linux.h"
#include "ctxsw_trace.h"
#define GK20A_NUM_CDEVS 7 #define GK20A_NUM_CDEVS 7

View File

@@ -31,12 +31,13 @@
#include <nvgpu/enabled.h> #include <nvgpu/enabled.h>
#include "gk20a/gk20a.h" #include "gk20a/gk20a.h"
#include "gk20a/ctxsw_trace_gk20a.h"
#include "gk20a/dbg_gpu_gk20a.h" #include "gk20a/dbg_gpu_gk20a.h"
#include "gk20a/fence_gk20a.h" #include "gk20a/fence_gk20a.h"
#include "gk20a/platform_gk20a.h" #include "gk20a/platform_gk20a.h"
#include "ioctl_channel.h" #include "ioctl_channel.h"
#include "os_linux.h" #include "os_linux.h"
#include "ctxsw_trace.h"
static const char *gr_gk20a_graphics_preempt_mode_name(u32 graphics_preempt_mode) static const char *gr_gk20a_graphics_preempt_mode_name(u32 graphics_preempt_mode)
{ {

View File

@@ -31,12 +31,12 @@
#include <nvgpu/soc.h> #include <nvgpu/soc.h>
#include <nvgpu/enabled.h> #include <nvgpu/enabled.h>
#include <nvgpu/debug.h> #include <nvgpu/debug.h>
#include <nvgpu/ctxsw_trace.h>
#include "gk20a/platform_gk20a.h" #include "gk20a/platform_gk20a.h"
#include "sysfs.h" #include "sysfs.h"
#include "vgpu/vgpu.h" #include "vgpu/vgpu.h"
#include "scale.h" #include "scale.h"
#include "gk20a/ctxsw_trace_gk20a.h"
#include "pci.h" #include "pci.h"
#include "module.h" #include "module.h"
#include "intr.h" #include "intr.h"
@@ -48,9 +48,11 @@
#include "vgpu/vgpu_t19x.h" #include "vgpu/vgpu_t19x.h"
#endif #endif
#endif #endif
#include "os_linux.h" #include "os_linux.h"
#include "cde_gm20b.h" #include "cde_gm20b.h"
#include "cde_gp10b.h" #include "cde_gp10b.h"
#include "ctxsw_trace.h"
#define CLASS_NAME "nvidia-gpu" #define CLASS_NAME "nvidia-gpu"
/* TODO: Change to e.g. "nvidia-gpu%s" once we have symlinks in place. */ /* TODO: Change to e.g. "nvidia-gpu%s" once we have symlinks in place. */

View File

@@ -42,6 +42,7 @@
#include <nvgpu/debug.h> #include <nvgpu/debug.h>
#include <nvgpu/ltc.h> #include <nvgpu/ltc.h>
#include <nvgpu/barrier.h> #include <nvgpu/barrier.h>
#include <nvgpu/ctxsw_trace.h>
/* /*
* This is required for nvgpu_vm_find_buf() which is used in the tracing * This is required for nvgpu_vm_find_buf() which is used in the tracing
@@ -51,7 +52,6 @@
#include <nvgpu/linux/vm.h> #include <nvgpu/linux/vm.h>
#include "gk20a.h" #include "gk20a.h"
#include "ctxsw_trace_gk20a.h"
#include "dbg_gpu_gk20a.h" #include "dbg_gpu_gk20a.h"
#include "fence_gk20a.h" #include "fence_gk20a.h"

View File

@@ -34,8 +34,8 @@
#include <nvgpu/barrier.h> #include <nvgpu/barrier.h>
#include <nvgpu/mm.h> #include <nvgpu/mm.h>
#include <nvgpu/enabled.h> #include <nvgpu/enabled.h>
#include <nvgpu/ctxsw_trace.h>
#include "ctxsw_trace_gk20a.h"
#include "fecs_trace_gk20a.h" #include "fecs_trace_gk20a.h"
#include "gk20a.h" #include "gk20a.h"
#include "gr_gk20a.h" #include "gr_gk20a.h"

View File

@@ -37,9 +37,9 @@
#include <nvgpu/debug.h> #include <nvgpu/debug.h>
#include <nvgpu/nvhost.h> #include <nvgpu/nvhost.h>
#include <nvgpu/barrier.h> #include <nvgpu/barrier.h>
#include <nvgpu/ctxsw_trace.h>
#include "gk20a.h" #include "gk20a.h"
#include "ctxsw_trace_gk20a.h"
#include "mm_gk20a.h" #include "mm_gk20a.h"
#include <nvgpu/hw/gk20a/hw_fifo_gk20a.h> #include <nvgpu/hw/gk20a/hw_fifo_gk20a.h>

View File

@@ -35,13 +35,13 @@
#include <nvgpu/ltc.h> #include <nvgpu/ltc.h>
#include <nvgpu/vidmem.h> #include <nvgpu/vidmem.h>
#include <nvgpu/mm.h> #include <nvgpu/mm.h>
#include <nvgpu/ctxsw_trace.h>
#include <trace/events/gk20a.h> #include <trace/events/gk20a.h>
#include "gk20a.h" #include "gk20a.h"
#include "channel_sync_gk20a.h" #include "channel_sync_gk20a.h"
#include "ctxsw_trace_gk20a.h"
#include "dbg_gpu_gk20a.h" #include "dbg_gpu_gk20a.h"
#include "mc_gk20a.h" #include "mc_gk20a.h"
#include "hal.h" #include "hal.h"

View File

@@ -38,6 +38,7 @@
#include <nvgpu/debug.h> #include <nvgpu/debug.h>
#include <nvgpu/barrier.h> #include <nvgpu/barrier.h>
#include <nvgpu/mm.h> #include <nvgpu/mm.h>
#include <nvgpu/ctxsw_trace.h>
#include "gk20a.h" #include "gk20a.h"
#include "kind_gk20a.h" #include "kind_gk20a.h"
@@ -45,7 +46,7 @@
#include "gr_pri_gk20a.h" #include "gr_pri_gk20a.h"
#include "regops_gk20a.h" #include "regops_gk20a.h"
#include "dbg_gpu_gk20a.h" #include "dbg_gpu_gk20a.h"
#include "ctxsw_trace_gk20a.h"
#include "common/linux/os_linux.h" #include "common/linux/os_linux.h"
#include <nvgpu/hw/gk20a/hw_ccsr_gk20a.h> #include <nvgpu/hw/gk20a/hw_ccsr_gk20a.h>

View File

@@ -24,7 +24,6 @@
#include "gk20a/gk20a.h" #include "gk20a/gk20a.h"
#include "gk20a/fifo_gk20a.h" #include "gk20a/fifo_gk20a.h"
#include "gk20a/ctxsw_trace_gk20a.h"
#include "gk20a/fecs_trace_gk20a.h" #include "gk20a/fecs_trace_gk20a.h"
#include "gk20a/mm_gk20a.h" #include "gk20a/mm_gk20a.h"
#include "gk20a/dbg_gpu_gk20a.h" #include "gk20a/dbg_gpu_gk20a.h"
@@ -87,6 +86,7 @@
#include <nvgpu/bug.h> #include <nvgpu/bug.h>
#include <nvgpu/bus.h> #include <nvgpu/bus.h>
#include <nvgpu/enabled.h> #include <nvgpu/enabled.h>
#include <nvgpu/ctxsw_trace.h>
#include <nvgpu/hw/gp106/hw_proj_gp106.h> #include <nvgpu/hw/gp106/hw_proj_gp106.h>
#include <nvgpu/hw/gp106/hw_fifo_gp106.h> #include <nvgpu/hw/gp106/hw_fifo_gp106.h>

View File

@@ -24,7 +24,6 @@
#include "gk20a/gk20a.h" #include "gk20a/gk20a.h"
#include "gk20a/fifo_gk20a.h" #include "gk20a/fifo_gk20a.h"
#include "gk20a/ctxsw_trace_gk20a.h"
#include "gk20a/fecs_trace_gk20a.h" #include "gk20a/fecs_trace_gk20a.h"
#include "gk20a/mm_gk20a.h" #include "gk20a/mm_gk20a.h"
#include "gk20a/dbg_gpu_gk20a.h" #include "gk20a/dbg_gpu_gk20a.h"
@@ -70,6 +69,7 @@
#include <nvgpu/bug.h> #include <nvgpu/bug.h>
#include <nvgpu/enabled.h> #include <nvgpu/enabled.h>
#include <nvgpu/bus.h> #include <nvgpu/bus.h>
#include <nvgpu/ctxsw_trace.h>
#include <nvgpu/hw/gp10b/hw_proj_gp10b.h> #include <nvgpu/hw/gp10b/hw_proj_gp10b.h>
#include <nvgpu/hw/gp10b/hw_fuse_gp10b.h> #include <nvgpu/hw/gp10b/hw_fuse_gp10b.h>

View File

@@ -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 * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -20,45 +20,34 @@
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
*/ */
#ifndef __CTXSW_TRACE_GK20A_H #ifndef __NVGPU_CTXSW_TRACE_H__
#define __CTXSW_TRACE_GK20A_H #define __NVGPU_CTXSW_TRACE_H__
#include <nvgpu/types.h> #include <nvgpu/types.h>
#define GK20A_CTXSW_TRACE_NUM_DEVS 1
struct file;
struct inode;
struct gk20a; 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 tsg_gk20a;
struct poll_table_struct; struct channel_gk20a;
struct nvgpu_ctxsw_trace_entry;
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);
int gk20a_ctxsw_trace_init(struct gk20a *g); 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); void gk20a_ctxsw_trace_cleanup(struct gk20a *g);
int gk20a_ctxsw_trace_write(struct gk20a *g, int gk20a_ctxsw_trace_write(struct gk20a *g,
struct nvgpu_ctxsw_trace_entry *entry); struct nvgpu_ctxsw_trace_entry *entry);
void gk20a_ctxsw_trace_wake_up(struct gk20a *g, int vmid); void gk20a_ctxsw_trace_wake_up(struct gk20a *g, int vmid);
void gk20a_ctxsw_trace_channel_reset(struct gk20a *g, struct channel_gk20a *ch); #ifdef CONFIG_GK20A_CTXSW_TRACE
void gk20a_ctxsw_trace_tsg_reset(struct gk20a *g, struct tsg_gk20a *tsg); 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

View File

@@ -24,12 +24,14 @@
#include <linux/tegra-ivc.h> #include <linux/tegra-ivc.h>
#include <linux/tegra_vgpu.h> #include <linux/tegra_vgpu.h>
#include <uapi/linux/nvgpu.h>
#include <nvgpu/kmem.h> #include <nvgpu/kmem.h>
#include <nvgpu/bug.h> #include <nvgpu/bug.h>
#include <nvgpu/enabled.h> #include <nvgpu/enabled.h>
#include <nvgpu/ctxsw_trace.h>
#include "gk20a/gk20a.h" #include "gk20a/gk20a.h"
#include "gk20a/ctxsw_trace_gk20a.h"
#include "vgpu.h" #include "vgpu.h"
#include "fecs_trace_vgpu.h" #include "fecs_trace_vgpu.h"

View File

@@ -33,7 +33,6 @@
#include "vgpu/vgpu.h" #include "vgpu/vgpu.h"
#include "vgpu/fifo_vgpu.h" #include "vgpu/fifo_vgpu.h"
#include "gk20a/ctxsw_trace_gk20a.h"
#include <nvgpu/hw/gk20a/hw_fifo_gk20a.h> #include <nvgpu/hw/gk20a/hw_fifo_gk20a.h>
#include <nvgpu/hw/gk20a/hw_ram_gk20a.h> #include <nvgpu/hw/gk20a/hw_ram_gk20a.h>

View File

@@ -34,11 +34,11 @@
#include <nvgpu/debug.h> #include <nvgpu/debug.h>
#include <nvgpu/bus.h> #include <nvgpu/bus.h>
#include <nvgpu/soc.h> #include <nvgpu/soc.h>
#include <nvgpu/ctxsw_trace.h>
#include "vgpu/vgpu.h" #include "vgpu/vgpu.h"
#include "vgpu/fecs_trace_vgpu.h" #include "vgpu/fecs_trace_vgpu.h"
#include "vgpu/clk_vgpu.h" #include "vgpu/clk_vgpu.h"
#include "gk20a/ctxsw_trace_gk20a.h"
#include "gk20a/tsg_gk20a.h" #include "gk20a/tsg_gk20a.h"
#include "gk20a/channel_gk20a.h" #include "gk20a/channel_gk20a.h"
#include "gm20b/hal_gm20b.h" #include "gm20b/hal_gm20b.h"