diff options
author | Alex Waterman <alexw@nvidia.com> | 2017-10-31 15:21:07 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-11-01 23:15:47 -0400 |
commit | 31e594befefe63d430885e340175b3f9549b8cc4 (patch) | |
tree | c3f2e879ec1e314d68aa455d37f5965edde26456 /drivers/gpu/nvgpu/common/linux | |
parent | 5eedf06bf56489bc559a08347f60a7680ccd6897 (diff) |
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>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ctxsw_trace.c | 27 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ctxsw_trace.h | 39 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ioctl.c | 4 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ioctl_channel.c | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/module.c | 4 |
5 files changed, 57 insertions, 20 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/ctxsw_trace.c b/drivers/gpu/nvgpu/common/linux/ctxsw_trace.c index 81a54b7e..a4a07a4c 100644 --- a/drivers/gpu/nvgpu/common/linux/ctxsw_trace.c +++ b/drivers/gpu/nvgpu/common/linux/ctxsw_trace.c | |||
@@ -1,26 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * Permission is hereby granted, free of charge, to any person obtaining a | 4 | * This program is free software; you can redistribute it and/or modify it |
5 | * copy of this software and associated documentation files (the "Software"), | 5 | * under the terms and conditions of the GNU General Public License, |
6 | * to deal in the Software without restriction, including without limitation | 6 | * version 2, as published by the Free Software Foundation. |
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | 7 | * |
11 | * The above copyright notice and this permission notice shall be included in | 8 | * This program is distributed in the hope it will be useful, but WITHOUT |
12 | * all copies or substantial portions of the Software. | 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
13 | * | 12 | * |
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 13 | * You should have received a copy of the GNU General Public License |
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
20 | * DEALINGS IN THE SOFTWARE. | ||
21 | */ | 15 | */ |
22 | 16 | ||
23 | #include <asm/barrier.h> | ||
24 | #include <linux/wait.h> | 17 | #include <linux/wait.h> |
25 | #include <linux/ktime.h> | 18 | #include <linux/ktime.h> |
26 | #include <linux/uaccess.h> | 19 | #include <linux/uaccess.h> |
@@ -30,7 +23,6 @@ | |||
30 | 23 | ||
31 | #include "gk20a/gk20a.h" | 24 | #include "gk20a/gk20a.h" |
32 | #include "gk20a/gr_gk20a.h" | 25 | #include "gk20a/gr_gk20a.h" |
33 | #include "gk20a/ctxsw_trace_gk20a.h" | ||
34 | #include "gk20a/platform_gk20a.h" | 26 | #include "gk20a/platform_gk20a.h" |
35 | 27 | ||
36 | #include <nvgpu/kmem.h> | 28 | #include <nvgpu/kmem.h> |
@@ -39,6 +31,7 @@ | |||
39 | #include <nvgpu/barrier.h> | 31 | #include <nvgpu/barrier.h> |
40 | 32 | ||
41 | #include "os_linux.h" | 33 | #include "os_linux.h" |
34 | #include "ctxsw_trace.h" | ||
42 | 35 | ||
43 | #include <nvgpu/hw/gk20a/hw_ctxsw_prog_gk20a.h> | 36 | #include <nvgpu/hw/gk20a/hw_ctxsw_prog_gk20a.h> |
44 | #include <nvgpu/hw/gk20a/hw_gr_gk20a.h> | 37 | #include <nvgpu/hw/gk20a/hw_gr_gk20a.h> |
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 00000000..88ca7f25 --- /dev/null +++ b/drivers/gpu/nvgpu/common/linux/ctxsw_trace.h | |||
@@ -0,0 +1,39 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #ifndef __CTXSW_TRACE_H__ | ||
18 | #define __CTXSW_TRACE_H__ | ||
19 | |||
20 | #include <nvgpu/types.h> | ||
21 | |||
22 | #define GK20A_CTXSW_TRACE_NUM_DEVS 1 | ||
23 | |||
24 | struct file; | ||
25 | struct inode; | ||
26 | struct poll_table_struct; | ||
27 | |||
28 | struct gk20a; | ||
29 | |||
30 | int gk20a_ctxsw_dev_release(struct inode *inode, struct file *filp); | ||
31 | int gk20a_ctxsw_dev_open(struct inode *inode, struct file *filp); | ||
32 | long gk20a_ctxsw_dev_ioctl(struct file *filp, | ||
33 | unsigned int cmd, unsigned long arg); | ||
34 | ssize_t gk20a_ctxsw_dev_read(struct file *filp, char __user *buf, | ||
35 | size_t size, loff_t *offs); | ||
36 | unsigned int gk20a_ctxsw_dev_poll(struct file *filp, | ||
37 | struct poll_table_struct *pts); | ||
38 | |||
39 | #endif /* __CTXSW_TRACE_H__ */ | ||
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl.c b/drivers/gpu/nvgpu/common/linux/ioctl.c index 7e6df9df..c1053268 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl.c | |||
@@ -19,11 +19,12 @@ | |||
19 | #include <linux/file.h> | 19 | #include <linux/file.h> |
20 | 20 | ||
21 | #include <nvgpu/nvgpu_common.h> | 21 | #include <nvgpu/nvgpu_common.h> |
22 | #include <nvgpu/ctxsw_trace.h> | ||
22 | 23 | ||
23 | #include "gk20a/gk20a.h" | 24 | #include "gk20a/gk20a.h" |
24 | #include "gk20a/platform_gk20a.h" | 25 | #include "gk20a/platform_gk20a.h" |
25 | #include "gk20a/dbg_gpu_gk20a.h" | 26 | #include "gk20a/dbg_gpu_gk20a.h" |
26 | #include "gk20a/ctxsw_trace_gk20a.h" | 27 | |
27 | #include "ioctl_channel.h" | 28 | #include "ioctl_channel.h" |
28 | #include "ioctl_ctrl.h" | 29 | #include "ioctl_ctrl.h" |
29 | #include "ioctl_as.h" | 30 | #include "ioctl_as.h" |
@@ -31,6 +32,7 @@ | |||
31 | #include "ioctl_dbg.h" | 32 | #include "ioctl_dbg.h" |
32 | #include "module.h" | 33 | #include "module.h" |
33 | #include "os_linux.h" | 34 | #include "os_linux.h" |
35 | #include "ctxsw_trace.h" | ||
34 | 36 | ||
35 | #define GK20A_NUM_CDEVS 7 | 37 | #define GK20A_NUM_CDEVS 7 |
36 | 38 | ||
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c index 7814aea5..91dfc630 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c | |||
@@ -31,12 +31,13 @@ | |||
31 | #include <nvgpu/enabled.h> | 31 | #include <nvgpu/enabled.h> |
32 | 32 | ||
33 | #include "gk20a/gk20a.h" | 33 | #include "gk20a/gk20a.h" |
34 | #include "gk20a/ctxsw_trace_gk20a.h" | ||
35 | #include "gk20a/dbg_gpu_gk20a.h" | 34 | #include "gk20a/dbg_gpu_gk20a.h" |
36 | #include "gk20a/fence_gk20a.h" | 35 | #include "gk20a/fence_gk20a.h" |
37 | #include "gk20a/platform_gk20a.h" | 36 | #include "gk20a/platform_gk20a.h" |
37 | |||
38 | #include "ioctl_channel.h" | 38 | #include "ioctl_channel.h" |
39 | #include "os_linux.h" | 39 | #include "os_linux.h" |
40 | #include "ctxsw_trace.h" | ||
40 | 41 | ||
41 | static const char *gr_gk20a_graphics_preempt_mode_name(u32 graphics_preempt_mode) | 42 | static const char *gr_gk20a_graphics_preempt_mode_name(u32 graphics_preempt_mode) |
42 | { | 43 | { |
diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c index d0abc836..b06f86ab 100644 --- a/drivers/gpu/nvgpu/common/linux/module.c +++ b/drivers/gpu/nvgpu/common/linux/module.c | |||
@@ -31,12 +31,12 @@ | |||
31 | #include <nvgpu/soc.h> | 31 | #include <nvgpu/soc.h> |
32 | #include <nvgpu/enabled.h> | 32 | #include <nvgpu/enabled.h> |
33 | #include <nvgpu/debug.h> | 33 | #include <nvgpu/debug.h> |
34 | #include <nvgpu/ctxsw_trace.h> | ||
34 | 35 | ||
35 | #include "gk20a/platform_gk20a.h" | 36 | #include "gk20a/platform_gk20a.h" |
36 | #include "sysfs.h" | 37 | #include "sysfs.h" |
37 | #include "vgpu/vgpu.h" | 38 | #include "vgpu/vgpu.h" |
38 | #include "scale.h" | 39 | #include "scale.h" |
39 | #include "gk20a/ctxsw_trace_gk20a.h" | ||
40 | #include "pci.h" | 40 | #include "pci.h" |
41 | #include "module.h" | 41 | #include "module.h" |
42 | #include "intr.h" | 42 | #include "intr.h" |
@@ -48,9 +48,11 @@ | |||
48 | #include "vgpu/vgpu_t19x.h" | 48 | #include "vgpu/vgpu_t19x.h" |
49 | #endif | 49 | #endif |
50 | #endif | 50 | #endif |
51 | |||
51 | #include "os_linux.h" | 52 | #include "os_linux.h" |
52 | #include "cde_gm20b.h" | 53 | #include "cde_gm20b.h" |
53 | #include "cde_gp10b.h" | 54 | #include "cde_gp10b.h" |
55 | #include "ctxsw_trace.h" | ||
54 | 56 | ||
55 | #define CLASS_NAME "nvidia-gpu" | 57 | #define CLASS_NAME "nvidia-gpu" |
56 | /* TODO: Change to e.g. "nvidia-gpu%s" once we have symlinks in place. */ | 58 | /* TODO: Change to e.g. "nvidia-gpu%s" once we have symlinks in place. */ |