My Project
mali_kbase_js_defs.h
1 /*
2  *
3  * (C) COPYRIGHT 2011-2016 ARM Limited. All rights reserved.
4  *
5  * This program is free software and is provided to you under the terms of the
6  * GNU General Public License version 2 as published by the Free Software
7  * Foundation, and any use by you of this program is subject to the terms
8  * of such GNU licence.
9  *
10  * A copy of the licence is included with the program, and can also be obtained
11  * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
12  * Boston, MA 02110-1301, USA.
13  *
14  */
15 
16 
17 
18 
19 
25 #ifndef _KBASE_JS_DEFS_H_
26 #define _KBASE_JS_DEFS_H_
27 
42 /* Forward decls */
43 struct kbase_device;
44 struct kbase_jd_atom;
45 
46 
47 typedef u32 kbase_context_flags;
48 
50  base_jd_core_req core_req;
51  kbase_context_flags ctx_req;
52  u32 device_nr;
53 };
54 
57 typedef void (*kbasep_js_ctx_job_cb)(struct kbase_device *kbdev, struct kbase_jd_atom *katom);
58 
67 #define KBASE_JS_MAX_JOB_SUBMIT_PER_SLOT_PER_IRQ 2
68 
77 #define KBASE_JS_IRQ_THROTTLE_TIME_US 20
78 
106 
115 
139 
142 };
143 
144 enum {
149 };
150 
153 
169 
172 };
173 
189  /* Sub-structure to collect together Job Scheduling data used in IRQ
190  * context. The hwaccess_lock must be held when accessing. */
191  struct runpool_irq {
199 
214  s8 ctx_attr_ref_count[KBASEP_JS_CTX_ATTR_COUNT];
215 
218 
219  /*
220  * Affinity management and tracking
221  */
224  u64 slot_affinities[BASE_JM_MAX_NR_SLOTS];
232  s8 slot_affinity_refcount[BASE_JM_MAX_NR_SLOTS][64];
233  } runpool_irq;
234 
243  struct mutex runpool_mutex;
244 
251  struct mutex queue_mutex;
252 
257  struct semaphore schedule_sem;
258 
262  struct list_head ctx_list_pullable[BASE_JM_MAX_NR_SLOTS];
267  struct list_head ctx_list_unpullable[BASE_JM_MAX_NR_SLOTS];
268 
269  u16 as_free;
275 
279 
280  u32 scheduling_period_ns; /*< Value for JS_SCHEDULING_PERIOD_NS */
281  u32 soft_stop_ticks; /*< Value for JS_SOFT_STOP_TICKS */
282  u32 soft_stop_ticks_cl; /*< Value for JS_SOFT_STOP_TICKS_CL */
283  u32 hard_stop_ticks_ss; /*< Value for JS_HARD_STOP_TICKS_SS */
284  u32 hard_stop_ticks_cl; /*< Value for JS_HARD_STOP_TICKS_CL */
285  u32 hard_stop_ticks_dumping; /*< Value for JS_HARD_STOP_TICKS_DUMPING */
286  u32 gpu_reset_ticks_ss; /*< Value for JS_RESET_TICKS_SS */
287  u32 gpu_reset_ticks_cl; /*< Value for JS_RESET_TICKS_CL */
288  u32 gpu_reset_ticks_dumping; /*< Value for JS_RESET_TICKS_DUMPING */
292  atomic_t soft_job_timeout_ms;
293 
295  struct list_head suspended_soft_jobs_list;
296 
297 #ifdef CONFIG_MALI_DEBUG
298  /* Support soft-stop on a single context */
299  bool softstop_always;
300 #endif /* CONFIG_MALI_DEBUG */
301 
306 
307  /* Number of contexts that can currently be pulled from */
308  u32 nr_contexts_pullable;
309 
310  /* Number of contexts that can either be pulled from or are currently
311  * running */
312  atomic_t nr_contexts_runnable;
313 };
314 
322 
335  struct kbase_jsctx {
336  struct mutex jsctx_mutex;
341  u32 nr_jobs;
342 
346  u32 ctx_attr_ref_count[KBASEP_JS_CTX_ATTR_COUNT];
347 
351  wait_queue_head_t is_scheduled_wait;
352 
356  struct list_head ctx_list_entry[BASE_JM_MAX_NR_SLOTS];
357  } ctx;
358 
359  /* The initalized-flag is placed at the end, to avoid cache-pollution (we should
360  * only be using this during init/term paths) */
361  int init_status;
362 };
363 
369  enum base_jd_event_code event_code;
372  /* priority */
373  int sched_priority;
376  /* Core group atom was executed on */
377  u32 device_nr;
378 
379 };
380 
386 #define KBASEP_JS_RETRY_SUBMIT_SLOT_INVALID (-1)
387 
393 #define KBASEP_JS_ATOM_RETAINED_STATE_CORE_REQ_INVALID BASE_JD_REQ_DEP
394 
400 #define KBASEP_JS_TICK_RESOLUTION_US 1
401 
402 /*
403  * Internal atom priority defines for kbase_jd_atom::sched_prio
404  */
405 enum {
406  KBASE_JS_ATOM_SCHED_PRIO_HIGH = 0,
407  KBASE_JS_ATOM_SCHED_PRIO_MED,
408  KBASE_JS_ATOM_SCHED_PRIO_LOW,
409  KBASE_JS_ATOM_SCHED_PRIO_COUNT,
410 };
411 
412 /* Invalid priority for kbase_jd_atom::sched_prio */
413 #define KBASE_JS_ATOM_SCHED_PRIO_INVALID -1
414 
415 /* Default priority in the case of contexts with no atoms, or being lenient
416  * about invalid priorities from userspace */
417 #define KBASE_JS_ATOM_SCHED_PRIO_DEFAULT KBASE_JS_ATOM_SCHED_PRIO_MED
418 /* end group kbase_js *//* end group base_kbase_api *//* end group base_api */
422 
423 #endif /* _KBASE_JS_DEFS_H_ */
Definition: mali_kbase_js_defs.h:49
s8 nr_all_contexts_running
Definition: mali_kbase_js_defs.h:274
KBase Context Job Scheduling information structure.
Definition: mali_kbase_js_defs.h:321
u16 as_free
Definition: mali_kbase_js_defs.h:269
Definition: mali_kbase_defs.h:409
u16 submit_allowed
Definition: mali_kbase_js_defs.h:198
int as_busy_refcount
Definition: mali_kbase_js_defs.h:168
Definition: mali_kbase_js_defs.h:160
Definition: mali_kbase_defs.h:1340
Definition: mali_kbase_js_defs.h:114
kbase_context_flags
Definition: mali_kbase_defs.h:1326
struct kbase_context * kctx
Definition: mali_kbase_js_defs.h:171
Definition: mali_kbase_js_defs.h:148
s8 nr_user_contexts_running
Definition: mali_kbase_js_defs.h:272
int retry_submit_on_slot
Definition: mali_kbase_js_defs.h:375
base_jd_event_code
Job chain event codes.
Definition: mali_base_kernel.h:1057
Definition: mali_kbase_js_defs.h:191
#define BASE_MAX_NR_AS
Definition: mali_kbase_defs.h:140
u32 base_jd_core_req
Job chain hardware requirements.
Definition: mali_base_kernel.h:452
void(* kbasep_js_ctx_job_cb)(struct kbase_device *kbdev, struct kbase_jd_atom *katom)
Definition: mali_kbase_js_defs.h:57
Definition: mali_kbase_js_defs.h:335
base_jd_core_req core_req
Definition: mali_kbase_js_defs.h:371
Definition: mali_kbase_defs.h:951
u32 ctx_timeslice_ns
Definition: mali_kbase_js_defs.h:289
Definition: mali_kbase_js_defs.h:138
int init_status
Definition: mali_kbase_js_defs.h:305
#define BASE_JM_MAX_NR_SLOTS
Definition: mali_kbase_defs.h:132
Definition: mali_kbase_js_defs.h:367
u32 kbasep_js_atom_done_code
Definition: mali_kbase_js_defs.h:152
Definition: mali_kbase_js_defs.h:146
kbasep_js_ctx_attr
Context attributes.
Definition: mali_kbase_js_defs.h:98
wait_queue_head_t is_scheduled_wait
Definition: mali_kbase_js_defs.h:351
Definition: mali_kbase_js_defs.h:105
Definition: mali_kbase_js_defs.h:141
u32 nr_jobs
Definition: mali_kbase_js_defs.h:341
KBase Device Data Job Scheduler sub-structure.
Definition: mali_kbase_js_defs.h:188