xref: /OK3568_Linux_fs/kernel/drivers/gpu/arm/mali400/mali/common/mali_executor.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright (C) 2012, 2014-2017 ARM Limited. All rights reserved.
3  *
4  * This program is free software and is provided to you under the terms of the GNU General Public License version 2
5  * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
6  *
7  * A copy of the licence is included with the program, and can also be obtained from Free Software
8  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
9  */
10 
11 #ifndef __MALI_EXECUTOR_H__
12 #define __MALI_EXECUTOR_H__
13 
14 #include "mali_osk.h"
15 #include "mali_scheduler_types.h"
16 #include "mali_kernel_common.h"
17 
18 typedef enum {
19 	MALI_EXECUTOR_HINT_GP_BOUND = 0
20 #define MALI_EXECUTOR_HINT_MAX        1
21 } mali_executor_hint;
22 
23 extern mali_bool mali_executor_hints[MALI_EXECUTOR_HINT_MAX];
24 
25 /* forward declare struct instead of using include */
26 struct mali_session_data;
27 struct mali_group;
28 struct mali_pp_core;
29 
30 extern _mali_osk_spinlock_irq_t *mali_executor_lock_obj;
31 
32 #define MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD() MALI_DEBUG_ASSERT_LOCK_HELD(mali_executor_lock_obj);
33 
34 _mali_osk_errcode_t mali_executor_initialize(void);
35 void mali_executor_terminate(void);
36 
37 void mali_executor_populate(void);
38 void mali_executor_depopulate(void);
39 
40 void mali_executor_suspend(void);
41 void mali_executor_resume(void);
42 
43 u32 mali_executor_get_num_cores_total(void);
44 u32 mali_executor_get_num_cores_enabled(void);
45 struct mali_pp_core *mali_executor_get_virtual_pp(void);
46 struct mali_group *mali_executor_get_virtual_group(void);
47 
48 void mali_executor_zap_all_active(struct mali_session_data *session);
49 
50 /**
51  * Schedule GP and PP according to bitmask.
52  *
53  * @param mask A scheduling bitmask.
54  * @param deferred_schedule MALI_TRUE if schedule should be deferred, MALI_FALSE if not.
55  */
56 void mali_executor_schedule_from_mask(mali_scheduler_mask mask, mali_bool deferred_schedule);
57 
58 _mali_osk_errcode_t mali_executor_interrupt_gp(struct mali_group *group, mali_bool in_upper_half);
59 _mali_osk_errcode_t mali_executor_interrupt_pp(struct mali_group *group, mali_bool in_upper_half);
60 _mali_osk_errcode_t mali_executor_interrupt_mmu(struct mali_group *group, mali_bool in_upper_half);
61 void mali_executor_group_power_up(struct mali_group *groups[], u32 num_groups);
62 void mali_executor_group_power_down(struct mali_group *groups[], u32 num_groups);
63 
64 void mali_executor_abort_session(struct mali_session_data *session);
65 
66 void mali_executor_core_scaling_enable(void);
67 void mali_executor_core_scaling_disable(void);
68 mali_bool mali_executor_core_scaling_is_enabled(void);
69 
70 void mali_executor_group_enable(struct mali_group *group);
71 void mali_executor_group_disable(struct mali_group *group);
72 mali_bool mali_executor_group_is_disabled(struct mali_group *group);
73 
74 int mali_executor_set_perf_level(unsigned int target_core_nr, mali_bool override);
75 
76 #if MALI_STATE_TRACKING
77 u32 mali_executor_dump_state(char *buf, u32 size);
78 #endif
79 
mali_executor_hint_enable(mali_executor_hint hint)80 MALI_STATIC_INLINE void mali_executor_hint_enable(mali_executor_hint hint)
81 {
82 	MALI_DEBUG_ASSERT(hint < MALI_EXECUTOR_HINT_MAX);
83 	mali_executor_hints[hint] = MALI_TRUE;
84 }
85 
mali_executor_hint_disable(mali_executor_hint hint)86 MALI_STATIC_INLINE void mali_executor_hint_disable(mali_executor_hint hint)
87 {
88 	MALI_DEBUG_ASSERT(hint < MALI_EXECUTOR_HINT_MAX);
89 	mali_executor_hints[hint] = MALI_FALSE;
90 }
91 
mali_executor_hint_is_enabled(mali_executor_hint hint)92 MALI_STATIC_INLINE mali_bool mali_executor_hint_is_enabled(mali_executor_hint hint)
93 {
94 	MALI_DEBUG_ASSERT(hint < MALI_EXECUTOR_HINT_MAX);
95 	return mali_executor_hints[hint];
96 }
97 
98 void mali_executor_running_status_print(void);
99 void mali_executor_status_dump(void);
100 void mali_executor_lock(void);
101 void mali_executor_unlock(void);
102 #endif /* __MALI_EXECUTOR_H__ */
103