aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/arm/utgard/common/mali_executor.h
blob: a756d3f40c2abdad1779cb9dc8a4ea12ff58e638 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
 * Copyright (C) 2012, 2014-2015 ARM Limited. All rights reserved.
 * 
 * This program is free software and is provided to you under the terms of the GNU General Public License version 2
 * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
 * 
 * A copy of the licence is included with the program, and can also be obtained from Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

#ifndef __MALI_EXECUTOR_H__
#define __MALI_EXECUTOR_H__

#include "mali_osk.h"
#include "mali_scheduler_types.h"
#include "mali_kernel_common.h"

typedef enum {
	MALI_EXECUTOR_HINT_GP_BOUND = 0
#define MALI_EXECUTOR_HINT_MAX        1
} mali_executor_hint;

extern mali_bool mali_executor_hints[MALI_EXECUTOR_HINT_MAX];

/* forward declare struct instead of using include */
struct mali_session_data;
struct mali_group;
struct mali_pp_core;

extern _mali_osk_spinlock_irq_t *mali_executor_lock_obj;

#define MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD() MALI_DEBUG_ASSERT_LOCK_HELD(mali_executor_lock_obj);

_mali_osk_errcode_t mali_executor_initialize(void);
void mali_executor_terminate(void);

void mali_executor_populate(void);
void mali_executor_depopulate(void);

void mali_executor_suspend(void);
void mali_executor_resume(void);

u32 mali_executor_get_num_cores_total(void);
u32 mali_executor_get_num_cores_enabled(void);
struct mali_pp_core *mali_executor_get_virtual_pp(void);
struct mali_group *mali_executor_get_virtual_group(void);

void mali_executor_zap_all_active(struct mali_session_data *session);

/**
 * Schedule GP and PP according to bitmask.
 *
 * @param mask A scheduling bitmask.
 * @param deferred_schedule MALI_TRUE if schedule should be deferred, MALI_FALSE if not.
 */
void mali_executor_schedule_from_mask(mali_scheduler_mask mask, mali_bool deferred_schedule);

_mali_osk_errcode_t mali_executor_interrupt_gp(struct mali_group *group, mali_bool in_upper_half);
_mali_osk_errcode_t mali_executor_interrupt_pp(struct mali_group *group, mali_bool in_upper_half);
_mali_osk_errcode_t mali_executor_interrupt_mmu(struct mali_group *group, mali_bool in_upper_half);

void mali_executor_group_oom(struct mali_group *group);
void mali_executor_group_power_up(struct mali_group *groups[], u32 num_groups);
void mali_executor_group_power_down(struct mali_group *groups[], u32 num_groups);

void mali_executor_abort_session(struct mali_session_data *session);

void mali_executor_core_scaling_enable(void);
void mali_executor_core_scaling_disable(void);
mali_bool mali_executor_core_scaling_is_enabled(void);

void mali_executor_group_enable(struct mali_group *group);
void mali_executor_group_disable(struct mali_group *group);
mali_bool mali_executor_group_is_disabled(struct mali_group *group);

int mali_executor_set_perf_level(unsigned int target_core_nr, mali_bool override);

#if MALI_STATE_TRACKING
u32 mali_executor_dump_state(char *buf, u32 size);
#endif

MALI_STATIC_INLINE void mali_executor_hint_enable(mali_executor_hint hint)
{
	MALI_DEBUG_ASSERT(hint < MALI_EXECUTOR_HINT_MAX);
	mali_executor_hints[hint] = MALI_TRUE;
}

MALI_STATIC_INLINE void mali_executor_hint_disable(mali_executor_hint hint)
{
	MALI_DEBUG_ASSERT(hint < MALI_EXECUTOR_HINT_MAX);
	mali_executor_hints[hint] = MALI_FALSE;
}

MALI_STATIC_INLINE mali_bool mali_executor_hint_is_enabled(mali_executor_hint hint)
{
	MALI_DEBUG_ASSERT(hint < MALI_EXECUTOR_HINT_MAX);
	return mali_executor_hints[hint];
}

void mali_executor_running_status_print(void);
void mali_executor_status_dump(void);
void mali_executor_lock(void);
void mali_executor_unlock(void);
#endif /* __MALI_EXECUTOR_H__ */