/*
- * Copyright (C) 2011-2015 ARM Limited. All rights reserved.
+ * Copyright (C) 2011-2016 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.
#include "mali_broadcast.h"
#include "mali_scheduler.h"
#include "mali_osk_profiling.h"
+#include "mali_osk_mali.h"
#include "mali_pm_domain.h"
#include "mali_pm.h"
#include "mali_executor.h"
static void mali_group_reset_pp(struct mali_group *group);
static void mali_group_reset_mmu(struct mali_group *group);
-static void mali_group_activate_page_directory(struct mali_group *group, struct mali_session_data *session);
+static void mali_group_activate_page_directory(struct mali_group *group, struct mali_session_data *session, mali_bool is_reload);
static void mali_group_recovery_reset(struct mali_group *group);
struct mali_group *mali_group_create(struct mali_l2_cache_core *core,
MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
MALI_DEBUG_ASSERT(NULL == group->gp_running_job);
MALI_DEBUG_ASSERT(NULL == group->pp_running_job);
- MALI_DEBUG_ASSERT(NULL == group->session);
MALI_DEBUG_PRINT(3, ("Group: reset of %s\n",
mali_group_core_description(group)));
}
}
-void mali_group_start_gp_job(struct mali_group *group, struct mali_gp_job *job)
+void mali_group_start_gp_job(struct mali_group *group, struct mali_gp_job *job, mali_bool gpu_secure_mode_pre_enabled)
{
struct mali_session_data *session;
MALI_DEBUG_ASSERT_POINTER(group->l2_cache_core[0]);
mali_l2_cache_invalidate_conditional(group->l2_cache_core[0], mali_gp_job_get_cache_order(job));
- mali_group_activate_page_directory(group, session);
+ /* Reset GPU and disable gpu secure mode if needed. */
+ if (MALI_TRUE == _mali_osk_gpu_secure_mode_is_enabled()) {
+ struct mali_pmu_core *pmu = mali_pmu_get_global_pmu_core();
+ _mali_osk_gpu_reset_and_secure_mode_disable();
+ /* Need to disable the pmu interrupt mask register */
+ if (NULL != pmu) {
+ mali_pmu_reset(pmu);
+ }
+ }
+
+ /* Reload mmu page table if needed */
+ if (MALI_TRUE == gpu_secure_mode_pre_enabled) {
+ mali_group_reset(group);
+ mali_group_activate_page_directory(group, session, MALI_TRUE);
+ } else {
+ mali_group_activate_page_directory(group, session, MALI_FALSE);
+ }
mali_gp_job_start(group->gp_core, job);
/* Used to set all the registers except frame renderer list address and fragment shader stack address
* It means the caller must set these two registers properly before calling this function
*/
-void mali_group_start_pp_job(struct mali_group *group, struct mali_pp_job *job, u32 sub_job)
+void mali_group_start_pp_job(struct mali_group *group, struct mali_pp_job *job, u32 sub_job, mali_bool gpu_secure_mode_pre_enabled)
{
struct mali_session_data *session;
mali_l2_cache_invalidate_conditional(group->l2_cache_core[1], mali_pp_job_get_cache_order(job));
}
- mali_group_activate_page_directory(group, session);
+ /* Reset GPU and change gpu secure mode if needed. */
+ if (MALI_TRUE == mali_pp_job_is_protected_job(job) && MALI_FALSE == _mali_osk_gpu_secure_mode_is_enabled()) {
+ struct mali_pmu_core *pmu = mali_pmu_get_global_pmu_core();
+ _mali_osk_gpu_reset_and_secure_mode_enable();
+ /* Need to disable the pmu interrupt mask register */
+ if (NULL != pmu) {
+ mali_pmu_reset(pmu);
+ }
+ } else if (MALI_FALSE == mali_pp_job_is_protected_job(job) && MALI_TRUE == _mali_osk_gpu_secure_mode_is_enabled()) {
+ struct mali_pmu_core *pmu = mali_pmu_get_global_pmu_core();
+ _mali_osk_gpu_reset_and_secure_mode_disable();
+ /* Need to disable the pmu interrupt mask register */
+ if (NULL != pmu) {
+ mali_pmu_reset(pmu);
+ }
+ }
+
+ /* Reload the mmu page table if needed */
+ if ((MALI_TRUE == mali_pp_job_is_protected_job(job) && MALI_FALSE == gpu_secure_mode_pre_enabled)
+ || (MALI_FALSE == mali_pp_job_is_protected_job(job) && MALI_TRUE == gpu_secure_mode_pre_enabled)) {
+ mali_group_reset(group);
+ mali_group_activate_page_directory(group, session, MALI_TRUE);
+ } else {
+ mali_group_activate_page_directory(group, session, MALI_FALSE);
+ }
if (mali_group_is_virtual(group)) {
struct mali_group *child;
return mali_global_num_groups;
}
-static void mali_group_activate_page_directory(struct mali_group *group, struct mali_session_data *session)
+static void mali_group_activate_page_directory(struct mali_group *group, struct mali_session_data *session, mali_bool is_reload)
{
MALI_DEBUG_PRINT(5, ("Mali group: Activating page directory 0x%08X from session 0x%08X on group %s\n",
mali_session_get_page_directory(session), session,
MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
- if (group->session != session) {
+ if (group->session != session || MALI_TRUE == is_reload) {
/* Different session than last time, so we need to do some work */
MALI_DEBUG_PRINT(5, ("Mali group: Activate session: %08x previous: %08x on group %s\n",
session, group->session,