diff options
author | Arto Merilainen <amerilainen@nvidia.com> | 2014-03-19 03:38:25 -0400 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-03-18 15:08:53 -0400 |
commit | a9785995d5f22aaeb659285f8aeb64d8b56982e0 (patch) | |
tree | cc75f75bcf43db316a002a7a240b81f299bf6d7f /drivers/gpu/nvgpu/gk20a/fifo_gk20a.h | |
parent | 61efaf843c22b85424036ec98015121c08f5f16c (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/fifo_gk20a.h')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fifo_gk20a.h | 164 |
1 files changed, 164 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h new file mode 100644 index 00000000..051acda2 --- /dev/null +++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h | |||
@@ -0,0 +1,164 @@ | |||
1 | /* | ||
2 | * drivers/video/tegra/host/gk20a/fifo_gk20a.h | ||
3 | * | ||
4 | * GK20A graphics fifo (gr host) | ||
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 __FIFO_GK20A_H__ | ||
22 | #define __FIFO_GK20A_H__ | ||
23 | |||
24 | #include "channel_gk20a.h" | ||
25 | |||
26 | #define MAX_RUNLIST_BUFFERS 2 | ||
27 | |||
28 | /* generally corresponds to the "pbdma" engine */ | ||
29 | |||
30 | struct fifo_runlist_info_gk20a { | ||
31 | unsigned long *active_channels; | ||
32 | /* Each engine has its own SW and HW runlist buffer.*/ | ||
33 | struct runlist_mem_desc mem[MAX_RUNLIST_BUFFERS]; | ||
34 | u32 cur_buffer; | ||
35 | u32 total_entries; | ||
36 | bool stopped; | ||
37 | bool support_tsg; | ||
38 | struct mutex mutex; /* protect channel preempt and runlist upate */ | ||
39 | wait_queue_head_t runlist_wq; | ||
40 | }; | ||
41 | |||
42 | /* so far gk20a has two engines: gr and ce2(gr_copy) */ | ||
43 | enum { | ||
44 | ENGINE_GR_GK20A = 0, | ||
45 | ENGINE_CE2_GK20A = 1, | ||
46 | ENGINE_INVAL_GK20A | ||
47 | }; | ||
48 | |||
49 | struct fifo_pbdma_exception_info_gk20a { | ||
50 | u32 status_r; /* raw register value from hardware */ | ||
51 | u32 id, next_id; | ||
52 | u32 chan_status_v; /* raw value from hardware */ | ||
53 | bool id_is_chid, next_id_is_chid; | ||
54 | bool chsw_in_progress; | ||
55 | }; | ||
56 | |||
57 | struct fifo_engine_exception_info_gk20a { | ||
58 | u32 status_r; /* raw register value from hardware */ | ||
59 | u32 id, next_id; | ||
60 | u32 ctx_status_v; /* raw value from hardware */ | ||
61 | bool id_is_chid, next_id_is_chid; | ||
62 | bool faulted, idle, ctxsw_in_progress; | ||
63 | }; | ||
64 | |||
65 | struct fifo_mmu_fault_info_gk20a { | ||
66 | u32 fault_info_v; | ||
67 | u32 fault_type_v; | ||
68 | u32 engine_subid_v; | ||
69 | u32 client_v; | ||
70 | u32 fault_hi_v; | ||
71 | u32 fault_lo_v; | ||
72 | u64 inst_ptr; | ||
73 | const char *fault_type_desc; | ||
74 | const char *engine_subid_desc; | ||
75 | const char *client_desc; | ||
76 | }; | ||
77 | |||
78 | struct fifo_engine_info_gk20a { | ||
79 | u32 sw_id; | ||
80 | const char *name; | ||
81 | u32 dev_info_id; | ||
82 | u32 engine_id; | ||
83 | u32 runlist_id; | ||
84 | u32 pbdma_id; | ||
85 | u32 mmu_fault_id; | ||
86 | u32 rc_mask; | ||
87 | struct fifo_pbdma_exception_info_gk20a pbdma_exception_info; | ||
88 | struct fifo_engine_exception_info_gk20a engine_exception_info; | ||
89 | struct fifo_mmu_fault_info_gk20a mmu_fault_info; | ||
90 | |||
91 | }; | ||
92 | |||
93 | struct fifo_gk20a { | ||
94 | struct gk20a *g; | ||
95 | int num_channels; | ||
96 | |||
97 | int num_pbdma; | ||
98 | u32 *pbdma_map; | ||
99 | |||
100 | struct fifo_engine_info_gk20a *engine_info; | ||
101 | u32 max_engines; | ||
102 | u32 num_engines; | ||
103 | |||
104 | struct fifo_runlist_info_gk20a *runlist_info; | ||
105 | u32 max_runlists; | ||
106 | |||
107 | struct userd_desc userd; | ||
108 | u32 userd_entry_size; | ||
109 | u32 userd_total_size; | ||
110 | |||
111 | struct channel_gk20a *channel; | ||
112 | struct mutex ch_inuse_mutex; /* protect unused chid look up */ | ||
113 | |||
114 | void (*remove_support)(struct fifo_gk20a *); | ||
115 | bool sw_ready; | ||
116 | struct { | ||
117 | /* share info between isrs and non-isr code */ | ||
118 | struct { | ||
119 | struct mutex mutex; | ||
120 | } isr; | ||
121 | struct { | ||
122 | u32 device_fatal_0; | ||
123 | u32 channel_fatal_0; | ||
124 | u32 restartable_0; | ||
125 | } pbdma; | ||
126 | struct { | ||
127 | |||
128 | } engine; | ||
129 | |||
130 | |||
131 | } intr; | ||
132 | |||
133 | u32 mmu_fault_engines; | ||
134 | bool deferred_reset_pending; | ||
135 | struct mutex deferred_reset_mutex; | ||
136 | |||
137 | struct work_struct fault_restore_thread; | ||
138 | }; | ||
139 | |||
140 | int gk20a_init_fifo_support(struct gk20a *g); | ||
141 | |||
142 | void gk20a_fifo_isr(struct gk20a *g); | ||
143 | void gk20a_fifo_nonstall_isr(struct gk20a *g); | ||
144 | |||
145 | int gk20a_fifo_preempt_channel(struct gk20a *g, u32 hw_chid); | ||
146 | |||
147 | int gk20a_fifo_enable_engine_activity(struct gk20a *g, | ||
148 | struct fifo_engine_info_gk20a *eng_info); | ||
149 | int gk20a_fifo_disable_engine_activity(struct gk20a *g, | ||
150 | struct fifo_engine_info_gk20a *eng_info, | ||
151 | bool wait_for_idle); | ||
152 | |||
153 | int gk20a_fifo_update_runlist(struct gk20a *g, u32 engine_id, u32 hw_chid, | ||
154 | bool add, bool wait_for_finish); | ||
155 | |||
156 | int gk20a_fifo_suspend(struct gk20a *g); | ||
157 | |||
158 | bool gk20a_fifo_mmu_fault_pending(struct gk20a *g); | ||
159 | void gk20a_fifo_recover(struct gk20a *g, u32 engine_ids, bool verbose); | ||
160 | int gk20a_init_fifo_reset_enable_hw(struct gk20a *g); | ||
161 | |||
162 | void fifo_gk20a_finish_mmu_fault_handling(struct gk20a *g, | ||
163 | unsigned long fault_id); | ||
164 | #endif /*__GR_GK20A_H__*/ | ||