diff options
Diffstat (limited to 'drivers/gpu/nvgpu/include')
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/clk_arb.h | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/clk_arb.h b/drivers/gpu/nvgpu/include/nvgpu/clk_arb.h index a5f8a7d5..c9a32cf1 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/clk_arb.h +++ b/drivers/gpu/nvgpu/include/nvgpu/clk_arb.h | |||
@@ -151,6 +151,126 @@ struct nvgpu_clk_arb_target { | |||
151 | u32 pstate; | 151 | u32 pstate; |
152 | }; | 152 | }; |
153 | 153 | ||
154 | enum clk_arb_work_item_type { | ||
155 | CLK_ARB_WORK_UPDATE_VF_TABLE, | ||
156 | CLK_ARB_WORK_UPDATE_ARB | ||
157 | }; | ||
158 | |||
159 | struct nvgpu_clk_arb_work_item { | ||
160 | enum clk_arb_work_item_type item_type; | ||
161 | struct nvgpu_clk_arb *arb; | ||
162 | struct nvgpu_list_node worker_item; | ||
163 | }; | ||
164 | |||
165 | struct nvgpu_clk_arb { | ||
166 | struct nvgpu_spinlock sessions_lock; | ||
167 | struct nvgpu_spinlock users_lock; | ||
168 | struct nvgpu_spinlock requests_lock; | ||
169 | |||
170 | struct nvgpu_mutex pstate_lock; | ||
171 | struct nvgpu_list_node users; | ||
172 | struct nvgpu_list_node sessions; | ||
173 | struct nvgpu_list_node requests; | ||
174 | |||
175 | struct gk20a *g; | ||
176 | int status; | ||
177 | |||
178 | struct nvgpu_clk_arb_target actual_pool[2]; | ||
179 | struct nvgpu_clk_arb_target *actual; | ||
180 | |||
181 | u16 gpc2clk_default_mhz; | ||
182 | u16 mclk_default_mhz; | ||
183 | u32 voltuv_actual; | ||
184 | |||
185 | u16 gpc2clk_min, gpc2clk_max; | ||
186 | u16 mclk_min, mclk_max; | ||
187 | |||
188 | struct nvgpu_clk_arb_work_item update_vf_table_work_item; | ||
189 | struct nvgpu_clk_arb_work_item update_arb_work_item; | ||
190 | |||
191 | struct nvgpu_cond request_wq; | ||
192 | |||
193 | struct nvgpu_clk_vf_table *current_vf_table; | ||
194 | struct nvgpu_clk_vf_table vf_table_pool[2]; | ||
195 | u32 vf_table_index; | ||
196 | |||
197 | u16 *mclk_f_points; | ||
198 | nvgpu_atomic_t req_nr; | ||
199 | |||
200 | u32 mclk_f_numpoints; | ||
201 | u16 *gpc2clk_f_points; | ||
202 | u32 gpc2clk_f_numpoints; | ||
203 | |||
204 | nvgpu_atomic64_t alarm_mask; | ||
205 | struct nvgpu_clk_notification_queue notification_queue; | ||
206 | |||
207 | #ifdef CONFIG_DEBUG_FS | ||
208 | struct nvgpu_clk_arb_debug debug_pool[2]; | ||
209 | struct nvgpu_clk_arb_debug *debug; | ||
210 | bool debugfs_set; | ||
211 | #endif | ||
212 | }; | ||
213 | |||
214 | struct nvgpu_clk_dev { | ||
215 | struct nvgpu_clk_session *session; | ||
216 | union { | ||
217 | struct nvgpu_list_node link; | ||
218 | struct nvgpu_list_node node; | ||
219 | }; | ||
220 | struct nvgpu_cond readout_wq; | ||
221 | nvgpu_atomic_t poll_mask; | ||
222 | u16 gpc2clk_target_mhz; | ||
223 | u16 mclk_target_mhz; | ||
224 | u32 alarms_reported; | ||
225 | nvgpu_atomic_t enabled_mask; | ||
226 | struct nvgpu_clk_notification_queue queue; | ||
227 | u32 arb_queue_head; | ||
228 | struct nvgpu_ref refcount; | ||
229 | }; | ||
230 | |||
231 | struct nvgpu_clk_session { | ||
232 | bool zombie; | ||
233 | struct gk20a *g; | ||
234 | struct nvgpu_ref refcount; | ||
235 | struct nvgpu_list_node link; | ||
236 | struct nvgpu_list_node targets; | ||
237 | |||
238 | struct nvgpu_spinlock session_lock; | ||
239 | struct nvgpu_clk_arb_target target_pool[2]; | ||
240 | struct nvgpu_clk_arb_target *target; | ||
241 | }; | ||
242 | |||
243 | static inline struct nvgpu_clk_session * | ||
244 | nvgpu_clk_session_from_link(struct nvgpu_list_node *node) | ||
245 | { | ||
246 | return (struct nvgpu_clk_session *) | ||
247 | ((uintptr_t)node - offsetof(struct nvgpu_clk_session, link)); | ||
248 | }; | ||
249 | |||
250 | static inline struct nvgpu_clk_dev * | ||
251 | nvgpu_clk_dev_from_node(struct nvgpu_list_node *node) | ||
252 | { | ||
253 | return (struct nvgpu_clk_dev *) | ||
254 | ((uintptr_t)node - offsetof(struct nvgpu_clk_dev, node)); | ||
255 | }; | ||
256 | |||
257 | static inline struct nvgpu_clk_dev * | ||
258 | nvgpu_clk_dev_from_link(struct nvgpu_list_node *node) | ||
259 | { | ||
260 | return (struct nvgpu_clk_dev *) | ||
261 | ((uintptr_t)node - offsetof(struct nvgpu_clk_dev, link)); | ||
262 | }; | ||
263 | |||
264 | static inline struct nvgpu_clk_arb_work_item * | ||
265 | nvgpu_clk_arb_work_item_from_worker_item(struct nvgpu_list_node *node) | ||
266 | { | ||
267 | return (struct nvgpu_clk_arb_work_item *) | ||
268 | ((uintptr_t)node - offsetof(struct nvgpu_clk_arb_work_item, worker_item)); | ||
269 | }; | ||
270 | |||
271 | void nvgpu_clk_arb_worker_enqueue(struct gk20a *g, | ||
272 | struct nvgpu_clk_arb_work_item *work_item); | ||
273 | |||
154 | int nvgpu_clk_arb_init_arbiter(struct gk20a *g); | 274 | int nvgpu_clk_arb_init_arbiter(struct gk20a *g); |
155 | 275 | ||
156 | int nvgpu_clk_arb_get_arbiter_clk_range(struct gk20a *g, u32 api_domain, | 276 | int nvgpu_clk_arb_get_arbiter_clk_range(struct gk20a *g, u32 api_domain, |