summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
diff options
context:
space:
mode:
authorArto Merilainen <amerilainen@nvidia.com>2014-03-19 03:38:25 -0400
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:08:53 -0400
commita9785995d5f22aaeb659285f8aeb64d8b56982e0 (patch)
treecc75f75bcf43db316a002a7a240b81f299bf6d7f /drivers/gpu/nvgpu/gk20a/channel_gk20a.h
parent61efaf843c22b85424036ec98015121c08f5f16c (diff)
gpu: nvgpu: Add NVIDIA GPU Driver
This patch moves the NVIDIA GPU driver to a new location. Bug 1482562 Change-Id: I24293810b9d0f1504fd9be00135e21dad656ccb6 Signed-off-by: Arto Merilainen <amerilainen@nvidia.com> Reviewed-on: http://git-master/r/383722 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/channel_gk20a.h')
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.h172
1 files changed, 172 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
new file mode 100644
index 00000000..429db85d
--- /dev/null
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
@@ -0,0 +1,172 @@
1/*
2 * drivers/video/tegra/host/gk20a/channel_gk20a.h
3 *
4 * GK20A graphics channel
5 *
6 * Copyright (c) 2011-2014, NVIDIA CORPORATION. All rights reserved.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License,
10 * version 2, as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
20 */
21#ifndef __CHANNEL_GK20A_H__
22#define __CHANNEL_GK20A_H__
23
24#include <linux/log2.h>
25#include <linux/slab.h>
26#include <linux/wait.h>
27#include <linux/mutex.h>
28#include <linux/nvhost_ioctl.h>
29struct gk20a;
30struct gr_gk20a;
31struct dbg_session_gk20a;
32
33#include "channel_sync_gk20a.h"
34
35#include "mm_gk20a.h"
36#include "gr_gk20a.h"
37
38struct gpfifo {
39 u32 entry0;
40 u32 entry1;
41};
42
43struct notification {
44 struct {
45 u32 nanoseconds[2];
46 } timestamp;
47 u32 info32;
48 u16 info16;
49 u16 status;
50};
51
52struct fence {
53 u32 hw_chid;
54 u32 syncpt_val;
55};
56
57/* contexts associated with a channel */
58struct channel_ctx_gk20a {
59 struct gr_ctx_desc gr_ctx;
60 struct pm_ctx_desc pm_ctx;
61 struct patch_desc patch_ctx;
62 struct zcull_ctx_desc zcull_ctx;
63 u64 global_ctx_buffer_va[NR_GLOBAL_CTX_BUF_VA];
64 u64 global_ctx_buffer_size[NR_GLOBAL_CTX_BUF_VA];
65 bool global_ctx_buffer_mapped;
66};
67
68struct channel_gk20a_job {
69 struct mapped_buffer_node **mapped_buffers;
70 int num_mapped_buffers;
71 struct gk20a_channel_fence fence;
72 struct list_head list;
73};
74
75/* this is the priv element of struct nvhost_channel */
76struct channel_gk20a {
77 struct gk20a *g;
78 bool in_use;
79 int hw_chid;
80 bool bound;
81 bool first_init;
82 bool vpr;
83 pid_t pid;
84
85 struct list_head jobs;
86 struct mutex jobs_lock;
87
88 struct vm_gk20a *vm;
89
90 struct gpfifo_desc gpfifo;
91
92 struct channel_ctx_gk20a ch_ctx;
93
94 struct inst_desc inst_block;
95 struct mem_desc_sub ramfc;
96
97 void *userd_cpu_va;
98 u64 userd_iova;
99 u64 userd_gpu_va;
100
101 s32 num_objects;
102 u32 obj_class; /* we support only one obj per channel */
103
104 struct priv_cmd_queue priv_cmd_q;
105
106 wait_queue_head_t notifier_wq;
107 wait_queue_head_t semaphore_wq;
108 wait_queue_head_t submit_wq;
109
110 u32 timeout_accumulated_ms;
111 u32 timeout_gpfifo_get;
112
113 bool cmds_pending;
114 struct gk20a_channel_fence last_submit_fence;
115
116 void (*remove_support)(struct channel_gk20a *);
117#if defined(CONFIG_GK20A_CYCLE_STATS)
118 struct {
119 void *cyclestate_buffer;
120 u32 cyclestate_buffer_size;
121 struct dma_buf *cyclestate_buffer_handler;
122 struct mutex cyclestate_buffer_mutex;
123 } cyclestate;
124#endif
125 struct mutex dbg_s_lock;
126 struct list_head dbg_s_list;
127
128 bool has_timedout;
129 u32 timeout_ms_max;
130 bool timeout_debug_dump;
131
132 struct dma_buf *error_notifier_ref;
133 struct nvhost_notification *error_notifier;
134 void *error_notifier_va;
135
136 struct gk20a_channel_sync *sync;
137};
138
139static inline bool gk20a_channel_as_bound(struct channel_gk20a *ch)
140{
141 return !!ch->vm;
142}
143int channel_gk20a_commit_va(struct channel_gk20a *c);
144int gk20a_init_channel_support(struct gk20a *, u32 chid);
145void gk20a_free_channel(struct channel_gk20a *ch, bool finish);
146bool gk20a_channel_update_and_check_timeout(struct channel_gk20a *ch,
147 u32 timeout_delta_ms);
148void gk20a_disable_channel(struct channel_gk20a *ch,
149 bool wait_for_finish,
150 unsigned long finish_timeout);
151void gk20a_disable_channel_no_update(struct channel_gk20a *ch);
152int gk20a_channel_finish(struct channel_gk20a *ch, unsigned long timeout);
153void gk20a_set_error_notifier(struct channel_gk20a *ch, __u32 error);
154void gk20a_channel_semaphore_wakeup(struct gk20a *g);
155int gk20a_channel_alloc_priv_cmdbuf(struct channel_gk20a *c, u32 size,
156 struct priv_cmd_entry **entry);
157
158int gk20a_channel_suspend(struct gk20a *g);
159int gk20a_channel_resume(struct gk20a *g);
160
161/* Channel file operations */
162int gk20a_channel_open(struct inode *inode, struct file *filp);
163long gk20a_channel_ioctl(struct file *filp,
164 unsigned int cmd,
165 unsigned long arg);
166int gk20a_channel_release(struct inode *inode, struct file *filp);
167struct channel_gk20a *gk20a_get_channel_from_file(int fd);
168void gk20a_channel_update(struct channel_gk20a *c, int nr_completed);
169
170void gk20a_init_fifo(struct gpu_ops *gops);
171
172#endif /*__CHANNEL_GK20A_H__*/