gpu: nvgpu: rearrange linux specific fecs trace support

We have 3 header files for FECS tracing support
include/nvgpu/gr/fecs_trace.h : common header
include/nvgpu/ctxsw_trace.h : header that includes both common and
                              os-specific functions
os/linux/ctxsw_trace.h : linux specific header

Remove the second header since it is not needed.

Move all structures that are needed in common code to
include/nvgpu/gr/fecs_trace.h
Move all function declarations that are needed in common code to
include/nvgpu/gr/fecs_trace.h
Move all linux specific declarations in os/linux/ctxsw_trace.h and
rename this file as os/linux/fecs_trace_linux.h

Also rename os/linux/ctxsw_trace.c to os/linux/fecs_trace_linux.c

Jira NVGPU-1880

Change-Id: I05cc4489c4b6a64880b7d59c02b22cd2244d5e22
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2070766
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Deepak Nibade
2019-03-07 16:31:03 +05:30
committed by mobile promotions
parent bbb0caa42c
commit 1208ad7cef
21 changed files with 77 additions and 112 deletions

View File

@@ -1,39 +0,0 @@
/*
* 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

@@ -20,7 +20,6 @@
#include <linux/poll.h>
#include <trace/events/gk20a.h>
#include <uapi/linux/nvgpu.h>
#include <nvgpu/ctxsw_trace.h>
#include <nvgpu/kmem.h>
#include <nvgpu/log.h>
#include <nvgpu/atomic.h>
@@ -34,7 +33,7 @@
#include "platform_gk20a.h"
#include "os_linux.h"
#include "ctxsw_trace.h"
#include "fecs_trace_linux.h"
#include <nvgpu/hw/gk20a/hw_gr_gk20a.h>
@@ -77,8 +76,9 @@ static inline int ring_len(struct nvgpu_ctxsw_ring_header *hdr)
return (hdr->write_idx - hdr->read_idx) % hdr->num_ents;
}
static void nvgpu_set_ctxsw_trace_entry(struct nvgpu_ctxsw_trace_entry *entry_dst,
struct nvgpu_gpu_ctxsw_trace_entry *entry_src)
static void nvgpu_set_ctxsw_trace_entry(
struct nvgpu_ctxsw_trace_entry *entry_dst,
struct nvgpu_gpu_ctxsw_trace_entry *entry_src)
{
entry_dst->tag = entry_src->tag;
entry_dst->vmid = entry_src->vmid;
@@ -119,7 +119,8 @@ ssize_t gk20a_ctxsw_dev_read(struct file *filp, char __user *buf, size_t size,
if (ring_is_empty(hdr))
break;
nvgpu_set_ctxsw_trace_entry(&user_entry, &dev->ents[hdr->read_idx]);
nvgpu_set_ctxsw_trace_entry(&user_entry,
&dev->ents[hdr->read_idx]);
if (copy_to_user(entry, &user_entry,
sizeof(*entry))) {
nvgpu_mutex_release(&dev->write_lock);
@@ -250,14 +251,16 @@ static int gk20a_ctxsw_dev_ioctl_ring_setup(struct gk20a_ctxsw_dev *dev,
return ret;
}
static void nvgpu_set_ctxsw_trace_filter_args(struct nvgpu_gpu_ctxsw_trace_filter *filter_dst,
struct nvgpu_ctxsw_trace_filter *filter_src)
static void nvgpu_set_ctxsw_trace_filter_args(
struct nvgpu_gpu_ctxsw_trace_filter *filter_dst,
struct nvgpu_ctxsw_trace_filter *filter_src)
{
nvgpu_memcpy((u8 *)filter_dst->tag_bits, (u8 *)filter_src->tag_bits,
(NVGPU_CTXSW_FILTER_SIZE + 63) / 64);
}
static void nvgpu_get_ctxsw_trace_filter_args(struct nvgpu_ctxsw_trace_filter *filter_dst,
static void nvgpu_get_ctxsw_trace_filter_args(
struct nvgpu_ctxsw_trace_filter *filter_dst,
struct nvgpu_gpu_ctxsw_trace_filter *filter_src)
{
nvgpu_memcpy((u8 *)filter_dst->tag_bits, (u8 *)filter_src->tag_bits,

View File

@@ -0,0 +1,52 @@
/*
* Copyright (c) 2017-2019, 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:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* 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.
*/
#ifndef NVGPU_FECS_TRACE_LINUX_H
#define NVGPU_FECS_TRACE_LINUX_H
#include <nvgpu/types.h>
#define GK20A_CTXSW_TRACE_NUM_DEVS 1
struct file;
struct inode;
struct gk20a;
struct tsg_gk20a;
struct channel_gk20a;
struct vm_area_struct;
struct poll_table_struct;
int gk20a_ctxsw_trace_init(struct gk20a *g);
void gk20a_ctxsw_trace_cleanup(struct gk20a *g);
int gk20a_ctxsw_dev_mmap(struct file *filp, struct vm_area_struct *vma);
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 /*NVGPU_FECS_TRACE_LINUX_H */

View File

@@ -1,7 +1,7 @@
/*
* NVGPU IOCTLs
*
* Copyright (c) 2011-2018, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2011-2019, 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,
@@ -19,7 +19,6 @@
#include <linux/file.h>
#include <nvgpu/nvgpu_common.h>
#include <nvgpu/ctxsw_trace.h>
#include <nvgpu/gk20a.h>
#include "ioctl_channel.h"
@@ -29,7 +28,7 @@
#include "ioctl_dbg.h"
#include "module.h"
#include "os_linux.h"
#include "ctxsw_trace.h"
#include "fecs_trace_linux.h"
#include "platform_gk20a.h"
#define GK20A_NUM_CDEVS 7

View File

@@ -47,7 +47,6 @@
#include "ioctl_channel.h"
#include "channel.h"
#include "os_linux.h"
#include "ctxsw_trace.h"
/* the minimal size of client buffer */
#define CSS_MIN_CLIENT_SNAPSHOT_SIZE \

View File

@@ -42,7 +42,6 @@
#include <nvgpu/soc.h>
#include <nvgpu/enabled.h>
#include <nvgpu/debug.h>
#include <nvgpu/ctxsw_trace.h>
#include <nvgpu/vidmem.h>
#include <nvgpu/sim.h>
#include <nvgpu/clk_arb.h>
@@ -63,7 +62,7 @@
#include "os_linux.h"
#include "os_ops.h"
#include "ctxsw_trace.h"
#include "fecs_trace_linux.h"
#include "driver_common.h"
#include "channel.h"
#include "debug_pmgr.h"

View File

@@ -14,10 +14,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <nvgpu/ctxsw_trace.h>
#include <nvgpu/vgpu/tegra_vgpu.h>
#include <nvgpu/vgpu/vgpu_ivm.h>
#include <nvgpu/gk20a.h>
#include <nvgpu/gr/fecs_trace.h>
#include <linux/mm.h>

View File

@@ -29,7 +29,6 @@
#include <nvgpu/enabled.h>
#include <nvgpu/debug.h>
#include <nvgpu/soc.h>
#include <nvgpu/ctxsw_trace.h>
#include <nvgpu/defaults.h>
#include <nvgpu/ltc.h>
#include <nvgpu/channel.h>