summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/os_linux.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/os_linux.h')
-rw-r--r--drivers/gpu/nvgpu/common/linux/os_linux.h166
1 files changed, 166 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/os_linux.h b/drivers/gpu/nvgpu/common/linux/os_linux.h
new file mode 100644
index 00000000..07be7edc
--- /dev/null
+++ b/drivers/gpu/nvgpu/common/linux/os_linux.h
@@ -0,0 +1,166 @@
1/*
2 * Copyright (c) 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 NVGPU_OS_LINUX_H
18#define NVGPU_OS_LINUX_H
19
20#include <linux/cdev.h>
21#include <linux/iommu.h>
22
23#ifdef CONFIG_TEGRA_19x_GPU
24#include <nvgpu/linux/os_linux_t19x.h>
25#endif
26#include "gk20a/gk20a.h"
27#include "cde.h"
28#include "sched.h"
29
30struct nvgpu_os_linux_ops {
31 struct {
32 void (*get_program_numbers)(struct gk20a *g,
33 u32 block_height_log2,
34 u32 shader_parameter,
35 int *hprog, int *vprog);
36 bool (*need_scatter_buffer)(struct gk20a *g);
37 int (*populate_scatter_buffer)(struct gk20a *g,
38 struct sg_table *sgt,
39 size_t surface_size,
40 void *scatter_buffer_ptr,
41 size_t scatter_buffer_size);
42 } cde;
43};
44
45struct nvgpu_os_linux {
46 struct gk20a g;
47 struct device *dev;
48
49 struct {
50 struct cdev cdev;
51 struct device *node;
52 } channel;
53
54 struct {
55 struct cdev cdev;
56 struct device *node;
57 } ctrl;
58
59 struct {
60 struct cdev cdev;
61 struct device *node;
62 } as_dev;
63
64 struct {
65 struct cdev cdev;
66 struct device *node;
67 } dbg;
68
69 struct {
70 struct cdev cdev;
71 struct device *node;
72 } prof;
73
74 struct {
75 struct cdev cdev;
76 struct device *node;
77 } tsg;
78
79 struct {
80 struct cdev cdev;
81 struct device *node;
82 } ctxsw;
83
84 struct {
85 struct cdev cdev;
86 struct device *node;
87 } sched;
88
89 dev_t cdev_region;
90
91 struct devfreq *devfreq;
92
93 struct device_dma_parameters dma_parms;
94
95 atomic_t hw_irq_stall_count;
96 atomic_t hw_irq_nonstall_count;
97
98 struct nvgpu_cond sw_irq_stall_last_handled_wq;
99 atomic_t sw_irq_stall_last_handled;
100
101 atomic_t nonstall_ops;
102
103 struct nvgpu_cond sw_irq_nonstall_last_handled_wq;
104 atomic_t sw_irq_nonstall_last_handled;
105
106 struct work_struct nonstall_fn_work;
107 struct workqueue_struct *nonstall_work_queue;
108
109 struct resource *reg_mem;
110 void __iomem *regs;
111 void __iomem *regs_saved;
112
113 struct resource *bar1_mem;
114 void __iomem *bar1;
115 void __iomem *bar1_saved;
116
117#ifdef CONFIG_TEGRA_19x_GPU
118 struct nvgpu_os_linux_t19x t19x;
119#endif
120
121 struct nvgpu_os_linux_ops ops;
122
123#ifdef CONFIG_DEBUG_FS
124 struct dentry *debugfs;
125 struct dentry *debugfs_alias;
126
127 struct dentry *debugfs_ltc_enabled;
128 struct dentry *debugfs_timeouts_enabled;
129 struct dentry *debugfs_gr_idle_timeout_default;
130 struct dentry *debugfs_bypass_smmu;
131 struct dentry *debugfs_disable_bigpage;
132 struct dentry *debugfs_gr_default_attrib_cb_size;
133
134 struct dentry *debugfs_timeslice_low_priority_us;
135 struct dentry *debugfs_timeslice_medium_priority_us;
136 struct dentry *debugfs_timeslice_high_priority_us;
137 struct dentry *debugfs_runlist_interleave;
138 struct dentry *debugfs_allocators;
139 struct dentry *debugfs_xve;
140 struct dentry *debugfs_kmem;
141 struct dentry *debugfs_hal;
142
143 struct dentry *debugfs_force_preemption_cilp;
144 struct dentry *debugfs_force_preemption_gfxp;
145 struct dentry *debugfs_dump_ctxsw_stats;
146#endif
147 struct gk20a_cde_app cde_app;
148
149 struct rw_semaphore busy_lock;
150
151 struct gk20a_sched_ctrl sched_ctrl;
152};
153
154static inline struct nvgpu_os_linux *nvgpu_os_linux_from_gk20a(struct gk20a *g)
155{
156 return container_of(g, struct nvgpu_os_linux, g);
157}
158
159static inline struct device *dev_from_gk20a(struct gk20a *g)
160{
161 return nvgpu_os_linux_from_gk20a(g)->dev;
162}
163
164#define INTERFACE_NAME "nvhost%s-gpu"
165
166#endif