+++ /dev/null
-/*
- * Copyright (C) 2012-2014 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.
- */
-
-#include "mali_gp_scheduler.h"
-#include "mali_kernel_common.h"
-#include "mali_osk.h"
-#include "mali_osk_list.h"
-#include "mali_scheduler.h"
-#include "mali_gp.h"
-#include "mali_gp_job.h"
-#include "mali_group.h"
-#include "mali_timeline.h"
-#include "mali_osk_profiling.h"
-#include "mali_kernel_utilization.h"
-#if defined(CONFIG_GPU_TRACEPOINTS) && defined(CONFIG_TRACEPOINTS)
-#include <linux/sched.h>
-#include <trace/events/gpu.h>
-#endif
-
-enum mali_gp_slot_state {
- MALI_GP_SLOT_STATE_IDLE,
- MALI_GP_SLOT_STATE_WORKING,
- MALI_GP_SLOT_STATE_DISABLED,
-};
-
-/* A render slot is an entity which jobs can be scheduled onto */
-struct mali_gp_slot {
- struct mali_group *group;
- /*
- * We keep track of the state here as well as in the group object
- * so we don't need to take the group lock so often (and also avoid clutter with the working lock)
- */
- enum mali_gp_slot_state state;
- u32 returned_cookie;
-};
-
-static u32 gp_version = 0;
-static _MALI_OSK_LIST_HEAD_STATIC_INIT(job_queue); /* List of unscheduled jobs. */
-static _MALI_OSK_LIST_HEAD_STATIC_INIT(job_queue_high); /* List of unscheduled high priority jobs. */
-static struct mali_gp_slot slot;
-
-/* Variables to allow safe pausing of the scheduler */
-static _mali_osk_wait_queue_t *gp_scheduler_working_wait_queue = NULL;
-static u32 pause_count = 0;
-
-static mali_bool mali_gp_scheduler_is_suspended(void *data);
-static void mali_gp_scheduler_job_queued(void);
-static void mali_gp_scheduler_job_completed(void);
-
-#if defined(MALI_UPPER_HALF_SCHEDULING)
-static _mali_osk_spinlock_irq_t *gp_scheduler_lock = NULL;
-#else
-static _mali_osk_spinlock_t *gp_scheduler_lock = NULL;
-#endif /* defined(MALI_UPPER_HALF_SCHEDULING) */
-
-_mali_osk_errcode_t mali_gp_scheduler_initialize(void)
-{
- u32 num_groups;
- u32 i;
- _mali_osk_errcode_t ret = _MALI_OSK_ERR_OK;
-
-#if defined(MALI_UPPER_HALF_SCHEDULING)
- gp_scheduler_lock = _mali_osk_spinlock_irq_init(_MALI_OSK_LOCKFLAG_ORDERED, _MALI_OSK_LOCK_ORDER_SCHEDULER);
-#else
- gp_scheduler_lock = _mali_osk_spinlock_init(_MALI_OSK_LOCKFLAG_ORDERED, _MALI_OSK_LOCK_ORDER_SCHEDULER);
-#endif /* defined(MALI_UPPER_HALF_SCHEDULING) */
- if (NULL == gp_scheduler_lock) {
- ret = _MALI_OSK_ERR_NOMEM;
- goto cleanup;
- }
-
- gp_scheduler_working_wait_queue = _mali_osk_wait_queue_init();
- if (NULL == gp_scheduler_working_wait_queue) {
- ret = _MALI_OSK_ERR_NOMEM;
- goto cleanup;
- }
-
- /* Find all the available GP cores */
- num_groups = mali_group_get_glob_num_groups();
- for (i = 0; i < num_groups; i++) {
- struct mali_group *group = mali_group_get_glob_group(i);
- MALI_DEBUG_ASSERT(NULL != group);
- if (NULL != group) {
- struct mali_gp_core *gp_core = mali_group_get_gp_core(group);
- if (NULL != gp_core) {
- if (0 == gp_version) {
- /* Retrieve GP version */
- gp_version = mali_gp_core_get_version(gp_core);
- }
- slot.group = group;
- slot.state = MALI_GP_SLOT_STATE_IDLE;
- break; /* There is only one GP, no point in looking for more */
- }
- } else {
- ret = _MALI_OSK_ERR_ITEM_NOT_FOUND;
- goto cleanup;
- }
- }
-
- return _MALI_OSK_ERR_OK;
-
-cleanup:
- if (NULL != gp_scheduler_working_wait_queue) {
- _mali_osk_wait_queue_term(gp_scheduler_working_wait_queue);
- gp_scheduler_working_wait_queue = NULL;
- }
-
- if (NULL != gp_scheduler_lock) {
-#if defined(MALI_UPPER_HALF_SCHEDULING)
- _mali_osk_spinlock_irq_term(gp_scheduler_lock);
-#else
- _mali_osk_spinlock_term(gp_scheduler_lock);
-#endif /* defined(MALI_UPPER_HALF_SCHEDULING) */
- gp_scheduler_lock = NULL;
- }
-
- return ret;
-}
-
-void mali_gp_scheduler_terminate(void)
-{
- MALI_DEBUG_ASSERT(MALI_GP_SLOT_STATE_IDLE == slot.state
- || MALI_GP_SLOT_STATE_DISABLED == slot.state);
- MALI_DEBUG_ASSERT_POINTER(slot.group);
- mali_group_delete(slot.group);
-
- _mali_osk_wait_queue_term(gp_scheduler_working_wait_queue);
-
-#if defined(MALI_UPPER_HALF_SCHEDULING)
- _mali_osk_spinlock_irq_term(gp_scheduler_lock);
-#else
- _mali_osk_spinlock_term(gp_scheduler_lock);
-#endif /* defined(MALI_UPPER_HALF_SCHEDULING) */
-}
-
-MALI_STATIC_INLINE void mali_gp_scheduler_lock(void)
-{
-#if defined(MALI_UPPER_HALF_SCHEDULING)
- _mali_osk_spinlock_irq_lock(gp_scheduler_lock);
-#else
- _mali_osk_spinlock_lock(gp_scheduler_lock);
-#endif /* defined(MALI_UPPER_HALF_SCHEDULING) */
- MALI_DEBUG_PRINT(5, ("Mali GP scheduler: GP scheduler lock taken\n"));
-}
-
-MALI_STATIC_INLINE void mali_gp_scheduler_unlock(void)
-{
- MALI_DEBUG_PRINT(5, ("Mali GP scheduler: Releasing GP scheduler lock\n"));
-#if defined(MALI_UPPER_HALF_SCHEDULING)
- _mali_osk_spinlock_irq_unlock(gp_scheduler_lock);
-#else
- _mali_osk_spinlock_unlock(gp_scheduler_lock);
-#endif /* defined(MALI_UPPER_HALF_SCHEDULING) */
-}
-
-#if defined(DEBUG)
-#define MALI_ASSERT_GP_SCHEDULER_LOCKED() MALI_DEBUG_ASSERT_LOCK_HELD(gp_scheduler_lock)
-#else
-#define MALI_ASSERT_GP_SCHEDULER_LOCKED() do {} while (0)
-#endif /* defined(DEBUG) */
-
-/* Group and scheduler must be locked when entering this function. Both will be unlocked before
- * exiting. */
-static void mali_gp_scheduler_schedule_internal_and_unlock(void)
-{
- struct mali_gp_job *job = NULL;
-
- MALI_DEBUG_ASSERT_LOCK_HELD(slot.group->lock);
- MALI_DEBUG_ASSERT_LOCK_HELD(gp_scheduler_lock);
-
- if (0 < pause_count || MALI_GP_SLOT_STATE_IDLE != slot.state ||
- (_mali_osk_list_empty(&job_queue) && _mali_osk_list_empty(&job_queue_high))) {
- mali_gp_scheduler_unlock();
- mali_group_unlock(slot.group);
- MALI_DEBUG_PRINT(4, ("Mali GP scheduler: Nothing to schedule (paused=%u, idle slots=%u)\n",
- pause_count, MALI_GP_SLOT_STATE_IDLE == slot.state ? 1 : 0));
-#if defined(CONFIG_GPU_TRACEPOINTS) && defined(CONFIG_TRACEPOINTS)
- trace_gpu_sched_switch(mali_gp_get_hw_core_desc(group->gp_core), sched_clock(), 0, 0, 0);
-#endif
- return; /* Nothing to do, so early out */
- }
-
- /* Get next job in queue */
- if (!_mali_osk_list_empty(&job_queue_high)) {
- job = _MALI_OSK_LIST_ENTRY(job_queue_high.next, struct mali_gp_job, list);
- } else {
- MALI_DEBUG_ASSERT(!_mali_osk_list_empty(&job_queue));
- job = _MALI_OSK_LIST_ENTRY(job_queue.next, struct mali_gp_job, list);
- }
-
- MALI_DEBUG_ASSERT_POINTER(job);
-
- /* Remove the job from queue */
- _mali_osk_list_del(&job->list);
-
- /* Mark slot as busy */
- slot.state = MALI_GP_SLOT_STATE_WORKING;
-
- mali_gp_scheduler_unlock();
-
- MALI_DEBUG_PRINT(3, ("Mali GP scheduler: Starting job %u (0x%08X)\n", mali_gp_job_get_id(job), job));
-
- mali_group_start_gp_job(slot.group, job);
- mali_group_unlock(slot.group);
-}
-
-void mali_gp_scheduler_schedule(void)
-{
- mali_group_lock(slot.group);
- mali_gp_scheduler_lock();
-
- mali_gp_scheduler_schedule_internal_and_unlock();
-}
-
-static void mali_gp_scheduler_return_job_to_user(struct mali_gp_job *job, mali_bool success)
-{
- _mali_uk_gp_job_finished_s *jobres = job->finished_notification->result_buffer;
- _mali_osk_memset(jobres, 0, sizeof(_mali_uk_gp_job_finished_s)); /* @@@@ can be removed once we initialize all members in this struct */
- jobres->user_job_ptr = mali_gp_job_get_user_id(job);
- if (MALI_TRUE == success) {
- jobres->status = _MALI_UK_JOB_STATUS_END_SUCCESS;
- } else {
- jobres->status = _MALI_UK_JOB_STATUS_END_UNKNOWN_ERR;
- }
-
- jobres->heap_current_addr = mali_gp_job_get_current_heap_addr(job);
- jobres->perf_counter0 = mali_gp_job_get_perf_counter_value0(job);
- jobres->perf_counter1 = mali_gp_job_get_perf_counter_value1(job);
-
- mali_session_send_notification(mali_gp_job_get_session(job), job->finished_notification);
- job->finished_notification = NULL;
-
- mali_gp_job_delete(job);
- mali_gp_scheduler_job_completed();
-}
-
-/* Group must be locked when entering this function. Will be unlocked before exiting. */
-void mali_gp_scheduler_job_done(struct mali_group *group, struct mali_gp_job *job, mali_bool success)
-{
- mali_scheduler_mask schedule_mask = MALI_SCHEDULER_MASK_EMPTY;
-
- MALI_DEBUG_ASSERT_POINTER(group);
- MALI_DEBUG_ASSERT_POINTER(job);
-
- MALI_DEBUG_ASSERT_LOCK_HELD(group->lock);
- MALI_DEBUG_ASSERT(slot.group == group);
-
- MALI_DEBUG_PRINT(3, ("Mali GP scheduler: Job %u (0x%08X) completed (%s)\n", mali_gp_job_get_id(job), job, success ? "success" : "failure"));
-
- /* Release tracker. */
- schedule_mask |= mali_timeline_tracker_release(&job->tracker);
-
- /* Signal PP job. */
- schedule_mask |= mali_gp_job_signal_pp_tracker(job, success);
-
- mali_gp_scheduler_lock();
-
- /* Mark slot as idle again */
- slot.state = MALI_GP_SLOT_STATE_IDLE;
-
- /* If paused, then this was the last job, so wake up sleeping workers */
- if (pause_count > 0) {
- _mali_osk_wait_queue_wake_up(gp_scheduler_working_wait_queue);
- }
-
- /* Schedule any queued GP jobs on this group. */
- mali_gp_scheduler_schedule_internal_and_unlock();
-
- /* GP is now scheduled, removing it from the mask. */
- schedule_mask &= ~MALI_SCHEDULER_MASK_GP;
-
- if (MALI_SCHEDULER_MASK_EMPTY != schedule_mask) {
- /* Releasing the tracker activated other jobs that need scheduling. */
- mali_scheduler_schedule_from_mask(schedule_mask, MALI_FALSE);
- }
-
- /* Sends the job end message to user space and free the job object */
- mali_gp_scheduler_return_job_to_user(job, success);
-}
-
-void mali_gp_scheduler_oom(struct mali_group *group, struct mali_gp_job *job)
-{
- _mali_uk_gp_job_suspended_s *jobres;
- _mali_osk_notification_t *notification;
-
- mali_gp_scheduler_lock();
-
- notification = job->oom_notification;
- job->oom_notification = NULL;
- slot.returned_cookie = mali_gp_job_get_id(job);
-
- jobres = (_mali_uk_gp_job_suspended_s *)notification->result_buffer;
- jobres->user_job_ptr = mali_gp_job_get_user_id(job);
- jobres->cookie = mali_gp_job_get_id(job);
-
- mali_gp_scheduler_unlock();
-
- mali_session_send_notification(mali_gp_job_get_session(job), notification);
-
- /*
- * If this function failed, then we could return the job to user space right away,
- * but there is a job timer anyway that will do that eventually.
- * This is not exactly a common case anyway.
- */
-}
-
-void mali_gp_scheduler_suspend(void)
-{
- mali_gp_scheduler_lock();
- pause_count++; /* Increment the pause_count so that no more jobs will be scheduled */
- mali_gp_scheduler_unlock();
-
- _mali_osk_wait_queue_wait_event(gp_scheduler_working_wait_queue, mali_gp_scheduler_is_suspended, NULL);
-}
-
-void mali_gp_scheduler_resume(void)
-{
- mali_gp_scheduler_lock();
- pause_count--; /* Decrement pause_count to allow scheduling again (if it reaches 0) */
- mali_gp_scheduler_unlock();
- if (0 == pause_count) {
- mali_gp_scheduler_schedule();
- }
-}
-
-mali_timeline_point mali_gp_scheduler_submit_job(struct mali_session_data *session, struct mali_gp_job *job)
-{
- mali_timeline_point point;
-
- MALI_DEBUG_ASSERT_POINTER(session);
- MALI_DEBUG_ASSERT_POINTER(job);
-
- /* We hold a PM reference for every job we hold queued (and running) */
- _mali_osk_pm_dev_ref_add();
-
- /* Add job to Timeline system. */
- point = mali_timeline_system_add_tracker(session->timeline_system, &job->tracker, MALI_TIMELINE_GP);
-
- return point;
-}
-
-_mali_osk_errcode_t _mali_ukk_gp_start_job(void *ctx, _mali_uk_gp_start_job_s *uargs)
-{
- struct mali_session_data *session;
- struct mali_gp_job *job;
- mali_timeline_point point;
- u32 __user *timeline_point_ptr = NULL;
-
- MALI_DEBUG_ASSERT_POINTER(uargs);
- MALI_DEBUG_ASSERT_POINTER(ctx);
-
- session = (struct mali_session_data *)ctx;
-
- job = mali_gp_job_create(session, uargs, mali_scheduler_get_new_id(), NULL);
- if (NULL == job) {
- MALI_PRINT_ERROR(("Failed to create GP job.\n"));
- return _MALI_OSK_ERR_NOMEM;
- }
-
- timeline_point_ptr = (u32 __user *)(uintptr_t)job->uargs.timeline_point_ptr;
-
- point = mali_gp_scheduler_submit_job(session, job);
-
- if (0 != _mali_osk_put_user(((u32) point), timeline_point_ptr)) {
- /* Let user space know that something failed after the job was started. */
- return _MALI_OSK_ERR_ITEM_NOT_FOUND;
- }
-
- return _MALI_OSK_ERR_OK;
-}
-
-_mali_osk_errcode_t _mali_ukk_get_gp_number_of_cores(_mali_uk_get_gp_number_of_cores_s *args)
-{
- MALI_DEBUG_ASSERT_POINTER(args);
- MALI_DEBUG_ASSERT_POINTER((struct mali_session_data *)(uintptr_t)args->ctx);
-
- args->number_of_cores = 1;
- return _MALI_OSK_ERR_OK;
-}
-
-_mali_osk_errcode_t _mali_ukk_get_gp_core_version(_mali_uk_get_gp_core_version_s *args)
-{
- MALI_DEBUG_ASSERT_POINTER(args);
- MALI_DEBUG_ASSERT_POINTER((struct mali_session_data *)(uintptr_t)args->ctx);
-
- args->version = gp_version;
- return _MALI_OSK_ERR_OK;
-}
-
-_mali_osk_errcode_t _mali_ukk_gp_suspend_response(_mali_uk_gp_suspend_response_s *args)
-{
- struct mali_gp_job *resumed_job;
- _mali_osk_notification_t *new_notification = NULL;
-
- MALI_DEBUG_ASSERT_POINTER(args);
-
- if (_MALIGP_JOB_RESUME_WITH_NEW_HEAP == args->code) {
- new_notification = _mali_osk_notification_create(_MALI_NOTIFICATION_GP_STALLED, sizeof(_mali_uk_gp_job_suspended_s));
-
- if (NULL == new_notification) {
- MALI_PRINT_ERROR(("Mali GP scheduler: Failed to allocate notification object. Will abort GP job.\n"));
- mali_group_lock(slot.group);
- mali_group_abort_gp_job(slot.group, args->cookie);
- mali_group_unlock(slot.group);
- return _MALI_OSK_ERR_FAULT;
- }
- }
-
- mali_group_lock(slot.group);
-
- if (_MALIGP_JOB_RESUME_WITH_NEW_HEAP == args->code) {
- MALI_DEBUG_PRINT(3, ("Mali GP scheduler: Resuming job %u with new heap; 0x%08X - 0x%08X\n", args->cookie, args->arguments[0], args->arguments[1]));
-
- resumed_job = mali_group_resume_gp_with_new_heap(slot.group, args->cookie, args->arguments[0], args->arguments[1]);
- if (NULL != resumed_job) {
- resumed_job->oom_notification = new_notification;
- mali_group_unlock(slot.group);
- return _MALI_OSK_ERR_OK;
- } else {
- mali_group_unlock(slot.group);
- _mali_osk_notification_delete(new_notification);
- return _MALI_OSK_ERR_FAULT;
- }
- }
-
- MALI_DEBUG_PRINT(2, ("Mali GP scheduler: Aborting job %u, no new heap provided\n", args->cookie));
- mali_group_abort_gp_job(slot.group, args->cookie);
- mali_group_unlock(slot.group);
- return _MALI_OSK_ERR_OK;
-}
-
-void mali_gp_scheduler_abort_session(struct mali_session_data *session)
-{
- struct mali_gp_job *job, *tmp;
- _MALI_OSK_LIST_HEAD_STATIC_INIT(removed_jobs);
-
- MALI_DEBUG_ASSERT_POINTER(session);
- MALI_DEBUG_ASSERT(session->is_aborting);
-
- MALI_DEBUG_PRINT(3, ("Mali GP scheduler: Aborting all jobs from session 0x%08X.\n", session));
-
- mali_gp_scheduler_lock();
-
- /* Find all jobs from the aborting session. */
- _MALI_OSK_LIST_FOREACHENTRY(job, tmp, &job_queue, struct mali_gp_job, list) {
- if (job->session == session) {
- MALI_DEBUG_PRINT(3, ("Mali GP scheduler: Removing job %u (0x%08X) from queue.\n", mali_gp_job_get_id(job), job));
- _mali_osk_list_move(&job->list, &removed_jobs);
- }
- }
-
- /* Find all high priority jobs from the aborting session. */
- _MALI_OSK_LIST_FOREACHENTRY(job, tmp, &job_queue_high, struct mali_gp_job, list) {
- if (job->session == session) {
- MALI_DEBUG_PRINT(3, ("Mali GP scheduler: Removing job %u (0x%08X) from queue.\n", mali_gp_job_get_id(job), job));
- _mali_osk_list_move(&job->list, &removed_jobs);
- }
- }
-
- mali_gp_scheduler_unlock();
-
- /* Release and delete all found jobs from the aborting session. */
- _MALI_OSK_LIST_FOREACHENTRY(job, tmp, &removed_jobs, struct mali_gp_job, list) {
- mali_timeline_tracker_release(&job->tracker);
- mali_gp_job_signal_pp_tracker(job, MALI_FALSE);
- mali_gp_job_delete(job);
- mali_gp_scheduler_job_completed();
- }
-
- /* Abort any running jobs from the session. */
- mali_group_abort_session(slot.group, session);
-}
-
-static mali_bool mali_gp_scheduler_is_suspended(void *data)
-{
- mali_bool ret;
-
- /* This callback does not use the data pointer. */
- MALI_IGNORE(data);
-
- mali_gp_scheduler_lock();
- ret = pause_count > 0 && (slot.state == MALI_GP_SLOT_STATE_IDLE || slot.state == MALI_GP_SLOT_STATE_DISABLED);
- mali_gp_scheduler_unlock();
-
- return ret;
-}
-
-
-#if MALI_STATE_TRACKING
-u32 mali_gp_scheduler_dump_state(char *buf, u32 size)
-{
- int n = 0;
-
- n += _mali_osk_snprintf(buf + n, size - n, "GP\n");
- n += _mali_osk_snprintf(buf + n, size - n, "\tQueue is %s\n", _mali_osk_list_empty(&job_queue) ? "empty" : "not empty");
- n += _mali_osk_snprintf(buf + n, size - n, "\tHigh priority queue is %s\n", _mali_osk_list_empty(&job_queue_high) ? "empty" : "not empty");
-
- n += mali_group_dump_state(slot.group, buf + n, size - n);
- n += _mali_osk_snprintf(buf + n, size - n, "\n");
-
- return n;
-}
-#endif
-
-void mali_gp_scheduler_reset_all_groups(void)
-{
- if (NULL != slot.group) {
- mali_group_lock(slot.group);
- mali_group_reset(slot.group);
- mali_group_unlock(slot.group);
- }
-}
-
-void mali_gp_scheduler_zap_all_active(struct mali_session_data *session)
-{
- if (NULL != slot.group) {
- mali_group_zap_session(slot.group, session);
- }
-}
-
-void mali_gp_scheduler_enable_group(struct mali_group *group)
-{
- MALI_DEBUG_ASSERT_POINTER(group);
- MALI_DEBUG_ASSERT(slot.group == group);
- MALI_DEBUG_PRINT(2, ("Mali GP scheduler: enabling gp group %p\n", group));
-
- mali_group_lock(group);
-
- if (MALI_GROUP_STATE_DISABLED != group->state) {
- mali_group_unlock(group);
- MALI_DEBUG_PRINT(2, ("Mali GP scheduler: gp group %p already enabled\n", group));
- return;
- }
-
- mali_gp_scheduler_lock();
-
- MALI_DEBUG_ASSERT(MALI_GROUP_STATE_DISABLED == group->state);
- MALI_DEBUG_ASSERT(MALI_GP_SLOT_STATE_DISABLED == slot.state);
- slot.state = MALI_GP_SLOT_STATE_IDLE;
- group->state = MALI_GROUP_STATE_IDLE;
-
- mali_group_power_on_group(group);
- mali_group_reset(group);
-
- /* Pick up any jobs that might have been queued while the GP group was disabled. */
- mali_gp_scheduler_schedule_internal_and_unlock();
-}
-
-void mali_gp_scheduler_disable_group(struct mali_group *group)
-{
- MALI_DEBUG_ASSERT_POINTER(group);
- MALI_DEBUG_ASSERT(slot.group == group);
- MALI_DEBUG_PRINT(2, ("Mali GP scheduler: disabling gp group %p\n", group));
-
- mali_gp_scheduler_suspend();
- mali_group_lock(group);
- mali_gp_scheduler_lock();
-
- MALI_DEBUG_ASSERT(MALI_GROUP_STATE_IDLE == group->state
- || MALI_GROUP_STATE_DISABLED == group->state);
-
- if (MALI_GROUP_STATE_DISABLED == group->state) {
- MALI_DEBUG_ASSERT(MALI_GP_SLOT_STATE_DISABLED == slot.state);
- MALI_DEBUG_PRINT(2, ("Mali GP scheduler: gp group %p already disabled\n", group));
- } else {
- MALI_DEBUG_ASSERT(MALI_GP_SLOT_STATE_IDLE == slot.state);
- slot.state = MALI_GP_SLOT_STATE_DISABLED;
- group->state = MALI_GROUP_STATE_DISABLED;
-
- mali_group_power_off_group(group, MALI_TRUE);
- }
-
- mali_gp_scheduler_unlock();
- mali_group_unlock(group);
- mali_gp_scheduler_resume();
-}
-
-static mali_scheduler_mask mali_gp_scheduler_queue_job(struct mali_gp_job *job)
-{
- _mali_osk_list_t *queue = NULL;
- mali_scheduler_mask schedule_mask = MALI_SCHEDULER_MASK_EMPTY;
- struct mali_gp_job *iter, *tmp;
-
- MALI_DEBUG_ASSERT_POINTER(job);
- MALI_DEBUG_ASSERT_POINTER(job->session);
-
- MALI_DEBUG_ASSERT_LOCK_HELD(gp_scheduler_lock);
-
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_SINGLE | MALI_PROFILING_EVENT_CHANNEL_SOFTWARE | MALI_PROFILING_EVENT_REASON_SINGLE_SW_GP_ENQUEUE, job->pid, job->tid, job->uargs.frame_builder_id, job->uargs.flush_id, 0);
-
- job->cache_order = mali_scheduler_get_new_cache_order();
-
- /* Determine which queue the job should be added to. */
- if (job->session->use_high_priority_job_queue) {
- queue = &job_queue_high;
- } else {
- queue = &job_queue;
- }
-
- /* Find position in queue where job should be added. */
- _MALI_OSK_LIST_FOREACHENTRY_REVERSE(iter, tmp, queue, struct mali_gp_job, list) {
- if (mali_gp_job_is_after(job, iter)) {
- break;
- }
- }
-
- /* Add job to queue. */
- _mali_osk_list_add(&job->list, &iter->list);
-
- /* Set schedule bitmask if the GP core is idle. */
- if (MALI_GP_SLOT_STATE_IDLE == slot.state) {
- schedule_mask |= MALI_SCHEDULER_MASK_GP;
- }
-
- mali_gp_scheduler_job_queued();
-
-#if defined(CONFIG_GPU_TRACEPOINTS) && defined(CONFIG_TRACEPOINTS)
- trace_gpu_job_enqueue(mali_gp_job_get_tid(job), mali_gp_job_get_id(job), "GP");
-#endif
-
- MALI_DEBUG_PRINT(3, ("Mali GP scheduler: Job %u (0x%08X) queued\n", mali_gp_job_get_id(job), job));
-
- return schedule_mask;
-}
-
-mali_scheduler_mask mali_gp_scheduler_activate_job(struct mali_gp_job *job)
-{
- mali_scheduler_mask schedule_mask = MALI_SCHEDULER_MASK_EMPTY;
-
- MALI_DEBUG_ASSERT_POINTER(job);
- MALI_DEBUG_ASSERT_POINTER(job->session);
-
- MALI_DEBUG_PRINT(4, ("Mali GP scheduler: Timeline activation for job %u (0x%08X).\n", mali_gp_job_get_id(job), job));
-
- mali_gp_scheduler_lock();
-
- if (unlikely(job->session->is_aborting)) {
- /* Before checking if the session is aborting, the scheduler must be locked. */
- MALI_DEBUG_ASSERT_LOCK_HELD(gp_scheduler_lock);
-
- MALI_DEBUG_PRINT(3, ("Mali GP scheduler: Job %u (0x%08X) activated while session is aborting.\n", mali_gp_job_get_id(job), job));
-
- /* This job should not be on any list. */
- MALI_DEBUG_ASSERT(_mali_osk_list_empty(&job->list));
-
- mali_gp_scheduler_unlock();
-
- /* Release tracker and delete job. */
- mali_timeline_tracker_release(&job->tracker);
- mali_gp_job_signal_pp_tracker(job, MALI_FALSE);
- mali_gp_job_delete(job);
-
- /* Release the PM ref taken in mali_gp_scheduler_submit_job */
- _mali_osk_pm_dev_ref_dec();
-
- /* Since we are aborting we ignore the scheduler mask. */
- return MALI_SCHEDULER_MASK_EMPTY;
- }
-
- /* GP job is ready to run, queue it. */
- schedule_mask = mali_gp_scheduler_queue_job(job);
-
- mali_gp_scheduler_unlock();
-
- return schedule_mask;
-}
-
-static void mali_gp_scheduler_job_queued(void)
-{
- if (mali_utilization_enabled()) {
- /*
- * We cheat a little bit by counting the PP as busy from the time a GP job is queued.
- * This will be fine because we only loose the tiny idle gap between jobs, but
- * we will instead get less utilization work to do (less locks taken)
- */
- mali_utilization_gp_start();
- }
-}
-
-static void mali_gp_scheduler_job_completed(void)
-{
- /* Release the PM reference we got in the mali_gp_scheduler_job_queued() function */
- _mali_osk_pm_dev_ref_dec();
-
- if (mali_utilization_enabled()) {
- mali_utilization_gp_end();
- }
-}
static void mali_group_recovery_reset(struct mali_group *group);
struct mali_group *mali_group_create(struct mali_l2_cache_core *core,
- struct mali_dlbu_core *dlbu,
- struct mali_bcast_unit *bcast,
- u32 domain_index)
+ struct mali_dlbu_core *dlbu,
+ struct mali_bcast_unit *bcast,
+ u32 domain_index)
{
- struct mali_group *group = NULL;
-
- if (mali_global_num_groups >= MALI_MAX_NUMBER_OF_GROUPS) {
- MALI_PRINT_ERROR(("Mali group: Too many group objects created\n"));
- return NULL;
- }
-
- group = _mali_osk_calloc(1, sizeof(struct mali_group));
- if (NULL != group) {
- group->timeout_timer = _mali_osk_timer_init();
- if (NULL != group->timeout_timer) {
- _mali_osk_timer_setcallback(group->timeout_timer, mali_group_timeout, (void *)group);
-
- group->l2_cache_core[0] = core;
- _mali_osk_list_init(&group->group_list);
- _mali_osk_list_init(&group->executor_list);
- _mali_osk_list_init(&group->pm_domain_list);
- group->bcast_core = bcast;
- group->dlbu_core = dlbu;
-
- /* register this object as a part of the correct power domain */
- if ((NULL != core) || (NULL != dlbu) || (NULL != bcast))
- group->pm_domain = mali_pm_register_group(domain_index, group);
-
- mali_global_groups[mali_global_num_groups] = group;
- mali_global_num_groups++;
-
- return group;
- }
- _mali_osk_free(group);
- }
-
- return NULL;
+ struct mali_group *group = NULL;
+
+ if (mali_global_num_groups >= MALI_MAX_NUMBER_OF_GROUPS) {
+ MALI_PRINT_ERROR(("Mali group: Too many group objects created\n"));
+ return NULL;
+ }
+
+ group = _mali_osk_calloc(1, sizeof(struct mali_group));
+ if (NULL != group) {
+ group->timeout_timer = _mali_osk_timer_init();
+ if (NULL != group->timeout_timer) {
+ _mali_osk_timer_setcallback(group->timeout_timer, mali_group_timeout, (void *)group);
+
+ group->l2_cache_core[0] = core;
+ _mali_osk_list_init(&group->group_list);
+ _mali_osk_list_init(&group->executor_list);
+ _mali_osk_list_init(&group->pm_domain_list);
+ group->bcast_core = bcast;
+ group->dlbu_core = dlbu;
+
+ /* register this object as a part of the correct power domain */
+ if ((NULL != core) || (NULL != dlbu) || (NULL != bcast))
+ group->pm_domain = mali_pm_register_group(domain_index, group);
+
+ mali_global_groups[mali_global_num_groups] = group;
+ mali_global_num_groups++;
+
+ return group;
+ }
+ _mali_osk_free(group);
+ }
+
+ return NULL;
}
void mali_group_delete(struct mali_group *group)
{
- u32 i;
-
- MALI_DEBUG_PRINT(4, ("Deleting group %s\n",
- mali_group_core_description(group)));
-
- MALI_DEBUG_ASSERT(NULL == group->parent_group);
- MALI_DEBUG_ASSERT((MALI_GROUP_STATE_INACTIVE == group->state) || ((MALI_GROUP_STATE_ACTIVATION_PENDING == group->state)));
-
- /* Delete the resources that this group owns */
- if (NULL != group->gp_core) {
- mali_gp_delete(group->gp_core);
- }
-
- if (NULL != group->pp_core) {
- mali_pp_delete(group->pp_core);
- }
-
- if (NULL != group->mmu) {
- mali_mmu_delete(group->mmu);
- }
-
- if (mali_group_is_virtual(group)) {
- /* Remove all groups from virtual group */
- struct mali_group *child;
- struct mali_group *temp;
-
- _MALI_OSK_LIST_FOREACHENTRY(child, temp, &group->group_list, struct mali_group, group_list) {
- child->parent_group = NULL;
- mali_group_delete(child);
- }
-
- mali_dlbu_delete(group->dlbu_core);
-
- if (NULL != group->bcast_core) {
- mali_bcast_unit_delete(group->bcast_core);
- }
- }
-
- for (i = 0; i < mali_global_num_groups; i++) {
- if (mali_global_groups[i] == group) {
- mali_global_groups[i] = NULL;
- mali_global_num_groups--;
-
- if (i != mali_global_num_groups) {
- /* We removed a group from the middle of the array -- move the last
- * group to the current position to close the gap */
- mali_global_groups[i] = mali_global_groups[mali_global_num_groups];
- mali_global_groups[mali_global_num_groups] = NULL;
- }
-
- break;
- }
- }
-
- if (NULL != group->timeout_timer) {
- _mali_osk_timer_del(group->timeout_timer);
- _mali_osk_timer_term(group->timeout_timer);
- }
-
- if (NULL != group->bottom_half_work_mmu) {
- _mali_osk_wq_delete_work(group->bottom_half_work_mmu);
- }
-
- if (NULL != group->bottom_half_work_gp) {
- _mali_osk_wq_delete_work(group->bottom_half_work_gp);
- }
-
- if (NULL != group->bottom_half_work_pp) {
- _mali_osk_wq_delete_work(group->bottom_half_work_pp);
- }
-
- _mali_osk_free(group);
+ u32 i;
+
+ MALI_DEBUG_PRINT(4, ("Deleting group %s\n",
+ mali_group_core_description(group)));
+
+ MALI_DEBUG_ASSERT(NULL == group->parent_group);
+ MALI_DEBUG_ASSERT((MALI_GROUP_STATE_INACTIVE == group->state) || ((MALI_GROUP_STATE_ACTIVATION_PENDING == group->state)));
+
+ /* Delete the resources that this group owns */
+ if (NULL != group->gp_core) {
+ mali_gp_delete(group->gp_core);
+ }
+
+ if (NULL != group->pp_core) {
+ mali_pp_delete(group->pp_core);
+ }
+
+ if (NULL != group->mmu) {
+ mali_mmu_delete(group->mmu);
+ }
+
+ if (mali_group_is_virtual(group)) {
+ /* Remove all groups from virtual group */
+ struct mali_group *child;
+ struct mali_group *temp;
+
+ _MALI_OSK_LIST_FOREACHENTRY(child, temp, &group->group_list, struct mali_group, group_list) {
+ child->parent_group = NULL;
+ mali_group_delete(child);
+ }
+
+ mali_dlbu_delete(group->dlbu_core);
+
+ if (NULL != group->bcast_core) {
+ mali_bcast_unit_delete(group->bcast_core);
+ }
+ }
+
+ for (i = 0; i < mali_global_num_groups; i++) {
+ if (mali_global_groups[i] == group) {
+ mali_global_groups[i] = NULL;
+ mali_global_num_groups--;
+
+ if (i != mali_global_num_groups) {
+ /* We removed a group from the middle of the array -- move the last
+ * group to the current position to close the gap */
+ mali_global_groups[i] = mali_global_groups[mali_global_num_groups];
+ mali_global_groups[mali_global_num_groups] = NULL;
+ }
+
+ break;
+ }
+ }
+
+ if (NULL != group->timeout_timer) {
+ _mali_osk_timer_del(group->timeout_timer);
+ _mali_osk_timer_term(group->timeout_timer);
+ }
+
+ if (NULL != group->bottom_half_work_mmu) {
+ _mali_osk_wq_delete_work(group->bottom_half_work_mmu);
+ }
+
+ if (NULL != group->bottom_half_work_gp) {
+ _mali_osk_wq_delete_work(group->bottom_half_work_gp);
+ }
+
+ if (NULL != group->bottom_half_work_pp) {
+ _mali_osk_wq_delete_work(group->bottom_half_work_pp);
+ }
+
+ _mali_osk_free(group);
}
_mali_osk_errcode_t mali_group_add_mmu_core(struct mali_group *group, struct mali_mmu_core *mmu_core)
{
- /* This group object now owns the MMU core object */
- group->mmu = mmu_core;
- group->bottom_half_work_mmu = _mali_osk_wq_create_work(mali_group_bottom_half_mmu, group);
- if (NULL == group->bottom_half_work_mmu) {
- return _MALI_OSK_ERR_FAULT;
- }
- return _MALI_OSK_ERR_OK;
+ /* This group object now owns the MMU core object */
+ group->mmu = mmu_core;
+ group->bottom_half_work_mmu = _mali_osk_wq_create_work(mali_group_bottom_half_mmu, group);
+ if (NULL == group->bottom_half_work_mmu) {
+ return _MALI_OSK_ERR_FAULT;
+ }
+ return _MALI_OSK_ERR_OK;
}
void mali_group_remove_mmu_core(struct mali_group *group)
{
- /* This group object no longer owns the MMU core object */
- group->mmu = NULL;
- if (NULL != group->bottom_half_work_mmu) {
- _mali_osk_wq_delete_work(group->bottom_half_work_mmu);
- }
+ /* This group object no longer owns the MMU core object */
+ group->mmu = NULL;
+ if (NULL != group->bottom_half_work_mmu) {
+ _mali_osk_wq_delete_work(group->bottom_half_work_mmu);
+ }
}
_mali_osk_errcode_t mali_group_add_gp_core(struct mali_group *group, struct mali_gp_core *gp_core)
{
- /* This group object now owns the GP core object */
- group->gp_core = gp_core;
- group->bottom_half_work_gp = _mali_osk_wq_create_work(mali_group_bottom_half_gp, group);
- if (NULL == group->bottom_half_work_gp) {
- return _MALI_OSK_ERR_FAULT;
- }
- return _MALI_OSK_ERR_OK;
+ /* This group object now owns the GP core object */
+ group->gp_core = gp_core;
+ group->bottom_half_work_gp = _mali_osk_wq_create_work(mali_group_bottom_half_gp, group);
+ if (NULL == group->bottom_half_work_gp) {
+ return _MALI_OSK_ERR_FAULT;
+ }
+ return _MALI_OSK_ERR_OK;
}
void mali_group_remove_gp_core(struct mali_group *group)
{
- /* This group object no longer owns the GP core object */
- group->gp_core = NULL;
- if (NULL != group->bottom_half_work_gp) {
- _mali_osk_wq_delete_work(group->bottom_half_work_gp);
- }
+ /* This group object no longer owns the GP core object */
+ group->gp_core = NULL;
+ if (NULL != group->bottom_half_work_gp) {
+ _mali_osk_wq_delete_work(group->bottom_half_work_gp);
+ }
}
_mali_osk_errcode_t mali_group_add_pp_core(struct mali_group *group, struct mali_pp_core *pp_core)
{
- /* This group object now owns the PP core object */
- group->pp_core = pp_core;
- group->bottom_half_work_pp = _mali_osk_wq_create_work(mali_group_bottom_half_pp, group);
- if (NULL == group->bottom_half_work_pp) {
- return _MALI_OSK_ERR_FAULT;
- }
- return _MALI_OSK_ERR_OK;
+ /* This group object now owns the PP core object */
+ group->pp_core = pp_core;
+ group->bottom_half_work_pp = _mali_osk_wq_create_work(mali_group_bottom_half_pp, group);
+ if (NULL == group->bottom_half_work_pp) {
+ return _MALI_OSK_ERR_FAULT;
+ }
+ return _MALI_OSK_ERR_OK;
}
void mali_group_remove_pp_core(struct mali_group *group)
{
- /* This group object no longer owns the PP core object */
- group->pp_core = NULL;
- if (NULL != group->bottom_half_work_pp) {
- _mali_osk_wq_delete_work(group->bottom_half_work_pp);
- }
+ /* This group object no longer owns the PP core object */
+ group->pp_core = NULL;
+ if (NULL != group->bottom_half_work_pp) {
+ _mali_osk_wq_delete_work(group->bottom_half_work_pp);
+ }
}
enum mali_group_state mali_group_activate(struct mali_group *group)
{
- MALI_DEBUG_ASSERT_POINTER(group);
- MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
-
- MALI_DEBUG_PRINT(4, ("Group: Activating group %s\n",
- mali_group_core_description(group)));
-
- if (MALI_GROUP_STATE_INACTIVE == group->state) {
- /* Group is inactive, get PM refs in order to power up */
-
- /*
- * We'll take a maximum of 2 power domain references pr group,
- * one for the group itself, and one for it's L2 cache.
- */
- struct mali_pm_domain *domains[MALI_MAX_NUM_DOMAIN_REFS];
- struct mali_group *groups[MALI_MAX_NUM_DOMAIN_REFS];
- u32 num_domains = 0;
- mali_bool all_groups_on;
-
- /* Deal with child groups first */
- if (mali_group_is_virtual(group)) {
- /*
- * The virtual group might have 0, 1 or 2 L2s in
- * its l2_cache_core array, but we ignore these and
- * let the child groups take the needed L2 cache ref
- * on behalf of the virtual group.
- * In other words; The L2 refs are taken in pair with
- * the physical group which the L2 is attached to.
- */
- struct mali_group *child;
- struct mali_group *temp;
-
- /*
- * Child group is inactive, get PM
- * refs in order to power up.
- */
- _MALI_OSK_LIST_FOREACHENTRY(child, temp,
- &group->group_list,
- struct mali_group, group_list) {
- MALI_DEBUG_ASSERT(MALI_GROUP_STATE_INACTIVE
- == child->state);
-
- child->state = MALI_GROUP_STATE_ACTIVATION_PENDING;
-
- MALI_DEBUG_ASSERT_POINTER(
- child->pm_domain);
- domains[num_domains] = child->pm_domain;
- groups[num_domains] = child;
- num_domains++;
-
- /*
- * Take L2 domain ref for child group.
- */
- MALI_DEBUG_ASSERT(MALI_MAX_NUM_DOMAIN_REFS
- > num_domains);
- domains[num_domains] = mali_l2_cache_get_pm_domain(
- child->l2_cache_core[0]);
- groups[num_domains] = NULL;
- MALI_DEBUG_ASSERT(NULL ==
- child->l2_cache_core[1]);
- num_domains++;
- }
- } else {
- /* Take L2 domain ref for physical groups. */
- MALI_DEBUG_ASSERT(MALI_MAX_NUM_DOMAIN_REFS >
- num_domains);
-
- domains[num_domains] = mali_l2_cache_get_pm_domain(
- group->l2_cache_core[0]);
- groups[num_domains] = NULL;
- MALI_DEBUG_ASSERT(NULL == group->l2_cache_core[1]);
- num_domains++;
- }
-
- /* Do the group itself last (it's dependencies first) */
-
- group->state = MALI_GROUP_STATE_ACTIVATION_PENDING;
-
- MALI_DEBUG_ASSERT_POINTER(group->pm_domain);
- domains[num_domains] = group->pm_domain;
- groups[num_domains] = group;
- num_domains++;
-
- all_groups_on = mali_pm_get_domain_refs(domains, groups,
- num_domains);
-
- /*
- * Complete activation for group, include
- * virtual group or physical group.
- */
- if (MALI_TRUE == all_groups_on) {
-
- mali_group_set_active(group);
- }
- } else if (MALI_GROUP_STATE_ACTIVE == group->state) {
- /* Already active */
- MALI_DEBUG_ASSERT(MALI_TRUE == group->power_is_on);
- } else {
- /*
- * Activation already pending, group->power_is_on could
- * be both true or false. We need to wait for power up
- * notification anyway.
- */
- MALI_DEBUG_ASSERT(MALI_GROUP_STATE_ACTIVATION_PENDING
- == group->state);
- }
-
- MALI_DEBUG_PRINT(4, ("Group: group %s activation result: %s\n",
- mali_group_core_description(group),
- MALI_GROUP_STATE_ACTIVE == group->state ?
- "ACTIVE" : "PENDING"));
-
- return group->state;
+ MALI_DEBUG_ASSERT_POINTER(group);
+ MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
+
+ MALI_DEBUG_PRINT(4, ("Group: Activating group %s\n",
+ mali_group_core_description(group)));
+
+ if (MALI_GROUP_STATE_INACTIVE == group->state) {
+ /* Group is inactive, get PM refs in order to power up */
+
+ /*
+ * We'll take a maximum of 2 power domain references pr group,
+ * one for the group itself, and one for it's L2 cache.
+ */
+ struct mali_pm_domain *domains[MALI_MAX_NUM_DOMAIN_REFS];
+ struct mali_group *groups[MALI_MAX_NUM_DOMAIN_REFS];
+ u32 num_domains = 0;
+ mali_bool all_groups_on;
+
+ /* Deal with child groups first */
+ if (mali_group_is_virtual(group)) {
+ /*
+ * The virtual group might have 0, 1 or 2 L2s in
+ * its l2_cache_core array, but we ignore these and
+ * let the child groups take the needed L2 cache ref
+ * on behalf of the virtual group.
+ * In other words; The L2 refs are taken in pair with
+ * the physical group which the L2 is attached to.
+ */
+ struct mali_group *child;
+ struct mali_group *temp;
+
+ /*
+ * Child group is inactive, get PM
+ * refs in order to power up.
+ */
+ _MALI_OSK_LIST_FOREACHENTRY(child, temp,
+ &group->group_list,
+ struct mali_group, group_list) {
+ MALI_DEBUG_ASSERT(MALI_GROUP_STATE_INACTIVE
+ == child->state);
+
+ child->state = MALI_GROUP_STATE_ACTIVATION_PENDING;
+
+ MALI_DEBUG_ASSERT_POINTER(
+ child->pm_domain);
+ domains[num_domains] = child->pm_domain;
+ groups[num_domains] = child;
+ num_domains++;
+
+ /*
+ * Take L2 domain ref for child group.
+ */
+ MALI_DEBUG_ASSERT(MALI_MAX_NUM_DOMAIN_REFS
+ > num_domains);
+ domains[num_domains] = mali_l2_cache_get_pm_domain(
+ child->l2_cache_core[0]);
+ groups[num_domains] = NULL;
+ MALI_DEBUG_ASSERT(NULL ==
+ child->l2_cache_core[1]);
+ num_domains++;
+ }
+ } else {
+ /* Take L2 domain ref for physical groups. */
+ MALI_DEBUG_ASSERT(MALI_MAX_NUM_DOMAIN_REFS >
+ num_domains);
+
+ domains[num_domains] = mali_l2_cache_get_pm_domain(
+ group->l2_cache_core[0]);
+ groups[num_domains] = NULL;
+ MALI_DEBUG_ASSERT(NULL == group->l2_cache_core[1]);
+ num_domains++;
+ }
+
+ /* Do the group itself last (it's dependencies first) */
+
+ group->state = MALI_GROUP_STATE_ACTIVATION_PENDING;
+
+ MALI_DEBUG_ASSERT_POINTER(group->pm_domain);
+ domains[num_domains] = group->pm_domain;
+ groups[num_domains] = group;
+ num_domains++;
+
+ all_groups_on = mali_pm_get_domain_refs(domains, groups,
+ num_domains);
+
+ /*
+ * Complete activation for group, include
+ * virtual group or physical group.
+ */
+ if (MALI_TRUE == all_groups_on) {
+
+ mali_group_set_active(group);
+ }
+ } else if (MALI_GROUP_STATE_ACTIVE == group->state) {
+ /* Already active */
+ MALI_DEBUG_ASSERT(MALI_TRUE == group->power_is_on);
+ } else {
+ /*
+ * Activation already pending, group->power_is_on could
+ * be both true or false. We need to wait for power up
+ * notification anyway.
+ */
+ MALI_DEBUG_ASSERT(MALI_GROUP_STATE_ACTIVATION_PENDING
+ == group->state);
+ }
+
+ MALI_DEBUG_PRINT(4, ("Group: group %s activation result: %s\n",
+ mali_group_core_description(group),
+ MALI_GROUP_STATE_ACTIVE == group->state ?
+ "ACTIVE" : "PENDING"));
+
+ return group->state;
}
mali_bool mali_group_set_active(struct mali_group *group)
{
- MALI_DEBUG_ASSERT_POINTER(group);
- MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
- MALI_DEBUG_ASSERT(MALI_GROUP_STATE_ACTIVATION_PENDING == group->state);
- MALI_DEBUG_ASSERT(MALI_TRUE == group->power_is_on);
+ MALI_DEBUG_ASSERT_POINTER(group);
+ MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
+ MALI_DEBUG_ASSERT(MALI_GROUP_STATE_ACTIVATION_PENDING == group->state);
+ MALI_DEBUG_ASSERT(MALI_TRUE == group->power_is_on);
- MALI_DEBUG_PRINT(4, ("Group: Activation completed for %s\n",
- mali_group_core_description(group)));
+ MALI_DEBUG_PRINT(4, ("Group: Activation completed for %s\n",
+ mali_group_core_description(group)));
- if (mali_group_is_virtual(group)) {
- struct mali_group *child;
- struct mali_group *temp;
+ if (mali_group_is_virtual(group)) {
+ struct mali_group *child;
+ struct mali_group *temp;
- _MALI_OSK_LIST_FOREACHENTRY(child, temp, &group->group_list,
- struct mali_group, group_list) {
- if (MALI_TRUE != child->power_is_on) {
- return MALI_FALSE;
- }
+ _MALI_OSK_LIST_FOREACHENTRY(child, temp, &group->group_list,
+ struct mali_group, group_list) {
+ if (MALI_TRUE != child->power_is_on) {
+ return MALI_FALSE;
+ }
- child->state = MALI_GROUP_STATE_ACTIVE;
- }
+ child->state = MALI_GROUP_STATE_ACTIVE;
+ }
- mali_group_reset(group);
- }
+ mali_group_reset(group);
+ }
- /* Go to ACTIVE state */
- group->state = MALI_GROUP_STATE_ACTIVE;
+ /* Go to ACTIVE state */
+ group->state = MALI_GROUP_STATE_ACTIVE;
- return MALI_TRUE;
+ return MALI_TRUE;
}
mali_bool mali_group_deactivate(struct mali_group *group)
{
- struct mali_pm_domain *domains[MALI_MAX_NUM_DOMAIN_REFS];
- u32 num_domains = 0;
- mali_bool power_down = MALI_FALSE;
-
- MALI_DEBUG_ASSERT_POINTER(group);
- MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
- MALI_DEBUG_ASSERT(MALI_GROUP_STATE_INACTIVE != group->state);
-
- MALI_DEBUG_PRINT(3, ("Group: Deactivating group %s\n",
- mali_group_core_description(group)));
-
- group->state = MALI_GROUP_STATE_INACTIVE;
-
- MALI_DEBUG_ASSERT_POINTER(group->pm_domain);
- domains[num_domains] = group->pm_domain;
- num_domains++;
-
- if (mali_group_is_virtual(group)) {
- /* Release refs for all child groups */
- struct mali_group *child;
- struct mali_group *temp;
-
- _MALI_OSK_LIST_FOREACHENTRY(child, temp,
- &group->group_list,
- struct mali_group, group_list) {
- child->state = MALI_GROUP_STATE_INACTIVE;
-
- MALI_DEBUG_ASSERT_POINTER(child->pm_domain);
- domains[num_domains] = child->pm_domain;
- num_domains++;
-
- /* Release L2 cache domain for child groups */
- MALI_DEBUG_ASSERT(MALI_MAX_NUM_DOMAIN_REFS >
- num_domains);
- domains[num_domains] = mali_l2_cache_get_pm_domain(
- child->l2_cache_core[0]);
- MALI_DEBUG_ASSERT(NULL == child->l2_cache_core[1]);
- num_domains++;
- }
-
- /*
- * Must do mali_group_power_down() steps right here for
- * virtual group, because virtual group itself is likely to
- * stay powered on, however child groups are now very likely
- * to be powered off (and thus lose their state).
- */
-
- mali_group_clear_session(group);
- /*
- * Disable the broadcast unit (clear it's mask).
- * This is needed in case the GPU isn't actually
- * powered down at this point and groups are
- * removed from an inactive virtual group.
- * If not, then the broadcast unit will intercept
- * their interrupts!
- */
- mali_bcast_disable(group->bcast_core);
- } else {
- /* Release L2 cache domain for physical groups */
- MALI_DEBUG_ASSERT(MALI_MAX_NUM_DOMAIN_REFS >
- num_domains);
- domains[num_domains] = mali_l2_cache_get_pm_domain(
- group->l2_cache_core[0]);
- MALI_DEBUG_ASSERT(NULL == group->l2_cache_core[1]);
- num_domains++;
- }
-
- power_down = mali_pm_put_domain_refs(domains, num_domains);
-
- return power_down;
+ struct mali_pm_domain *domains[MALI_MAX_NUM_DOMAIN_REFS];
+ u32 num_domains = 0;
+ mali_bool power_down = MALI_FALSE;
+
+ MALI_DEBUG_ASSERT_POINTER(group);
+ MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
+ MALI_DEBUG_ASSERT(MALI_GROUP_STATE_INACTIVE != group->state);
+
+ MALI_DEBUG_PRINT(3, ("Group: Deactivating group %s\n",
+ mali_group_core_description(group)));
+
+ group->state = MALI_GROUP_STATE_INACTIVE;
+
+ MALI_DEBUG_ASSERT_POINTER(group->pm_domain);
+ domains[num_domains] = group->pm_domain;
+ num_domains++;
+
+ if (mali_group_is_virtual(group)) {
+ /* Release refs for all child groups */
+ struct mali_group *child;
+ struct mali_group *temp;
+
+ _MALI_OSK_LIST_FOREACHENTRY(child, temp,
+ &group->group_list,
+ struct mali_group, group_list) {
+ child->state = MALI_GROUP_STATE_INACTIVE;
+
+ MALI_DEBUG_ASSERT_POINTER(child->pm_domain);
+ domains[num_domains] = child->pm_domain;
+ num_domains++;
+
+ /* Release L2 cache domain for child groups */
+ MALI_DEBUG_ASSERT(MALI_MAX_NUM_DOMAIN_REFS >
+ num_domains);
+ domains[num_domains] = mali_l2_cache_get_pm_domain(
+ child->l2_cache_core[0]);
+ MALI_DEBUG_ASSERT(NULL == child->l2_cache_core[1]);
+ num_domains++;
+ }
+
+ /*
+ * Must do mali_group_power_down() steps right here for
+ * virtual group, because virtual group itself is likely to
+ * stay powered on, however child groups are now very likely
+ * to be powered off (and thus lose their state).
+ */
+
+ mali_group_clear_session(group);
+ /*
+ * Disable the broadcast unit (clear it's mask).
+ * This is needed in case the GPU isn't actually
+ * powered down at this point and groups are
+ * removed from an inactive virtual group.
+ * If not, then the broadcast unit will intercept
+ * their interrupts!
+ */
+ mali_bcast_disable(group->bcast_core);
+ } else {
+ /* Release L2 cache domain for physical groups */
+ MALI_DEBUG_ASSERT(MALI_MAX_NUM_DOMAIN_REFS >
+ num_domains);
+ domains[num_domains] = mali_l2_cache_get_pm_domain(
+ group->l2_cache_core[0]);
+ MALI_DEBUG_ASSERT(NULL == group->l2_cache_core[1]);
+ num_domains++;
+ }
+
+ power_down = mali_pm_put_domain_refs(domains, num_domains);
+
+ return power_down;
}
void mali_group_power_up(struct mali_group *group)
{
- MALI_DEBUG_ASSERT_POINTER(group);
- MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
-
- MALI_DEBUG_PRINT(3, ("Group: Power up for %s\n",
- mali_group_core_description(group)));
-
- group->power_is_on = MALI_TRUE;
-
- if (MALI_FALSE == mali_group_is_virtual(group)
- && MALI_FALSE == mali_group_is_in_virtual(group)) {
- mali_group_reset(group);
- }
-
- /*
- * When we just acquire only one physical group form virt group,
- * we should remove the bcast&dlbu mask from virt group and
- * reset bcast and dlbu core, although part of pp cores in virt
- * group maybe not be powered on.
- */
- if (MALI_TRUE == mali_group_is_virtual(group)) {
- mali_bcast_reset(group->bcast_core);
- mali_dlbu_update_mask(group->dlbu_core);
- }
+ MALI_DEBUG_ASSERT_POINTER(group);
+ MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
+
+ MALI_DEBUG_PRINT(3, ("Group: Power up for %s\n",
+ mali_group_core_description(group)));
+
+ group->power_is_on = MALI_TRUE;
+
+ if (MALI_FALSE == mali_group_is_virtual(group)
+ && MALI_FALSE == mali_group_is_in_virtual(group)) {
+ mali_group_reset(group);
+ }
+
+ /*
+ * When we just acquire only one physical group form virt group,
+ * we should remove the bcast&dlbu mask from virt group and
+ * reset bcast and dlbu core, although part of pp cores in virt
+ * group maybe not be powered on.
+ */
+ if (MALI_TRUE == mali_group_is_virtual(group)) {
+ mali_bcast_reset(group->bcast_core);
+ mali_dlbu_update_mask(group->dlbu_core);
+ }
}
void mali_group_power_down(struct mali_group *group)
{
- MALI_DEBUG_ASSERT_POINTER(group);
- MALI_DEBUG_ASSERT(MALI_TRUE == group->power_is_on);
- MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
-
- MALI_DEBUG_PRINT(3, ("Group: Power down for %s\n",
- mali_group_core_description(group)));
-
- group->power_is_on = MALI_FALSE;
-
- if (mali_group_is_virtual(group)) {
- /*
- * What we do for physical jobs in this function should
- * already have been done in mali_group_deactivate()
- * for virtual group.
- */
- MALI_DEBUG_ASSERT(NULL == group->session);
- } else {
- mali_group_clear_session(group);
- }
+ MALI_DEBUG_ASSERT_POINTER(group);
+ MALI_DEBUG_ASSERT(MALI_TRUE == group->power_is_on);
+ MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
+
+ MALI_DEBUG_PRINT(3, ("Group: Power down for %s\n",
+ mali_group_core_description(group)));
+
+ group->power_is_on = MALI_FALSE;
+
+ if (mali_group_is_virtual(group)) {
+ /*
+ * What we do for physical jobs in this function should
+ * already have been done in mali_group_deactivate()
+ * for virtual group.
+ */
+ MALI_DEBUG_ASSERT(NULL == group->session);
+ } else {
+ mali_group_clear_session(group);
+ }
}
MALI_DEBUG_CODE(static void mali_group_print_virtual(struct mali_group *vgroup)
-{
- u32 i;
- struct mali_group *group;
- struct mali_group *temp;
-
- MALI_DEBUG_PRINT(4, ("Virtual group %s (%p)\n",
- mali_group_core_description(vgroup),
- vgroup));
- MALI_DEBUG_PRINT(4, ("l2_cache_core[0] = %p, ref = %d\n", vgroup->l2_cache_core[0], vgroup->l2_cache_core_ref_count[0]));
- MALI_DEBUG_PRINT(4, ("l2_cache_core[1] = %p, ref = %d\n", vgroup->l2_cache_core[1], vgroup->l2_cache_core_ref_count[1]));
-
- i = 0;
- _MALI_OSK_LIST_FOREACHENTRY(group, temp, &vgroup->group_list, struct mali_group, group_list) {
- MALI_DEBUG_PRINT(4, ("[%d] %s (%p), l2_cache_core[0] = %p\n",
- i, mali_group_core_description(group),
- group, group->l2_cache_core[0]));
- i++;
- }
-})
+ {
+ u32 i;
+ struct mali_group *group;
+ struct mali_group *temp;
+
+ MALI_DEBUG_PRINT(4, ("Virtual group %s (%p)\n",
+ mali_group_core_description(vgroup),
+ vgroup));
+ MALI_DEBUG_PRINT(4, ("l2_cache_core[0] = %p, ref = %d\n", vgroup->l2_cache_core[0], vgroup->l2_cache_core_ref_count[0]));
+ MALI_DEBUG_PRINT(4, ("l2_cache_core[1] = %p, ref = %d\n", vgroup->l2_cache_core[1], vgroup->l2_cache_core_ref_count[1]));
+
+ i = 0;
+ _MALI_OSK_LIST_FOREACHENTRY(group, temp, &vgroup->group_list, struct mali_group, group_list) {
+ MALI_DEBUG_PRINT(4, ("[%d] %s (%p), l2_cache_core[0] = %p\n",
+ i, mali_group_core_description(group),
+ group, group->l2_cache_core[0]));
+ i++;
+ }
+ })
/**
* @brief Add child group to virtual group parent
*/
void mali_group_add_group(struct mali_group *parent, struct mali_group *child)
{
- mali_bool found;
- u32 i;
-
- MALI_DEBUG_PRINT(3, ("Adding group %s to virtual group %s\n",
- mali_group_core_description(child),
- mali_group_core_description(parent)));
-
- MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
- MALI_DEBUG_ASSERT(mali_group_is_virtual(parent));
- MALI_DEBUG_ASSERT(!mali_group_is_virtual(child));
- MALI_DEBUG_ASSERT(NULL == child->parent_group);
-
- _mali_osk_list_addtail(&child->group_list, &parent->group_list);
-
- child->parent_group = parent;
-
- MALI_DEBUG_ASSERT_POINTER(child->l2_cache_core[0]);
-
- MALI_DEBUG_PRINT(4, ("parent->l2_cache_core: [0] = %p, [1] = %p\n", parent->l2_cache_core[0], parent->l2_cache_core[1]));
- MALI_DEBUG_PRINT(4, ("child->l2_cache_core: [0] = %p, [1] = %p\n", child->l2_cache_core[0], child->l2_cache_core[1]));
-
- /* Keep track of the L2 cache cores of child groups */
- found = MALI_FALSE;
- for (i = 0; i < 2; i++) {
- if (parent->l2_cache_core[i] == child->l2_cache_core[0]) {
- MALI_DEBUG_ASSERT(parent->l2_cache_core_ref_count[i] > 0);
- parent->l2_cache_core_ref_count[i]++;
- found = MALI_TRUE;
- }
- }
-
- if (!found) {
- /* First time we see this L2 cache, add it to our list */
- i = (NULL == parent->l2_cache_core[0]) ? 0 : 1;
-
- MALI_DEBUG_PRINT(4, ("First time we see l2_cache %p. Adding to [%d] = %p\n", child->l2_cache_core[0], i, parent->l2_cache_core[i]));
-
- MALI_DEBUG_ASSERT(NULL == parent->l2_cache_core[i]);
-
- parent->l2_cache_core[i] = child->l2_cache_core[0];
- parent->l2_cache_core_ref_count[i]++;
- }
-
- /* Update Broadcast Unit and DLBU */
- mali_bcast_add_group(parent->bcast_core, child);
- mali_dlbu_add_group(parent->dlbu_core, child);
-
- if (MALI_TRUE == parent->power_is_on) {
- mali_bcast_reset(parent->bcast_core);
- mali_dlbu_update_mask(parent->dlbu_core);
- }
-
- if (MALI_TRUE == child->power_is_on) {
- if (NULL == parent->session) {
- if (NULL != child->session) {
- /*
- * Parent has no session, so clear
- * child session as well.
- */
- mali_mmu_activate_empty_page_directory(child->mmu);
- }
- } else {
- if (parent->session == child->session) {
- /* We already have same session as parent,
- * so a simple zap should be enough.
- */
- mali_mmu_zap_tlb(child->mmu);
- } else {
- /*
- * Parent has a different session, so we must
- * switch to that sessions page table
- */
- mali_mmu_activate_page_directory(child->mmu, mali_session_get_page_directory(parent->session));
- }
-
- /* It is the parent which keeps the session from now on */
- child->session = NULL;
- }
- } else {
- /* should have been cleared when child was powered down */
- MALI_DEBUG_ASSERT(NULL == child->session);
- }
-
- /* Start job on child when parent is active */
- if (NULL != parent->pp_running_job) {
- struct mali_pp_job *job = parent->pp_running_job;
-
- MALI_DEBUG_PRINT(3, ("Group %x joining running job %d on virtual group %x\n",
- child, mali_pp_job_get_id(job), parent));
-
- /* Only allowed to add active child to an active parent */
- MALI_DEBUG_ASSERT(MALI_GROUP_STATE_ACTIVE == parent->state);
- MALI_DEBUG_ASSERT(MALI_GROUP_STATE_ACTIVE == child->state);
-
- mali_pp_job_start(child->pp_core, job, mali_pp_core_get_id(child->pp_core), MALI_TRUE);
-
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_SINGLE |
- MALI_PROFILING_MAKE_EVENT_CHANNEL_PP(mali_pp_core_get_id(child->pp_core)) |
- MALI_PROFILING_EVENT_REASON_SINGLE_HW_FLUSH,
- mali_pp_job_get_frame_builder_id(job), mali_pp_job_get_flush_id(job), 0, 0, 0);
-
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_START |
- MALI_PROFILING_MAKE_EVENT_CHANNEL_PP(mali_pp_core_get_id(child->pp_core)) |
- MALI_PROFILING_EVENT_REASON_START_STOP_HW_VIRTUAL,
- mali_pp_job_get_pid(job), mali_pp_job_get_tid(job), 0, 0, 0);
+ mali_bool found;
+ u32 i;
+
+ MALI_DEBUG_PRINT(3, ("Adding group %s to virtual group %s\n",
+ mali_group_core_description(child),
+ mali_group_core_description(parent)));
+
+ MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
+ MALI_DEBUG_ASSERT(mali_group_is_virtual(parent));
+ MALI_DEBUG_ASSERT(!mali_group_is_virtual(child));
+ MALI_DEBUG_ASSERT(NULL == child->parent_group);
+
+ _mali_osk_list_addtail(&child->group_list, &parent->group_list);
+
+ child->parent_group = parent;
+
+ MALI_DEBUG_ASSERT_POINTER(child->l2_cache_core[0]);
+
+ MALI_DEBUG_PRINT(4, ("parent->l2_cache_core: [0] = %p, [1] = %p\n", parent->l2_cache_core[0], parent->l2_cache_core[1]));
+ MALI_DEBUG_PRINT(4, ("child->l2_cache_core: [0] = %p, [1] = %p\n", child->l2_cache_core[0], child->l2_cache_core[1]));
+
+ /* Keep track of the L2 cache cores of child groups */
+ found = MALI_FALSE;
+ for (i = 0; i < 2; i++) {
+ if (parent->l2_cache_core[i] == child->l2_cache_core[0]) {
+ MALI_DEBUG_ASSERT(parent->l2_cache_core_ref_count[i] > 0);
+ parent->l2_cache_core_ref_count[i]++;
+ found = MALI_TRUE;
+ }
+ }
+
+ if (!found) {
+ /* First time we see this L2 cache, add it to our list */
+ i = (NULL == parent->l2_cache_core[0]) ? 0 : 1;
+
+ MALI_DEBUG_PRINT(4, ("First time we see l2_cache %p. Adding to [%d] = %p\n", child->l2_cache_core[0], i, parent->l2_cache_core[i]));
+
+ MALI_DEBUG_ASSERT(NULL == parent->l2_cache_core[i]);
+
+ parent->l2_cache_core[i] = child->l2_cache_core[0];
+ parent->l2_cache_core_ref_count[i]++;
+ }
+
+ /* Update Broadcast Unit and DLBU */
+ mali_bcast_add_group(parent->bcast_core, child);
+ mali_dlbu_add_group(parent->dlbu_core, child);
+
+ if (MALI_TRUE == parent->power_is_on) {
+ mali_bcast_reset(parent->bcast_core);
+ mali_dlbu_update_mask(parent->dlbu_core);
+ }
+
+ if (MALI_TRUE == child->power_is_on) {
+ if (NULL == parent->session) {
+ if (NULL != child->session) {
+ /*
+ * Parent has no session, so clear
+ * child session as well.
+ */
+ mali_mmu_activate_empty_page_directory(child->mmu);
+ }
+ } else {
+ if (parent->session == child->session) {
+ /* We already have same session as parent,
+ * so a simple zap should be enough.
+ */
+ mali_mmu_zap_tlb(child->mmu);
+ } else {
+ /*
+ * Parent has a different session, so we must
+ * switch to that sessions page table
+ */
+ mali_mmu_activate_page_directory(child->mmu, mali_session_get_page_directory(parent->session));
+ }
+
+ /* It is the parent which keeps the session from now on */
+ child->session = NULL;
+ }
+ } else {
+ /* should have been cleared when child was powered down */
+ MALI_DEBUG_ASSERT(NULL == child->session);
+ }
+
+ /* Start job on child when parent is active */
+ if (NULL != parent->pp_running_job) {
+ struct mali_pp_job *job = parent->pp_running_job;
+
+ MALI_DEBUG_PRINT(3, ("Group %x joining running job %d on virtual group %x\n",
+ child, mali_pp_job_get_id(job), parent));
+
+ /* Only allowed to add active child to an active parent */
+ MALI_DEBUG_ASSERT(MALI_GROUP_STATE_ACTIVE == parent->state);
+ MALI_DEBUG_ASSERT(MALI_GROUP_STATE_ACTIVE == child->state);
+
+ mali_pp_job_start(child->pp_core, job, mali_pp_core_get_id(child->pp_core), MALI_TRUE);
+
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_SINGLE |
+ MALI_PROFILING_MAKE_EVENT_CHANNEL_PP(mali_pp_core_get_id(child->pp_core)) |
+ MALI_PROFILING_EVENT_REASON_SINGLE_HW_FLUSH,
+ mali_pp_job_get_frame_builder_id(job), mali_pp_job_get_flush_id(job), 0, 0, 0);
+
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_START |
+ MALI_PROFILING_MAKE_EVENT_CHANNEL_PP(mali_pp_core_get_id(child->pp_core)) |
+ MALI_PROFILING_EVENT_REASON_START_STOP_HW_VIRTUAL,
+ mali_pp_job_get_pid(job), mali_pp_job_get_tid(job), 0, 0, 0);
#if defined(CONFIG_GPU_TRACEPOINTS) && defined(CONFIG_TRACEPOINTS)
- trace_gpu_sched_switch(
- mali_pp_core_description(group->pp_core),
- sched_clock(), mali_pp_job_get_tid(job),
- 0, mali_pp_job_get_id(job));
+ trace_gpu_sched_switch(
+ mali_pp_core_description(group->pp_core),
+ sched_clock(), mali_pp_job_get_tid(job),
+ 0, mali_pp_job_get_id(job));
#endif
#if defined(CONFIG_MALI400_PROFILING)
- trace_mali_core_active(mali_pp_job_get_pid(job), 1 /* active */, 0 /* PP */, mali_pp_core_get_id(child->pp_core),
- mali_pp_job_get_frame_builder_id(job), mali_pp_job_get_flush_id(job));
+ trace_mali_core_active(mali_pp_job_get_pid(job), 1 /* active */, 0 /* PP */, mali_pp_core_get_id(child->pp_core),
+ mali_pp_job_get_frame_builder_id(job), mali_pp_job_get_flush_id(job));
#endif
- }
+ }
- MALI_DEBUG_CODE(mali_group_print_virtual(parent);)
+ MALI_DEBUG_CODE(mali_group_print_virtual(parent);)
}
/**
*/
void mali_group_remove_group(struct mali_group *parent, struct mali_group *child)
{
- u32 i;
+ u32 i;
- MALI_DEBUG_PRINT(3, ("Removing group %s from virtual group %s\n",
- mali_group_core_description(child),
- mali_group_core_description(parent)));
+ MALI_DEBUG_PRINT(3, ("Removing group %s from virtual group %s\n",
+ mali_group_core_description(child),
+ mali_group_core_description(parent)));
- MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
- MALI_DEBUG_ASSERT(mali_group_is_virtual(parent));
- MALI_DEBUG_ASSERT(!mali_group_is_virtual(child));
- MALI_DEBUG_ASSERT(parent == child->parent_group);
+ MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
+ MALI_DEBUG_ASSERT(mali_group_is_virtual(parent));
+ MALI_DEBUG_ASSERT(!mali_group_is_virtual(child));
+ MALI_DEBUG_ASSERT(parent == child->parent_group);
- /* Update Broadcast Unit and DLBU */
- mali_bcast_remove_group(parent->bcast_core, child);
- mali_dlbu_remove_group(parent->dlbu_core, child);
+ /* Update Broadcast Unit and DLBU */
+ mali_bcast_remove_group(parent->bcast_core, child);
+ mali_dlbu_remove_group(parent->dlbu_core, child);
- if (MALI_TRUE == parent->power_is_on) {
- mali_bcast_reset(parent->bcast_core);
- mali_dlbu_update_mask(parent->dlbu_core);
- }
+ if (MALI_TRUE == parent->power_is_on) {
+ mali_bcast_reset(parent->bcast_core);
+ mali_dlbu_update_mask(parent->dlbu_core);
+ }
- child->session = parent->session;
- child->parent_group = NULL;
+ child->session = parent->session;
+ child->parent_group = NULL;
- _mali_osk_list_delinit(&child->group_list);
- if (_mali_osk_list_empty(&parent->group_list)) {
- parent->session = NULL;
- }
+ _mali_osk_list_delinit(&child->group_list);
+ if (_mali_osk_list_empty(&parent->group_list)) {
+ parent->session = NULL;
+ }
- /* Keep track of the L2 cache cores of child groups */
- i = (child->l2_cache_core[0] == parent->l2_cache_core[0]) ? 0 : 1;
+ /* Keep track of the L2 cache cores of child groups */
+ i = (child->l2_cache_core[0] == parent->l2_cache_core[0]) ? 0 : 1;
- MALI_DEBUG_ASSERT(child->l2_cache_core[0] == parent->l2_cache_core[i]);
+ MALI_DEBUG_ASSERT(child->l2_cache_core[0] == parent->l2_cache_core[i]);
- parent->l2_cache_core_ref_count[i]--;
- if (parent->l2_cache_core_ref_count[i] == 0) {
- parent->l2_cache_core[i] = NULL;
- }
+ parent->l2_cache_core_ref_count[i]--;
+ if (parent->l2_cache_core_ref_count[i] == 0) {
+ parent->l2_cache_core[i] = NULL;
+ }
- MALI_DEBUG_CODE(mali_group_print_virtual(parent));
+ MALI_DEBUG_CODE(mali_group_print_virtual(parent));
}
struct mali_group *mali_group_acquire_group(struct mali_group *parent)
{
- struct mali_group *child = NULL;
+ struct mali_group *child = NULL;
- MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
- MALI_DEBUG_ASSERT(mali_group_is_virtual(parent));
+ MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
+ MALI_DEBUG_ASSERT(mali_group_is_virtual(parent));
- if (!_mali_osk_list_empty(&parent->group_list)) {
- child = _MALI_OSK_LIST_ENTRY(parent->group_list.prev, struct mali_group, group_list);
- mali_group_remove_group(parent, child);
- }
+ if (!_mali_osk_list_empty(&parent->group_list)) {
+ child = _MALI_OSK_LIST_ENTRY(parent->group_list.prev, struct mali_group, group_list);
+ mali_group_remove_group(parent, child);
+ }
- if (NULL != child) {
- if (MALI_GROUP_STATE_ACTIVE != parent->state
- && MALI_TRUE == child->power_is_on) {
- mali_group_reset(child);
- }
- }
+ if (NULL != child) {
+ if (MALI_GROUP_STATE_ACTIVE != parent->state
+ && MALI_TRUE == child->power_is_on) {
+ mali_group_reset(child);
+ }
+ }
- return child;
+ return child;
}
void mali_group_reset(struct mali_group *group)
{
- 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)));
-
- if (NULL != group->dlbu_core) {
- mali_dlbu_reset(group->dlbu_core);
- }
-
- if (NULL != group->bcast_core) {
- mali_bcast_reset(group->bcast_core);
- }
-
- MALI_DEBUG_ASSERT(NULL != group->mmu);
- mali_group_reset_mmu(group);
-
- if (NULL != group->gp_core) {
- MALI_DEBUG_ASSERT(NULL == group->pp_core);
- mali_gp_reset(group->gp_core);
- } else {
- MALI_DEBUG_ASSERT(NULL != group->pp_core);
- mali_group_reset_pp(group);
- }
+ 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)));
+
+ if (NULL != group->dlbu_core) {
+ mali_dlbu_reset(group->dlbu_core);
+ }
+
+ if (NULL != group->bcast_core) {
+ mali_bcast_reset(group->bcast_core);
+ }
+
+ MALI_DEBUG_ASSERT(NULL != group->mmu);
+ mali_group_reset_mmu(group);
+
+ if (NULL != group->gp_core) {
+ MALI_DEBUG_ASSERT(NULL == group->pp_core);
+ mali_gp_reset(group->gp_core);
+ } else {
+ MALI_DEBUG_ASSERT(NULL != group->pp_core);
+ mali_group_reset_pp(group);
+ }
}
void mali_group_start_gp_job(struct mali_group *group, struct mali_gp_job *job)
{
- struct mali_session_data *session;
+ struct mali_session_data *session;
- MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
+ MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
- MALI_DEBUG_PRINT(3, ("Group: Starting GP job 0x%08X on group %s\n",
- job,
- mali_group_core_description(group)));
+ MALI_DEBUG_PRINT(3, ("Group: Starting GP job 0x%08X on group %s\n",
+ job,
+ mali_group_core_description(group)));
- session = mali_gp_job_get_session(job);
+ session = mali_gp_job_get_session(job);
- 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_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);
+ mali_group_activate_page_directory(group, session);
- mali_gp_job_start(group->gp_core, job);
+ mali_gp_job_start(group->gp_core, job);
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_SINGLE |
- MALI_PROFILING_MAKE_EVENT_CHANNEL_GP(0) |
- MALI_PROFILING_EVENT_REASON_SINGLE_HW_FLUSH,
- mali_gp_job_get_frame_builder_id(job), mali_gp_job_get_flush_id(job), 0, 0, 0);
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_START |
- MALI_PROFILING_MAKE_EVENT_CHANNEL_GP(0),
- mali_gp_job_get_pid(job), mali_gp_job_get_tid(job), 0, 0, 0);
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_SINGLE |
+ MALI_PROFILING_MAKE_EVENT_CHANNEL_GP(0) |
+ MALI_PROFILING_EVENT_REASON_SINGLE_HW_FLUSH,
+ mali_gp_job_get_frame_builder_id(job), mali_gp_job_get_flush_id(job), 0, 0, 0);
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_START |
+ MALI_PROFILING_MAKE_EVENT_CHANNEL_GP(0),
+ mali_gp_job_get_pid(job), mali_gp_job_get_tid(job), 0, 0, 0);
#if defined(CONFIG_MALI400_PROFILING)
- trace_mali_core_active(mali_gp_job_get_pid(job), 1 /* active */, 1 /* GP */, 0 /* core */,
- mali_gp_job_get_frame_builder_id(job), mali_gp_job_get_flush_id(job));
+ trace_mali_core_active(mali_gp_job_get_pid(job), 1 /* active */, 1 /* GP */, 0 /* core */,
+ mali_gp_job_get_frame_builder_id(job), mali_gp_job_get_flush_id(job));
#endif
#if defined(CONFIG_MALI400_PROFILING)
- if ((MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src0(group->l2_cache_core[0])) &&
- (MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src1(group->l2_cache_core[0]))) {
- mali_group_report_l2_cache_counters_per_core(group, 0);
- }
+ if ((MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src0(group->l2_cache_core[0])) &&
+ (MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src1(group->l2_cache_core[0]))) {
+ mali_group_report_l2_cache_counters_per_core(group, 0);
+ }
#endif /* #if defined(CONFIG_MALI400_PROFILING) */
#if defined(CONFIG_GPU_TRACEPOINTS) && defined(CONFIG_TRACEPOINTS)
- trace_gpu_sched_switch(mali_gp_core_description(group->gp_core),
- sched_clock(), mali_gp_job_get_tid(job),
- 0, mali_gp_job_get_id(job));
+ trace_gpu_sched_switch(mali_gp_core_description(group->gp_core),
+ sched_clock(), mali_gp_job_get_tid(job),
+ 0, mali_gp_job_get_id(job));
#endif
- group->gp_running_job = job;
- group->is_working = MALI_TRUE;
+ group->gp_running_job = job;
+ group->is_working = MALI_TRUE;
- /* Setup SW timer and record start time */
- group->start_time = _mali_osk_time_tickcount();
- _mali_osk_timer_mod(group->timeout_timer, _mali_osk_time_mstoticks(mali_max_job_runtime));
+ /* Setup SW timer and record start time */
+ group->start_time = _mali_osk_time_tickcount();
+ _mali_osk_timer_mod(group->timeout_timer, _mali_osk_time_mstoticks(mali_max_job_runtime));
- MALI_DEBUG_PRINT(4, ("Group: Started GP job 0x%08X on group %s at %u\n",
- job,
- mali_group_core_description(group),
- group->start_time));
+ MALI_DEBUG_PRINT(4, ("Group: Started GP job 0x%08X on group %s at %u\n",
+ job,
+ mali_group_core_description(group),
+ group->start_time));
}
/* Used to set all the registers except frame renderer list address and fragment shader stack address
*/
void mali_group_start_pp_job(struct mali_group *group, struct mali_pp_job *job, u32 sub_job)
{
- struct mali_session_data *session;
+ struct mali_session_data *session;
- MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
+ MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
- MALI_DEBUG_PRINT(3, ("Group: Starting PP job 0x%08X part %u/%u on group %s\n",
- job, sub_job + 1,
- mali_pp_job_get_sub_job_count(job),
- mali_group_core_description(group)));
+ MALI_DEBUG_PRINT(3, ("Group: Starting PP job 0x%08X part %u/%u on group %s\n",
+ job, sub_job + 1,
+ mali_pp_job_get_sub_job_count(job),
+ mali_group_core_description(group)));
- session = mali_pp_job_get_session(job);
+ session = mali_pp_job_get_session(job);
- if (NULL != group->l2_cache_core[0]) {
- mali_l2_cache_invalidate_conditional(group->l2_cache_core[0], mali_pp_job_get_cache_order(job));
- }
+ if (NULL != group->l2_cache_core[0]) {
+ mali_l2_cache_invalidate_conditional(group->l2_cache_core[0], mali_pp_job_get_cache_order(job));
+ }
- if (NULL != group->l2_cache_core[1]) {
- mali_l2_cache_invalidate_conditional(group->l2_cache_core[1], mali_pp_job_get_cache_order(job));
- }
+ if (NULL != group->l2_cache_core[1]) {
+ mali_l2_cache_invalidate_conditional(group->l2_cache_core[1], mali_pp_job_get_cache_order(job));
+ }
- mali_group_activate_page_directory(group, session);
+ mali_group_activate_page_directory(group, session);
- if (mali_group_is_virtual(group)) {
- struct mali_group *child;
- struct mali_group *temp;
- u32 core_num = 0;
+ if (mali_group_is_virtual(group)) {
+ struct mali_group *child;
+ struct mali_group *temp;
+ u32 core_num = 0;
- MALI_DEBUG_ASSERT(mali_pp_job_is_virtual(job));
+ MALI_DEBUG_ASSERT(mali_pp_job_is_virtual(job));
- /* Configure DLBU for the job */
- mali_dlbu_config_job(group->dlbu_core, job);
+ /* Configure DLBU for the job */
+ mali_dlbu_config_job(group->dlbu_core, job);
- /* Write stack address for each child group */
- _MALI_OSK_LIST_FOREACHENTRY(child, temp, &group->group_list, struct mali_group, group_list) {
- mali_pp_write_addr_stack(child->pp_core, job);
- core_num++;
- }
+ /* Write stack address for each child group */
+ _MALI_OSK_LIST_FOREACHENTRY(child, temp, &group->group_list, struct mali_group, group_list) {
+ mali_pp_write_addr_stack(child->pp_core, job);
+ core_num++;
+ }
- mali_pp_job_start(group->pp_core, job, sub_job, MALI_FALSE);
- } else {
- mali_pp_job_start(group->pp_core, job, sub_job, MALI_FALSE);
- }
+ mali_pp_job_start(group->pp_core, job, sub_job, MALI_FALSE);
+ } else {
+ mali_pp_job_start(group->pp_core, job, sub_job, MALI_FALSE);
+ }
- /* if the group is virtual, loop through physical groups which belong to this group
- * and call profiling events for its cores as virtual */
- if (MALI_TRUE == mali_group_is_virtual(group)) {
- struct mali_group *child;
- struct mali_group *temp;
+ /* if the group is virtual, loop through physical groups which belong to this group
+ * and call profiling events for its cores as virtual */
+ if (MALI_TRUE == mali_group_is_virtual(group)) {
+ struct mali_group *child;
+ struct mali_group *temp;
- _MALI_OSK_LIST_FOREACHENTRY(child, temp, &group->group_list, struct mali_group, group_list) {
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_SINGLE |
- MALI_PROFILING_MAKE_EVENT_CHANNEL_PP(mali_pp_core_get_id(child->pp_core)) |
- MALI_PROFILING_EVENT_REASON_SINGLE_HW_FLUSH,
- mali_pp_job_get_frame_builder_id(job), mali_pp_job_get_flush_id(job), 0, 0, 0);
+ _MALI_OSK_LIST_FOREACHENTRY(child, temp, &group->group_list, struct mali_group, group_list) {
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_SINGLE |
+ MALI_PROFILING_MAKE_EVENT_CHANNEL_PP(mali_pp_core_get_id(child->pp_core)) |
+ MALI_PROFILING_EVENT_REASON_SINGLE_HW_FLUSH,
+ mali_pp_job_get_frame_builder_id(job), mali_pp_job_get_flush_id(job), 0, 0, 0);
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_START |
- MALI_PROFILING_MAKE_EVENT_CHANNEL_PP(mali_pp_core_get_id(child->pp_core)) |
- MALI_PROFILING_EVENT_REASON_START_STOP_HW_VIRTUAL,
- mali_pp_job_get_pid(job), mali_pp_job_get_tid(job), 0, 0, 0);
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_START |
+ MALI_PROFILING_MAKE_EVENT_CHANNEL_PP(mali_pp_core_get_id(child->pp_core)) |
+ MALI_PROFILING_EVENT_REASON_START_STOP_HW_VIRTUAL,
+ mali_pp_job_get_pid(job), mali_pp_job_get_tid(job), 0, 0, 0);
#if defined(CONFIG_MALI400_PROFILING)
- trace_mali_core_active(mali_pp_job_get_pid(job), 1 /* active */, 0 /* PP */, mali_pp_core_get_id(child->pp_core),
- mali_pp_job_get_frame_builder_id(job), mali_pp_job_get_flush_id(job));
+ trace_mali_core_active(mali_pp_job_get_pid(job), 1 /* active */, 0 /* PP */, mali_pp_core_get_id(child->pp_core),
+ mali_pp_job_get_frame_builder_id(job), mali_pp_job_get_flush_id(job));
#endif
- }
+ }
#if defined(CONFIG_MALI400_PROFILING)
- if (0 != group->l2_cache_core_ref_count[0]) {
- if ((MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src0(group->l2_cache_core[0])) &&
- (MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src1(group->l2_cache_core[0]))) {
- mali_group_report_l2_cache_counters_per_core(group, mali_l2_cache_get_id(group->l2_cache_core[0]));
- }
- }
- if (0 != group->l2_cache_core_ref_count[1]) {
- if ((MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src0(group->l2_cache_core[1])) &&
- (MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src1(group->l2_cache_core[1]))) {
- mali_group_report_l2_cache_counters_per_core(group, mali_l2_cache_get_id(group->l2_cache_core[1]));
- }
- }
+ if (0 != group->l2_cache_core_ref_count[0]) {
+ if ((MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src0(group->l2_cache_core[0])) &&
+ (MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src1(group->l2_cache_core[0]))) {
+ mali_group_report_l2_cache_counters_per_core(group, mali_l2_cache_get_id(group->l2_cache_core[0]));
+ }
+ }
+ if (0 != group->l2_cache_core_ref_count[1]) {
+ if ((MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src0(group->l2_cache_core[1])) &&
+ (MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src1(group->l2_cache_core[1]))) {
+ mali_group_report_l2_cache_counters_per_core(group, mali_l2_cache_get_id(group->l2_cache_core[1]));
+ }
+ }
#endif /* #if defined(CONFIG_MALI400_PROFILING) */
- } else { /* group is physical - call profiling events for physical cores */
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_SINGLE |
- MALI_PROFILING_MAKE_EVENT_CHANNEL_PP(mali_pp_core_get_id(group->pp_core)) |
- MALI_PROFILING_EVENT_REASON_SINGLE_HW_FLUSH,
- mali_pp_job_get_frame_builder_id(job), mali_pp_job_get_flush_id(job), 0, 0, 0);
+ } else { /* group is physical - call profiling events for physical cores */
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_SINGLE |
+ MALI_PROFILING_MAKE_EVENT_CHANNEL_PP(mali_pp_core_get_id(group->pp_core)) |
+ MALI_PROFILING_EVENT_REASON_SINGLE_HW_FLUSH,
+ mali_pp_job_get_frame_builder_id(job), mali_pp_job_get_flush_id(job), 0, 0, 0);
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_START |
- MALI_PROFILING_MAKE_EVENT_CHANNEL_PP(mali_pp_core_get_id(group->pp_core)) |
- MALI_PROFILING_EVENT_REASON_START_STOP_HW_PHYSICAL,
- mali_pp_job_get_pid(job), mali_pp_job_get_tid(job), 0, 0, 0);
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_START |
+ MALI_PROFILING_MAKE_EVENT_CHANNEL_PP(mali_pp_core_get_id(group->pp_core)) |
+ MALI_PROFILING_EVENT_REASON_START_STOP_HW_PHYSICAL,
+ mali_pp_job_get_pid(job), mali_pp_job_get_tid(job), 0, 0, 0);
#if defined(CONFIG_MALI400_PROFILING)
- trace_mali_core_active(mali_pp_job_get_pid(job), 1 /* active */, 0 /* PP */, mali_pp_core_get_id(group->pp_core),
- mali_pp_job_get_frame_builder_id(job), mali_pp_job_get_flush_id(job));
+ trace_mali_core_active(mali_pp_job_get_pid(job), 1 /* active */, 0 /* PP */, mali_pp_core_get_id(group->pp_core),
+ mali_pp_job_get_frame_builder_id(job), mali_pp_job_get_flush_id(job));
#endif
#if defined(CONFIG_MALI400_PROFILING)
- if ((MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src0(group->l2_cache_core[0])) &&
- (MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src1(group->l2_cache_core[0]))) {
- mali_group_report_l2_cache_counters_per_core(group, mali_l2_cache_get_id(group->l2_cache_core[0]));
- }
+ if ((MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src0(group->l2_cache_core[0])) &&
+ (MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src1(group->l2_cache_core[0]))) {
+ mali_group_report_l2_cache_counters_per_core(group, mali_l2_cache_get_id(group->l2_cache_core[0]));
+ }
#endif /* #if defined(CONFIG_MALI400_PROFILING) */
- }
+ }
#if defined(CONFIG_GPU_TRACEPOINTS) && defined(CONFIG_TRACEPOINTS)
- trace_gpu_sched_switch(mali_pp_core_description(group->pp_core),
- sched_clock(), mali_pp_job_get_tid(job),
- 0, mali_pp_job_get_id(job));
+ trace_gpu_sched_switch(mali_pp_core_description(group->pp_core),
+ sched_clock(), mali_pp_job_get_tid(job),
+ 0, mali_pp_job_get_id(job));
#endif
- group->pp_running_job = job;
- group->pp_running_sub_job = sub_job;
- group->is_working = MALI_TRUE;
+ group->pp_running_job = job;
+ group->pp_running_sub_job = sub_job;
+ group->is_working = MALI_TRUE;
- /* Setup SW timer and record start time */
- group->start_time = _mali_osk_time_tickcount();
- _mali_osk_timer_mod(group->timeout_timer, _mali_osk_time_mstoticks(mali_max_job_runtime));
+ /* Setup SW timer and record start time */
+ group->start_time = _mali_osk_time_tickcount();
+ _mali_osk_timer_mod(group->timeout_timer, _mali_osk_time_mstoticks(mali_max_job_runtime));
- MALI_DEBUG_PRINT(4, ("Group: Started PP job 0x%08X part %u/%u on group %s at %u\n",
- job, sub_job + 1,
- mali_pp_job_get_sub_job_count(job),
- mali_group_core_description(group),
- group->start_time));
+ MALI_DEBUG_PRINT(4, ("Group: Started PP job 0x%08X part %u/%u on group %s at %u\n",
+ job, sub_job + 1,
+ mali_pp_job_get_sub_job_count(job),
+ mali_group_core_description(group),
+ group->start_time));
}
void mali_group_resume_gp_with_new_heap(struct mali_group *group, u32 job_id, u32 start_addr, u32 end_addr)
{
- MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
+ MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
- MALI_DEBUG_ASSERT_POINTER(group->l2_cache_core[0]);
- mali_l2_cache_invalidate(group->l2_cache_core[0]);
+ MALI_DEBUG_ASSERT_POINTER(group->l2_cache_core[0]);
+ mali_l2_cache_invalidate(group->l2_cache_core[0]);
- mali_mmu_zap_tlb_without_stall(group->mmu);
+ mali_mmu_zap_tlb_without_stall(group->mmu);
- mali_gp_resume_with_new_heap(group->gp_core, start_addr, end_addr);
+ mali_gp_resume_with_new_heap(group->gp_core, start_addr, end_addr);
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_RESUME |
- MALI_PROFILING_MAKE_EVENT_CHANNEL_GP(0),
- 0, 0, 0, 0, 0);
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_RESUME |
+ MALI_PROFILING_MAKE_EVENT_CHANNEL_GP(0),
+ 0, 0, 0, 0, 0);
#if defined(CONFIG_MALI400_PROFILING)
- trace_mali_core_active(mali_gp_job_get_pid(group->gp_running_job), 1 /* active */, 1 /* GP */, 0 /* core */,
- mali_gp_job_get_frame_builder_id(group->gp_running_job), mali_gp_job_get_flush_id(group->gp_running_job));
+ trace_mali_core_active(mali_gp_job_get_pid(group->gp_running_job), 1 /* active */, 1 /* GP */, 0 /* core */,
+ mali_gp_job_get_frame_builder_id(group->gp_running_job), mali_gp_job_get_flush_id(group->gp_running_job));
#endif
}
static void mali_group_reset_mmu(struct mali_group *group)
{
- struct mali_group *child;
- struct mali_group *temp;
- _mali_osk_errcode_t err;
-
- MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
-
- if (!mali_group_is_virtual(group)) {
- /* This is a physical group or an idle virtual group -- simply wait for
- * the reset to complete. */
- err = mali_mmu_reset(group->mmu);
- MALI_DEBUG_ASSERT(_MALI_OSK_ERR_OK == err);
- } else { /* virtual group */
- /* Loop through all members of this virtual group and wait
- * until they are done resetting.
- */
- _MALI_OSK_LIST_FOREACHENTRY(child, temp, &group->group_list, struct mali_group, group_list) {
- err = mali_mmu_reset(child->mmu);
- MALI_DEBUG_ASSERT(_MALI_OSK_ERR_OK == err);
- }
- }
+ struct mali_group *child;
+ struct mali_group *temp;
+ _mali_osk_errcode_t err;
+
+ MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
+
+ if (!mali_group_is_virtual(group)) {
+ /* This is a physical group or an idle virtual group -- simply wait for
+ * the reset to complete. */
+ err = mali_mmu_reset(group->mmu);
+ MALI_DEBUG_ASSERT(_MALI_OSK_ERR_OK == err);
+ } else { /* virtual group */
+ /* Loop through all members of this virtual group and wait
+ * until they are done resetting.
+ */
+ _MALI_OSK_LIST_FOREACHENTRY(child, temp, &group->group_list, struct mali_group, group_list) {
+ err = mali_mmu_reset(child->mmu);
+ MALI_DEBUG_ASSERT(_MALI_OSK_ERR_OK == err);
+ }
+ }
}
static void mali_group_reset_pp(struct mali_group *group)
{
- struct mali_group *child;
- struct mali_group *temp;
-
- MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
-
- mali_pp_reset_async(group->pp_core);
-
- if (!mali_group_is_virtual(group) || NULL == group->pp_running_job) {
- /* This is a physical group or an idle virtual group -- simply wait for
- * the reset to complete. */
- mali_pp_reset_wait(group->pp_core);
- } else {
- /* Loop through all members of this virtual group and wait until they
- * are done resetting.
- */
- _MALI_OSK_LIST_FOREACHENTRY(child, temp, &group->group_list, struct mali_group, group_list) {
- mali_pp_reset_wait(child->pp_core);
- }
- }
+ struct mali_group *child;
+ struct mali_group *temp;
+
+ MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
+
+ mali_pp_reset_async(group->pp_core);
+
+ if (!mali_group_is_virtual(group) || NULL == group->pp_running_job) {
+ /* This is a physical group or an idle virtual group -- simply wait for
+ * the reset to complete. */
+ mali_pp_reset_wait(group->pp_core);
+ } else {
+ /* Loop through all members of this virtual group and wait until they
+ * are done resetting.
+ */
+ _MALI_OSK_LIST_FOREACHENTRY(child, temp, &group->group_list, struct mali_group, group_list) {
+ mali_pp_reset_wait(child->pp_core);
+ }
+ }
}
struct mali_pp_job *mali_group_complete_pp(struct mali_group *group, mali_bool success, u32 *sub_job)
{
- struct mali_pp_job *pp_job_to_return;
+ struct mali_pp_job *pp_job_to_return;
- MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
- MALI_DEBUG_ASSERT_POINTER(group);
- MALI_DEBUG_ASSERT_POINTER(group->pp_core);
- MALI_DEBUG_ASSERT_POINTER(group->pp_running_job);
- MALI_DEBUG_ASSERT_POINTER(sub_job);
- MALI_DEBUG_ASSERT(MALI_TRUE == group->is_working);
+ MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
+ MALI_DEBUG_ASSERT_POINTER(group);
+ MALI_DEBUG_ASSERT_POINTER(group->pp_core);
+ MALI_DEBUG_ASSERT_POINTER(group->pp_running_job);
+ MALI_DEBUG_ASSERT_POINTER(sub_job);
+ MALI_DEBUG_ASSERT(MALI_TRUE == group->is_working);
- /* Stop/clear the timeout timer. */
- _mali_osk_timer_del_async(group->timeout_timer);
+ /* Stop/clear the timeout timer. */
+ _mali_osk_timer_del_async(group->timeout_timer);
- if (NULL != group->pp_running_job) {
+ if (NULL != group->pp_running_job) {
- /* Deal with HW counters and profiling */
+ /* Deal with HW counters and profiling */
- if (MALI_TRUE == mali_group_is_virtual(group)) {
- struct mali_group *child;
- struct mali_group *temp;
+ if (MALI_TRUE == mali_group_is_virtual(group)) {
+ struct mali_group *child;
+ struct mali_group *temp;
- /* update performance counters from each physical pp core within this virtual group */
- _MALI_OSK_LIST_FOREACHENTRY(child, temp, &group->group_list, struct mali_group, group_list) {
- mali_pp_update_performance_counters(group->pp_core, child->pp_core, group->pp_running_job, mali_pp_core_get_id(child->pp_core));
- }
+ /* update performance counters from each physical pp core within this virtual group */
+ _MALI_OSK_LIST_FOREACHENTRY(child, temp, &group->group_list, struct mali_group, group_list) {
+ mali_pp_update_performance_counters(group->pp_core, child->pp_core, group->pp_running_job, mali_pp_core_get_id(child->pp_core));
+ }
#if defined(CONFIG_MALI400_PROFILING)
- /* send profiling data per physical core */
- _MALI_OSK_LIST_FOREACHENTRY(child, temp, &group->group_list, struct mali_group, group_list) {
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_STOP |
- MALI_PROFILING_MAKE_EVENT_CHANNEL_PP(mali_pp_core_get_id(child->pp_core)) |
- MALI_PROFILING_EVENT_REASON_START_STOP_HW_VIRTUAL,
- mali_pp_job_get_perf_counter_value0(group->pp_running_job, mali_pp_core_get_id(child->pp_core)),
- mali_pp_job_get_perf_counter_value1(group->pp_running_job, mali_pp_core_get_id(child->pp_core)),
- mali_pp_job_get_perf_counter_src0(group->pp_running_job, group->pp_running_sub_job) | (mali_pp_job_get_perf_counter_src1(group->pp_running_job, group->pp_running_sub_job) << 8),
- 0, 0);
-
- trace_mali_core_active(mali_pp_job_get_pid(group->pp_running_job),
- 0 /* active */, 0 /* PP */, mali_pp_core_get_id(child->pp_core),
- mali_pp_job_get_frame_builder_id(group->pp_running_job),
- mali_pp_job_get_flush_id(group->pp_running_job));
- }
- if (0 != group->l2_cache_core_ref_count[0]) {
- if ((MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src0(group->l2_cache_core[0])) &&
- (MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src1(group->l2_cache_core[0]))) {
- mali_group_report_l2_cache_counters_per_core(group, mali_l2_cache_get_id(group->l2_cache_core[0]));
- }
- }
- if (0 != group->l2_cache_core_ref_count[1]) {
- if ((MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src0(group->l2_cache_core[1])) &&
- (MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src1(group->l2_cache_core[1]))) {
- mali_group_report_l2_cache_counters_per_core(group, mali_l2_cache_get_id(group->l2_cache_core[1]));
- }
- }
+ /* send profiling data per physical core */
+ _MALI_OSK_LIST_FOREACHENTRY(child, temp, &group->group_list, struct mali_group, group_list) {
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_STOP |
+ MALI_PROFILING_MAKE_EVENT_CHANNEL_PP(mali_pp_core_get_id(child->pp_core)) |
+ MALI_PROFILING_EVENT_REASON_START_STOP_HW_VIRTUAL,
+ mali_pp_job_get_perf_counter_value0(group->pp_running_job, mali_pp_core_get_id(child->pp_core)),
+ mali_pp_job_get_perf_counter_value1(group->pp_running_job, mali_pp_core_get_id(child->pp_core)),
+ mali_pp_job_get_perf_counter_src0(group->pp_running_job, group->pp_running_sub_job) | (mali_pp_job_get_perf_counter_src1(group->pp_running_job, group->pp_running_sub_job) << 8),
+ 0, 0);
+
+ trace_mali_core_active(mali_pp_job_get_pid(group->pp_running_job),
+ 0 /* active */, 0 /* PP */, mali_pp_core_get_id(child->pp_core),
+ mali_pp_job_get_frame_builder_id(group->pp_running_job),
+ mali_pp_job_get_flush_id(group->pp_running_job));
+ }
+ if (0 != group->l2_cache_core_ref_count[0]) {
+ if ((MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src0(group->l2_cache_core[0])) &&
+ (MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src1(group->l2_cache_core[0]))) {
+ mali_group_report_l2_cache_counters_per_core(group, mali_l2_cache_get_id(group->l2_cache_core[0]));
+ }
+ }
+ if (0 != group->l2_cache_core_ref_count[1]) {
+ if ((MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src0(group->l2_cache_core[1])) &&
+ (MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src1(group->l2_cache_core[1]))) {
+ mali_group_report_l2_cache_counters_per_core(group, mali_l2_cache_get_id(group->l2_cache_core[1]));
+ }
+ }
#endif
- } else {
- /* update performance counters for a physical group's pp core */
- mali_pp_update_performance_counters(group->pp_core, group->pp_core, group->pp_running_job, group->pp_running_sub_job);
+ } else {
+ /* update performance counters for a physical group's pp core */
+ mali_pp_update_performance_counters(group->pp_core, group->pp_core, group->pp_running_job, group->pp_running_sub_job);
#if defined(CONFIG_MALI400_PROFILING)
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_STOP |
- MALI_PROFILING_MAKE_EVENT_CHANNEL_PP(mali_pp_core_get_id(group->pp_core)) |
- MALI_PROFILING_EVENT_REASON_START_STOP_HW_PHYSICAL,
- mali_pp_job_get_perf_counter_value0(group->pp_running_job, group->pp_running_sub_job),
- mali_pp_job_get_perf_counter_value1(group->pp_running_job, group->pp_running_sub_job),
- mali_pp_job_get_perf_counter_src0(group->pp_running_job, group->pp_running_sub_job) | (mali_pp_job_get_perf_counter_src1(group->pp_running_job, group->pp_running_sub_job) << 8),
- 0, 0);
-
- trace_mali_core_active(mali_pp_job_get_pid(group->pp_running_job),
- 0 /* active */, 0 /* PP */, mali_pp_core_get_id(group->pp_core),
- mali_pp_job_get_frame_builder_id(group->pp_running_job),
- mali_pp_job_get_flush_id(group->pp_running_job));
-
- if ((MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src0(group->l2_cache_core[0])) &&
- (MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src1(group->l2_cache_core[0]))) {
- mali_group_report_l2_cache_counters_per_core(group, mali_l2_cache_get_id(group->l2_cache_core[0]));
- }
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_STOP |
+ MALI_PROFILING_MAKE_EVENT_CHANNEL_PP(mali_pp_core_get_id(group->pp_core)) |
+ MALI_PROFILING_EVENT_REASON_START_STOP_HW_PHYSICAL,
+ mali_pp_job_get_perf_counter_value0(group->pp_running_job, group->pp_running_sub_job),
+ mali_pp_job_get_perf_counter_value1(group->pp_running_job, group->pp_running_sub_job),
+ mali_pp_job_get_perf_counter_src0(group->pp_running_job, group->pp_running_sub_job) | (mali_pp_job_get_perf_counter_src1(group->pp_running_job, group->pp_running_sub_job) << 8),
+ 0, 0);
+
+ trace_mali_core_active(mali_pp_job_get_pid(group->pp_running_job),
+ 0 /* active */, 0 /* PP */, mali_pp_core_get_id(group->pp_core),
+ mali_pp_job_get_frame_builder_id(group->pp_running_job),
+ mali_pp_job_get_flush_id(group->pp_running_job));
+
+ if ((MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src0(group->l2_cache_core[0])) &&
+ (MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src1(group->l2_cache_core[0]))) {
+ mali_group_report_l2_cache_counters_per_core(group, mali_l2_cache_get_id(group->l2_cache_core[0]));
+ }
#endif
- }
+ }
#if defined(CONFIG_GPU_TRACEPOINTS) && defined(CONFIG_TRACEPOINTS)
- trace_gpu_sched_switch(
- mali_gp_core_description(group->gp_core),
- sched_clock(), 0, 0, 0);
+ trace_gpu_sched_switch(
+ mali_gp_core_description(group->gp_core),
+ sched_clock(), 0, 0, 0);
#endif
- }
+ }
- if (success) {
- /* Only do soft reset for successful jobs, a full recovery
- * reset will be done for failed jobs. */
- mali_pp_reset_async(group->pp_core);
- }
+ if (success) {
+ /* Only do soft reset for successful jobs, a full recovery
+ * reset will be done for failed jobs. */
+ mali_pp_reset_async(group->pp_core);
+ }
- pp_job_to_return = group->pp_running_job;
- group->pp_running_job = NULL;
- group->is_working = MALI_FALSE;
- *sub_job = group->pp_running_sub_job;
+ pp_job_to_return = group->pp_running_job;
+ group->pp_running_job = NULL;
+ group->is_working = MALI_FALSE;
+ *sub_job = group->pp_running_sub_job;
- if (!success) {
- MALI_DEBUG_PRINT(2, ("Mali group: Executing recovery reset due to job failure\n"));
- mali_group_recovery_reset(group);
- } else if (_MALI_OSK_ERR_OK != mali_pp_reset_wait(group->pp_core)) {
- MALI_PRINT_ERROR(("Mali group: Executing recovery reset due to reset failure\n"));
- mali_group_recovery_reset(group);
- }
+ if (!success) {
+ MALI_DEBUG_PRINT(2, ("Mali group: Executing recovery reset due to job failure\n"));
+ mali_group_recovery_reset(group);
+ } else if (_MALI_OSK_ERR_OK != mali_pp_reset_wait(group->pp_core)) {
+ MALI_PRINT_ERROR(("Mali group: Executing recovery reset due to reset failure\n"));
+ mali_group_recovery_reset(group);
+ }
- return pp_job_to_return;
+ return pp_job_to_return;
}
struct mali_gp_job *mali_group_complete_gp(struct mali_group *group, mali_bool success)
{
- struct mali_gp_job *gp_job_to_return;
+ struct mali_gp_job *gp_job_to_return;
- MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
- MALI_DEBUG_ASSERT_POINTER(group);
- MALI_DEBUG_ASSERT_POINTER(group->gp_core);
- MALI_DEBUG_ASSERT_POINTER(group->gp_running_job);
- MALI_DEBUG_ASSERT(MALI_TRUE == group->is_working);
+ MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
+ MALI_DEBUG_ASSERT_POINTER(group);
+ MALI_DEBUG_ASSERT_POINTER(group->gp_core);
+ MALI_DEBUG_ASSERT_POINTER(group->gp_running_job);
+ MALI_DEBUG_ASSERT(MALI_TRUE == group->is_working);
- /* Stop/clear the timeout timer. */
- _mali_osk_timer_del_async(group->timeout_timer);
+ /* Stop/clear the timeout timer. */
+ _mali_osk_timer_del_async(group->timeout_timer);
- if (NULL != group->gp_running_job) {
- mali_gp_update_performance_counters(group->gp_core, group->gp_running_job);
+ if (NULL != group->gp_running_job) {
+ mali_gp_update_performance_counters(group->gp_core, group->gp_running_job);
#if defined(CONFIG_MALI400_PROFILING)
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_STOP | MALI_PROFILING_MAKE_EVENT_CHANNEL_GP(0),
- mali_gp_job_get_perf_counter_value0(group->gp_running_job),
- mali_gp_job_get_perf_counter_value1(group->gp_running_job),
- mali_gp_job_get_perf_counter_src0(group->gp_running_job) | (mali_gp_job_get_perf_counter_src1(group->gp_running_job) << 8),
- 0, 0);
-
- if ((MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src0(group->l2_cache_core[0])) &&
- (MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src1(group->l2_cache_core[0])))
- mali_group_report_l2_cache_counters_per_core(group, 0);
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_STOP | MALI_PROFILING_MAKE_EVENT_CHANNEL_GP(0),
+ mali_gp_job_get_perf_counter_value0(group->gp_running_job),
+ mali_gp_job_get_perf_counter_value1(group->gp_running_job),
+ mali_gp_job_get_perf_counter_src0(group->gp_running_job) | (mali_gp_job_get_perf_counter_src1(group->gp_running_job) << 8),
+ 0, 0);
+
+ if ((MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src0(group->l2_cache_core[0])) &&
+ (MALI_HW_CORE_NO_COUNTER != mali_l2_cache_core_get_counter_src1(group->l2_cache_core[0])))
+ mali_group_report_l2_cache_counters_per_core(group, 0);
#endif
#if defined(CONFIG_GPU_TRACEPOINTS) && defined(CONFIG_TRACEPOINTS)
- trace_gpu_sched_switch(
- mali_pp_core_description(group->pp_core),
- sched_clock(), 0, 0, 0);
+ trace_gpu_sched_switch(
+ mali_pp_core_description(group->pp_core),
+ sched_clock(), 0, 0, 0);
#endif
#if defined(CONFIG_MALI400_PROFILING)
- trace_mali_core_active(mali_gp_job_get_pid(group->gp_running_job), 0 /* active */, 1 /* GP */, 0 /* core */,
- mali_gp_job_get_frame_builder_id(group->gp_running_job), mali_gp_job_get_flush_id(group->gp_running_job));
+ trace_mali_core_active(mali_gp_job_get_pid(group->gp_running_job), 0 /* active */, 1 /* GP */, 0 /* core */,
+ mali_gp_job_get_frame_builder_id(group->gp_running_job), mali_gp_job_get_flush_id(group->gp_running_job));
#endif
- mali_gp_job_set_current_heap_addr(group->gp_running_job,
- mali_gp_read_plbu_alloc_start_addr(group->gp_core));
- }
-
- if (success) {
- /* Only do soft reset for successful jobs, a full recovery
- * reset will be done for failed jobs. */
- mali_gp_reset_async(group->gp_core);
- }
-
- gp_job_to_return = group->gp_running_job;
- group->gp_running_job = NULL;
- group->is_working = MALI_FALSE;
-
- if (!success) {
- MALI_DEBUG_PRINT(2, ("Mali group: Executing recovery reset due to job failure\n"));
- mali_group_recovery_reset(group);
- } else if (_MALI_OSK_ERR_OK != mali_gp_reset_wait(group->gp_core)) {
- MALI_PRINT_ERROR(("Mali group: Executing recovery reset due to reset failure\n"));
- mali_group_recovery_reset(group);
- }
-
- return gp_job_to_return;
+ mali_gp_job_set_current_heap_addr(group->gp_running_job,
+ mali_gp_read_plbu_alloc_start_addr(group->gp_core));
+ }
+
+ if (success) {
+ /* Only do soft reset for successful jobs, a full recovery
+ * reset will be done for failed jobs. */
+ mali_gp_reset_async(group->gp_core);
+ }
+
+ gp_job_to_return = group->gp_running_job;
+ group->gp_running_job = NULL;
+ group->is_working = MALI_FALSE;
+
+ if (!success) {
+ MALI_DEBUG_PRINT(2, ("Mali group: Executing recovery reset due to job failure\n"));
+ mali_group_recovery_reset(group);
+ } else if (_MALI_OSK_ERR_OK != mali_gp_reset_wait(group->gp_core)) {
+ MALI_PRINT_ERROR(("Mali group: Executing recovery reset due to reset failure\n"));
+ mali_group_recovery_reset(group);
+ }
+
+ return gp_job_to_return;
}
struct mali_group *mali_group_get_glob_group(u32 index)
{
- if (mali_global_num_groups > index) {
- return mali_global_groups[index];
- }
+ if (mali_global_num_groups > index) {
+ return mali_global_groups[index];
+ }
- return NULL;
+ return NULL;
}
u32 mali_group_get_glob_num_groups(void)
{
- return mali_global_num_groups;
+ return mali_global_num_groups;
}
static void mali_group_activate_page_directory(struct mali_group *group, struct mali_session_data *session)
{
- 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_group_core_description(group)));
-
- MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
-
- if (group->session != session) {
- /* 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,
- mali_group_core_description(group)));
- mali_mmu_activate_page_directory(group->mmu, mali_session_get_page_directory(session));
- group->session = session;
- } else {
- /* Same session as last time, so no work required */
- MALI_DEBUG_PRINT(4, ("Mali group: Activate existing session 0x%08X on group %s\n",
- session->page_directory,
- mali_group_core_description(group)));
- mali_mmu_zap_tlb_without_stall(group->mmu);
- }
+ 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_group_core_description(group)));
+
+ MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
+
+ if (group->session != session) {
+ /* 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,
+ mali_group_core_description(group)));
+ mali_mmu_activate_page_directory(group->mmu, mali_session_get_page_directory(session));
+ group->session = session;
+ } else {
+ /* Same session as last time, so no work required */
+ MALI_DEBUG_PRINT(4, ("Mali group: Activate existing session 0x%08X on group %s\n",
+ session->page_directory,
+ mali_group_core_description(group)));
+ mali_mmu_zap_tlb_without_stall(group->mmu);
+ }
}
static void mali_group_recovery_reset(struct mali_group *group)
{
- _mali_osk_errcode_t err;
-
- MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
-
- /* Stop cores, bus stop */
- if (NULL != group->pp_core) {
- mali_pp_stop_bus(group->pp_core);
- } else {
- mali_gp_stop_bus(group->gp_core);
- }
-
- /* Flush MMU and clear page fault (if any) */
- mali_mmu_activate_fault_flush_page_directory(group->mmu);
- mali_mmu_page_fault_done(group->mmu);
-
- /* Wait for cores to stop bus, then do a hard reset on them */
- if (NULL != group->pp_core) {
- if (mali_group_is_virtual(group)) {
- struct mali_group *child, *temp;
-
- /* Disable the broadcast unit while we do reset directly on the member cores. */
- mali_bcast_disable(group->bcast_core);
-
- _MALI_OSK_LIST_FOREACHENTRY(child, temp, &group->group_list, struct mali_group, group_list) {
- mali_pp_stop_bus_wait(child->pp_core);
- mali_pp_hard_reset(child->pp_core);
- }
-
- mali_bcast_enable(group->bcast_core);
- } else {
- mali_pp_stop_bus_wait(group->pp_core);
- mali_pp_hard_reset(group->pp_core);
- }
- } else {
- mali_gp_stop_bus_wait(group->gp_core);
- mali_gp_hard_reset(group->gp_core);
- }
-
- /* Reset MMU */
- err = mali_mmu_reset(group->mmu);
- MALI_DEBUG_ASSERT(_MALI_OSK_ERR_OK == err);
- MALI_IGNORE(err);
-
- group->session = NULL;
+ _mali_osk_errcode_t err;
+
+ MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
+
+ /* Stop cores, bus stop */
+ if (NULL != group->pp_core) {
+ mali_pp_stop_bus(group->pp_core);
+ } else {
+ mali_gp_stop_bus(group->gp_core);
+ }
+
+ /* Flush MMU and clear page fault (if any) */
+ mali_mmu_activate_fault_flush_page_directory(group->mmu);
+ mali_mmu_page_fault_done(group->mmu);
+
+ /* Wait for cores to stop bus, then do a hard reset on them */
+ if (NULL != group->pp_core) {
+ if (mali_group_is_virtual(group)) {
+ struct mali_group *child, *temp;
+
+ /* Disable the broadcast unit while we do reset directly on the member cores. */
+ mali_bcast_disable(group->bcast_core);
+
+ _MALI_OSK_LIST_FOREACHENTRY(child, temp, &group->group_list, struct mali_group, group_list) {
+ mali_pp_stop_bus_wait(child->pp_core);
+ mali_pp_hard_reset(child->pp_core);
+ }
+
+ mali_bcast_enable(group->bcast_core);
+ } else {
+ mali_pp_stop_bus_wait(group->pp_core);
+ mali_pp_hard_reset(group->pp_core);
+ }
+ } else {
+ mali_gp_stop_bus_wait(group->gp_core);
+ mali_gp_hard_reset(group->gp_core);
+ }
+
+ /* Reset MMU */
+ err = mali_mmu_reset(group->mmu);
+ MALI_DEBUG_ASSERT(_MALI_OSK_ERR_OK == err);
+ MALI_IGNORE(err);
+
+ group->session = NULL;
}
#if MALI_STATE_TRACKING
u32 mali_group_dump_state(struct mali_group *group, char *buf, u32 size)
{
- int n = 0;
- int i;
- struct mali_group *child;
- struct mali_group *temp;
-
- if (mali_group_is_virtual(group)) {
- n += _mali_osk_snprintf(buf + n, size - n,
- "Virtual PP Group: %p\n", group);
- } else if (mali_group_is_in_virtual(group)) {
- n += _mali_osk_snprintf(buf + n, size - n,
- "Child PP Group: %p\n", group);
- } else if (NULL != group->pp_core) {
- n += _mali_osk_snprintf(buf + n, size - n,
- "Physical PP Group: %p\n", group);
- } else {
- MALI_DEBUG_ASSERT_POINTER(group->gp_core);
- n += _mali_osk_snprintf(buf + n, size - n,
- "GP Group: %p\n", group);
- }
-
- switch (group->state) {
- case MALI_GROUP_STATE_INACTIVE:
- n += _mali_osk_snprintf(buf + n, size - n,
- "\tstate: INACTIVE\n");
- break;
- case MALI_GROUP_STATE_ACTIVATION_PENDING:
- n += _mali_osk_snprintf(buf + n, size - n,
- "\tstate: ACTIVATION_PENDING\n");
- break;
- case MALI_GROUP_STATE_ACTIVE:
- n += _mali_osk_snprintf(buf + n, size - n,
- "\tstate: MALI_GROUP_STATE_ACTIVE\n");
- break;
- default:
- n += _mali_osk_snprintf(buf + n, size - n,
- "\tstate: UNKNOWN (%d)\n", group->state);
- MALI_DEBUG_ASSERT(0);
- break;
- }
-
- n += _mali_osk_snprintf(buf + n, size - n,
- "\tSW power: %s\n",
- group->power_is_on ? "On" : "Off");
-
- n += mali_pm_dump_state_domain(group->pm_domain, buf + n, size - n);
-
- for (i = 0; i < 2; i++) {
- if (NULL != group->l2_cache_core[i]) {
- struct mali_pm_domain *domain;
- domain = mali_l2_cache_get_pm_domain(
- group->l2_cache_core[i]);
- n += mali_pm_dump_state_domain(domain,
- buf + n, size - n);
- }
- }
-
- if (group->gp_core) {
- n += mali_gp_dump_state(group->gp_core, buf + n, size - n);
- n += _mali_osk_snprintf(buf + n, size - n,
- "\tGP running job: %p\n", group->gp_running_job);
- }
-
- if (group->pp_core) {
- n += mali_pp_dump_state(group->pp_core, buf + n, size - n);
- n += _mali_osk_snprintf(buf + n, size - n,
- "\tPP running job: %p, subjob %d \n",
- group->pp_running_job,
- group->pp_running_sub_job);
- }
-
- _MALI_OSK_LIST_FOREACHENTRY(child, temp, &group->group_list,
- struct mali_group, group_list) {
- n += mali_group_dump_state(child, buf + n, size - n);
- }
-
- return n;
+ int n = 0;
+ int i;
+ struct mali_group *child;
+ struct mali_group *temp;
+
+ if (mali_group_is_virtual(group)) {
+ n += _mali_osk_snprintf(buf + n, size - n,
+ "Virtual PP Group: %p\n", group);
+ } else if (mali_group_is_in_virtual(group)) {
+ n += _mali_osk_snprintf(buf + n, size - n,
+ "Child PP Group: %p\n", group);
+ } else if (NULL != group->pp_core) {
+ n += _mali_osk_snprintf(buf + n, size - n,
+ "Physical PP Group: %p\n", group);
+ } else {
+ MALI_DEBUG_ASSERT_POINTER(group->gp_core);
+ n += _mali_osk_snprintf(buf + n, size - n,
+ "GP Group: %p\n", group);
+ }
+
+ switch (group->state) {
+ case MALI_GROUP_STATE_INACTIVE:
+ n += _mali_osk_snprintf(buf + n, size - n,
+ "\tstate: INACTIVE\n");
+ break;
+ case MALI_GROUP_STATE_ACTIVATION_PENDING:
+ n += _mali_osk_snprintf(buf + n, size - n,
+ "\tstate: ACTIVATION_PENDING\n");
+ break;
+ case MALI_GROUP_STATE_ACTIVE:
+ n += _mali_osk_snprintf(buf + n, size - n,
+ "\tstate: MALI_GROUP_STATE_ACTIVE\n");
+ break;
+ default:
+ n += _mali_osk_snprintf(buf + n, size - n,
+ "\tstate: UNKNOWN (%d)\n", group->state);
+ MALI_DEBUG_ASSERT(0);
+ break;
+ }
+
+ n += _mali_osk_snprintf(buf + n, size - n,
+ "\tSW power: %s\n",
+ group->power_is_on ? "On" : "Off");
+
+ n += mali_pm_dump_state_domain(group->pm_domain, buf + n, size - n);
+
+ for (i = 0; i < 2; i++) {
+ if (NULL != group->l2_cache_core[i]) {
+ struct mali_pm_domain *domain;
+ domain = mali_l2_cache_get_pm_domain(
+ group->l2_cache_core[i]);
+ n += mali_pm_dump_state_domain(domain,
+ buf + n, size - n);
+ }
+ }
+
+ if (group->gp_core) {
+ n += mali_gp_dump_state(group->gp_core, buf + n, size - n);
+ n += _mali_osk_snprintf(buf + n, size - n,
+ "\tGP running job: %p\n", group->gp_running_job);
+ }
+
+ if (group->pp_core) {
+ n += mali_pp_dump_state(group->pp_core, buf + n, size - n);
+ n += _mali_osk_snprintf(buf + n, size - n,
+ "\tPP running job: %p, subjob %d \n",
+ group->pp_running_job,
+ group->pp_running_sub_job);
+ }
+
+ _MALI_OSK_LIST_FOREACHENTRY(child, temp, &group->group_list,
+ struct mali_group, group_list) {
+ n += mali_group_dump_state(child, buf + n, size - n);
+ }
+
+ return n;
}
#endif
_mali_osk_errcode_t mali_group_upper_half_mmu(void *data)
{
- struct mali_group *group = (struct mali_group *)data;
- _mali_osk_errcode_t ret;
+ struct mali_group *group = (struct mali_group *)data;
+#if MESON_CPU_TYPE == MESON_CPU_TYPE_MESON6
+ struct mali_mmu_core *mmu = group->mmu;
+#endif
+ _mali_osk_errcode_t ret;
- MALI_DEBUG_ASSERT_POINTER(group);
- MALI_DEBUG_ASSERT_POINTER(group->mmu);
+ MALI_DEBUG_ASSERT_POINTER(group);
+ MALI_DEBUG_ASSERT_POINTER(group->mmu);
#if MESON_CPU_TYPE == MESON_CPU_TYPE_MESON6
- if (MALI_FALSE == group->power_is_on)
- MALI_SUCCESS;
- if (get_irqnum(mmu->irq) == INT_MALI_PP2_MMU)
- {
- if (group == NULL || group->pp_core == NULL)
- MALI_SUCCESS;
- if (group->pp_core->core_id == 0) {
- if (malifix_get_mmu_int_process_state(0) == MMU_INT_HIT)
- malifix_set_mmu_int_process_state(0, MMU_INT_TOP);
- else
- MALI_SUCCESS;
- }
- else if (group->pp_core->core_id == 1) {
- if (malifix_get_mmu_int_process_state(1) == MMU_INT_HIT)
- malifix_set_mmu_int_process_state(1, MMU_INT_TOP);
- else
- MALI_SUCCESS;
- } else
- MALI_SUCCESS;
- }
+ if (MALI_FALSE == group->power_is_on)
+ MALI_SUCCESS;
+ if (get_irqnum(mmu->irq) == INT_MALI_PP2_MMU)
+ {
+ if (group == NULL || group->pp_core == NULL)
+ MALI_SUCCESS;
+ if (group->pp_core->core_id == 0) {
+ if (malifix_get_mmu_int_process_state(0) == MMU_INT_HIT)
+ malifix_set_mmu_int_process_state(0, MMU_INT_TOP);
+ else
+ MALI_SUCCESS;
+ }
+ else if (group->pp_core->core_id == 1) {
+ if (malifix_get_mmu_int_process_state(1) == MMU_INT_HIT)
+ malifix_set_mmu_int_process_state(1, MMU_INT_TOP);
+ else
+ MALI_SUCCESS;
+ } else
+ MALI_SUCCESS;
+ }
#endif
- if (NULL != group->gp_core) {
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_START |
- MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
- MALI_PROFILING_EVENT_REASON_START_STOP_SW_UPPER_HALF,
- 0, 0, /* No pid and tid for interrupt handler */
- MALI_PROFILING_MAKE_EVENT_DATA_CORE_GP_MMU(0),
- mali_mmu_get_rawstat(group->mmu), 0);
- } else {
- MALI_DEBUG_ASSERT_POINTER(group->pp_core);
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_START |
- MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
- MALI_PROFILING_EVENT_REASON_START_STOP_SW_UPPER_HALF,
- 0, 0, /* No pid and tid for interrupt handler */
- MALI_PROFILING_MAKE_EVENT_DATA_CORE_PP_MMU(
- mali_pp_core_get_id(group->pp_core)),
- mali_mmu_get_rawstat(group->mmu), 0);
- }
-
- ret = mali_executor_interrupt_mmu(group, MALI_TRUE);
-
- if (NULL != group->gp_core) {
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_STOP |
- MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
- MALI_PROFILING_EVENT_REASON_START_STOP_SW_UPPER_HALF,
- 0, 0, /* No pid and tid for interrupt handler */
- MALI_PROFILING_MAKE_EVENT_DATA_CORE_GP_MMU(0),
- mali_mmu_get_rawstat(group->mmu), 0);
- } else {
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_STOP |
- MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
- MALI_PROFILING_EVENT_REASON_START_STOP_SW_UPPER_HALF,
- 0, 0, /* No pid and tid for interrupt handler */
- MALI_PROFILING_MAKE_EVENT_DATA_CORE_PP_MMU(
- mali_pp_core_get_id(group->pp_core)),
- mali_mmu_get_rawstat(group->mmu), 0);
- }
-
- return ret;
+ if (NULL != group->gp_core) {
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_START |
+ MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
+ MALI_PROFILING_EVENT_REASON_START_STOP_SW_UPPER_HALF,
+ 0, 0, /* No pid and tid for interrupt handler */
+ MALI_PROFILING_MAKE_EVENT_DATA_CORE_GP_MMU(0),
+ mali_mmu_get_rawstat(group->mmu), 0);
+ } else {
+ MALI_DEBUG_ASSERT_POINTER(group->pp_core);
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_START |
+ MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
+ MALI_PROFILING_EVENT_REASON_START_STOP_SW_UPPER_HALF,
+ 0, 0, /* No pid and tid for interrupt handler */
+ MALI_PROFILING_MAKE_EVENT_DATA_CORE_PP_MMU(
+ mali_pp_core_get_id(group->pp_core)),
+ mali_mmu_get_rawstat(group->mmu), 0);
+ }
+
+ ret = mali_executor_interrupt_mmu(group, MALI_TRUE);
+
+ if (NULL != group->gp_core) {
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_STOP |
+ MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
+ MALI_PROFILING_EVENT_REASON_START_STOP_SW_UPPER_HALF,
+ 0, 0, /* No pid and tid for interrupt handler */
+ MALI_PROFILING_MAKE_EVENT_DATA_CORE_GP_MMU(0),
+ mali_mmu_get_rawstat(group->mmu), 0);
+ } else {
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_STOP |
+ MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
+ MALI_PROFILING_EVENT_REASON_START_STOP_SW_UPPER_HALF,
+ 0, 0, /* No pid and tid for interrupt handler */
+ MALI_PROFILING_MAKE_EVENT_DATA_CORE_PP_MMU(
+ mali_pp_core_get_id(group->pp_core)),
+ mali_mmu_get_rawstat(group->mmu), 0);
+ }
+
+ return ret;
}
static void mali_group_bottom_half_mmu(void *data)
{
- struct mali_group *group = (struct mali_group *)data;
-
- MALI_DEBUG_ASSERT_POINTER(group);
- MALI_DEBUG_ASSERT_POINTER(group->mmu);
-
- if (NULL != group->gp_core) {
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_START |
- MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
- MALI_PROFILING_EVENT_REASON_START_STOP_SW_BOTTOM_HALF,
- 0, _mali_osk_get_tid(), /* pid and tid */
- MALI_PROFILING_MAKE_EVENT_DATA_CORE_GP_MMU(0),
- mali_mmu_get_rawstat(group->mmu), 0);
- } else {
- MALI_DEBUG_ASSERT_POINTER(group->pp_core);
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_START |
- MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
- MALI_PROFILING_EVENT_REASON_START_STOP_SW_BOTTOM_HALF,
- 0, _mali_osk_get_tid(), /* pid and tid */
- MALI_PROFILING_MAKE_EVENT_DATA_CORE_PP_MMU(
- mali_pp_core_get_id(group->pp_core)),
- mali_mmu_get_rawstat(group->mmu), 0);
- }
-
- mali_executor_interrupt_mmu(group, MALI_FALSE);
-
- if (NULL != group->gp_core) {
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_STOP |
- MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
- MALI_PROFILING_EVENT_REASON_START_STOP_SW_BOTTOM_HALF,
- 0, _mali_osk_get_tid(), /* pid and tid */
- MALI_PROFILING_MAKE_EVENT_DATA_CORE_GP_MMU(0),
- mali_mmu_get_rawstat(group->mmu), 0);
- } else {
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_STOP |
- MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
- MALI_PROFILING_EVENT_REASON_START_STOP_SW_BOTTOM_HALF,
- 0, _mali_osk_get_tid(), /* pid and tid */
- MALI_PROFILING_MAKE_EVENT_DATA_CORE_PP_MMU(
- mali_pp_core_get_id(group->pp_core)),
- mali_mmu_get_rawstat(group->mmu), 0);
- }
+ struct mali_group *group = (struct mali_group *)data;
+#if MESON_CPU_TYPE == MESON_CPU_TYPE_MESON6
+ struct mali_mmu_core *mmu = group->mmu;
+#endif
+
+ MALI_DEBUG_ASSERT_POINTER(group);
+ MALI_DEBUG_ASSERT_POINTER(group->mmu);
+
+ if (NULL != group->gp_core) {
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_START |
+ MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
+ MALI_PROFILING_EVENT_REASON_START_STOP_SW_BOTTOM_HALF,
+ 0, _mali_osk_get_tid(), /* pid and tid */
+ MALI_PROFILING_MAKE_EVENT_DATA_CORE_GP_MMU(0),
+ mali_mmu_get_rawstat(group->mmu), 0);
+ } else {
+ MALI_DEBUG_ASSERT_POINTER(group->pp_core);
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_START |
+ MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
+ MALI_PROFILING_EVENT_REASON_START_STOP_SW_BOTTOM_HALF,
+ 0, _mali_osk_get_tid(), /* pid and tid */
+ MALI_PROFILING_MAKE_EVENT_DATA_CORE_PP_MMU(
+ mali_pp_core_get_id(group->pp_core)),
+ mali_mmu_get_rawstat(group->mmu), 0);
+ }
+
+ mali_executor_interrupt_mmu(group, MALI_FALSE);
+
+ if (NULL != group->gp_core) {
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_STOP |
+ MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
+ MALI_PROFILING_EVENT_REASON_START_STOP_SW_BOTTOM_HALF,
+ 0, _mali_osk_get_tid(), /* pid and tid */
+ MALI_PROFILING_MAKE_EVENT_DATA_CORE_GP_MMU(0),
+ mali_mmu_get_rawstat(group->mmu), 0);
+ } else {
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_STOP |
+ MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
+ MALI_PROFILING_EVENT_REASON_START_STOP_SW_BOTTOM_HALF,
+ 0, _mali_osk_get_tid(), /* pid and tid */
+ MALI_PROFILING_MAKE_EVENT_DATA_CORE_PP_MMU(
+ mali_pp_core_get_id(group->pp_core)),
+ mali_mmu_get_rawstat(group->mmu), 0);
+ }
#if MESON_CPU_TYPE == MESON_CPU_TYPE_MESON6
- if (get_irqnum(mmu->irq) == INT_MALI_PP2_MMU)
- {
- if (group->pp_core->core_id == 0) {
- if (malifix_get_mmu_int_process_state(0) == MMU_INT_TOP)
- malifix_set_mmu_int_process_state(0, MMU_INT_NONE);
- }
- else if (group->pp_core->core_id == 1) {
- if (malifix_get_mmu_int_process_state(1) == MMU_INT_TOP)
- malifix_set_mmu_int_process_state(1, MMU_INT_NONE);
- }
- }
+ if (get_irqnum(mmu->irq) == INT_MALI_PP2_MMU)
+ {
+ if (group->pp_core->core_id == 0) {
+ if (malifix_get_mmu_int_process_state(0) == MMU_INT_TOP)
+ malifix_set_mmu_int_process_state(0, MMU_INT_NONE);
+ }
+ else if (group->pp_core->core_id == 1) {
+ if (malifix_get_mmu_int_process_state(1) == MMU_INT_TOP)
+ malifix_set_mmu_int_process_state(1, MMU_INT_NONE);
+ }
+ }
#endif
}
_mali_osk_errcode_t mali_group_upper_half_gp(void *data)
{
- struct mali_group *group = (struct mali_group *)data;
- _mali_osk_errcode_t ret;
-
- MALI_DEBUG_ASSERT_POINTER(group);
- MALI_DEBUG_ASSERT_POINTER(group->gp_core);
- MALI_DEBUG_ASSERT_POINTER(group->mmu);
-
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_START |
- MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
- MALI_PROFILING_EVENT_REASON_START_STOP_SW_UPPER_HALF,
- 0, 0, /* No pid and tid for interrupt handler */
- MALI_PROFILING_MAKE_EVENT_DATA_CORE_GP(0),
- mali_gp_get_rawstat(group->gp_core), 0);
-
- MALI_DEBUG_PRINT(4, ("Group: Interrupt 0x%08X from %s\n",
- mali_gp_get_rawstat(group->gp_core),
- mali_group_core_description(group)));
-
- ret = mali_executor_interrupt_gp(group, MALI_TRUE);
-
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_STOP |
- MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
- MALI_PROFILING_EVENT_REASON_START_STOP_SW_UPPER_HALF,
- 0, 0, /* No pid and tid for interrupt handler */
- MALI_PROFILING_MAKE_EVENT_DATA_CORE_GP(0),
- mali_gp_get_rawstat(group->gp_core), 0);
-
- return ret;
+ struct mali_group *group = (struct mali_group *)data;
+ _mali_osk_errcode_t ret;
+
+ MALI_DEBUG_ASSERT_POINTER(group);
+ MALI_DEBUG_ASSERT_POINTER(group->gp_core);
+ MALI_DEBUG_ASSERT_POINTER(group->mmu);
+
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_START |
+ MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
+ MALI_PROFILING_EVENT_REASON_START_STOP_SW_UPPER_HALF,
+ 0, 0, /* No pid and tid for interrupt handler */
+ MALI_PROFILING_MAKE_EVENT_DATA_CORE_GP(0),
+ mali_gp_get_rawstat(group->gp_core), 0);
+
+ MALI_DEBUG_PRINT(4, ("Group: Interrupt 0x%08X from %s\n",
+ mali_gp_get_rawstat(group->gp_core),
+ mali_group_core_description(group)));
+
+ ret = mali_executor_interrupt_gp(group, MALI_TRUE);
+
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_STOP |
+ MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
+ MALI_PROFILING_EVENT_REASON_START_STOP_SW_UPPER_HALF,
+ 0, 0, /* No pid and tid for interrupt handler */
+ MALI_PROFILING_MAKE_EVENT_DATA_CORE_GP(0),
+ mali_gp_get_rawstat(group->gp_core), 0);
+
+ return ret;
}
static void mali_group_bottom_half_gp(void *data)
{
- struct mali_group *group = (struct mali_group *)data;
-
- MALI_DEBUG_ASSERT_POINTER(group);
- MALI_DEBUG_ASSERT_POINTER(group->gp_core);
- MALI_DEBUG_ASSERT_POINTER(group->mmu);
-
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_START |
- MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
- MALI_PROFILING_EVENT_REASON_START_STOP_SW_BOTTOM_HALF,
- 0, _mali_osk_get_tid(), /* pid and tid */
- MALI_PROFILING_MAKE_EVENT_DATA_CORE_GP(0),
- mali_gp_get_rawstat(group->gp_core), 0);
-
- mali_executor_interrupt_gp(group, MALI_FALSE);
-
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_STOP |
- MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
- MALI_PROFILING_EVENT_REASON_START_STOP_SW_BOTTOM_HALF,
- 0, _mali_osk_get_tid(), /* pid and tid */
- MALI_PROFILING_MAKE_EVENT_DATA_CORE_GP(0),
- mali_gp_get_rawstat(group->gp_core), 0);
+ struct mali_group *group = (struct mali_group *)data;
+
+ MALI_DEBUG_ASSERT_POINTER(group);
+ MALI_DEBUG_ASSERT_POINTER(group->gp_core);
+ MALI_DEBUG_ASSERT_POINTER(group->mmu);
+
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_START |
+ MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
+ MALI_PROFILING_EVENT_REASON_START_STOP_SW_BOTTOM_HALF,
+ 0, _mali_osk_get_tid(), /* pid and tid */
+ MALI_PROFILING_MAKE_EVENT_DATA_CORE_GP(0),
+ mali_gp_get_rawstat(group->gp_core), 0);
+
+ mali_executor_interrupt_gp(group, MALI_FALSE);
+
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_STOP |
+ MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
+ MALI_PROFILING_EVENT_REASON_START_STOP_SW_BOTTOM_HALF,
+ 0, _mali_osk_get_tid(), /* pid and tid */
+ MALI_PROFILING_MAKE_EVENT_DATA_CORE_GP(0),
+ mali_gp_get_rawstat(group->gp_core), 0);
}
#if MESON_CPU_TYPE == MESON_CPU_TYPE_MESON6
_mali_osk_errcode_t mali_group_upper_half_pp(void *data)
{
- struct mali_group *group = (struct mali_group *)data;
- _mali_osk_errcode_t ret;
+ struct mali_group *group = (struct mali_group *)data;
+#if MESON_CPU_TYPE == MESON_CPU_TYPE_MESON6
+ struct mali_pp_core *core = group->pp_core;
+#endif
+ _mali_osk_errcode_t ret;
- MALI_DEBUG_ASSERT_POINTER(group);
- MALI_DEBUG_ASSERT_POINTER(group->pp_core);
- MALI_DEBUG_ASSERT_POINTER(group->mmu);
+ MALI_DEBUG_ASSERT_POINTER(group);
+ MALI_DEBUG_ASSERT_POINTER(group->pp_core);
+ MALI_DEBUG_ASSERT_POINTER(group->mmu);
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_START |
- MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
- MALI_PROFILING_EVENT_REASON_START_STOP_SW_UPPER_HALF,
- 0, 0, /* No pid and tid for interrupt handler */
- MALI_PROFILING_MAKE_EVENT_DATA_CORE_PP(
- mali_pp_core_get_id(group->pp_core)),
- mali_pp_get_rawstat(group->pp_core), 0);
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_START |
+ MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
+ MALI_PROFILING_EVENT_REASON_START_STOP_SW_UPPER_HALF,
+ 0, 0, /* No pid and tid for interrupt handler */
+ MALI_PROFILING_MAKE_EVENT_DATA_CORE_PP(
+ mali_pp_core_get_id(group->pp_core)),
+ mali_pp_get_rawstat(group->pp_core), 0);
- MALI_DEBUG_PRINT(4, ("Group: Interrupt 0x%08X from %s\n",
- mali_pp_get_rawstat(group->pp_core),
- mali_group_core_description(group)));
+ MALI_DEBUG_PRINT(4, ("Group: Interrupt 0x%08X from %s\n",
+ mali_pp_get_rawstat(group->pp_core),
+ mali_group_core_description(group)));
- ret = mali_executor_interrupt_pp(group, MALI_TRUE);
+ ret = mali_executor_interrupt_pp(group, MALI_TRUE);
#if MESON_CPU_TYPE == MESON_CPU_TYPE_MESON6
- if (core->core_id == 0)
- PP0_int_cnt++;
- else if (core->core_id == 1)
- PP1_int_cnt++;
+ if (core->core_id == 0)
+ PP0_int_cnt++;
+ else if (core->core_id == 1)
+ PP1_int_cnt++;
#endif
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_STOP |
- MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
- MALI_PROFILING_EVENT_REASON_START_STOP_SW_UPPER_HALF,
- 0, 0, /* No pid and tid for interrupt handler */
- MALI_PROFILING_MAKE_EVENT_DATA_CORE_PP(
- mali_pp_core_get_id(group->pp_core)),
- mali_pp_get_rawstat(group->pp_core), 0);
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_STOP |
+ MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
+ MALI_PROFILING_EVENT_REASON_START_STOP_SW_UPPER_HALF,
+ 0, 0, /* No pid and tid for interrupt handler */
+ MALI_PROFILING_MAKE_EVENT_DATA_CORE_PP(
+ mali_pp_core_get_id(group->pp_core)),
+ mali_pp_get_rawstat(group->pp_core), 0);
- return ret;
+ return ret;
}
static void mali_group_bottom_half_pp(void *data)
{
- struct mali_group *group = (struct mali_group *)data;
-
- MALI_DEBUG_ASSERT_POINTER(group);
- MALI_DEBUG_ASSERT_POINTER(group->pp_core);
- MALI_DEBUG_ASSERT_POINTER(group->mmu);
-
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_START |
- MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
- MALI_PROFILING_EVENT_REASON_START_STOP_SW_BOTTOM_HALF,
- 0, _mali_osk_get_tid(), /* pid and tid */
- MALI_PROFILING_MAKE_EVENT_DATA_CORE_PP(
- mali_pp_core_get_id(group->pp_core)),
- mali_pp_get_rawstat(group->pp_core), 0);
-
- mali_executor_interrupt_pp(group, MALI_FALSE);
-
- _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_STOP |
- MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
- MALI_PROFILING_EVENT_REASON_START_STOP_SW_BOTTOM_HALF,
- 0, _mali_osk_get_tid(), /* pid and tid */
- MALI_PROFILING_MAKE_EVENT_DATA_CORE_PP(
- mali_pp_core_get_id(group->pp_core)),
- mali_pp_get_rawstat(group->pp_core), 0);
+ struct mali_group *group = (struct mali_group *)data;
+
+ MALI_DEBUG_ASSERT_POINTER(group);
+ MALI_DEBUG_ASSERT_POINTER(group->pp_core);
+ MALI_DEBUG_ASSERT_POINTER(group->mmu);
+
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_START |
+ MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
+ MALI_PROFILING_EVENT_REASON_START_STOP_SW_BOTTOM_HALF,
+ 0, _mali_osk_get_tid(), /* pid and tid */
+ MALI_PROFILING_MAKE_EVENT_DATA_CORE_PP(
+ mali_pp_core_get_id(group->pp_core)),
+ mali_pp_get_rawstat(group->pp_core), 0);
+
+ mali_executor_interrupt_pp(group, MALI_FALSE);
+
+ _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_STOP |
+ MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
+ MALI_PROFILING_EVENT_REASON_START_STOP_SW_BOTTOM_HALF,
+ 0, _mali_osk_get_tid(), /* pid and tid */
+ MALI_PROFILING_MAKE_EVENT_DATA_CORE_PP(
+ mali_pp_core_get_id(group->pp_core)),
+ mali_pp_get_rawstat(group->pp_core), 0);
}
static void mali_group_timeout(void *data)
{
- struct mali_group *group = (struct mali_group *)data;
- MALI_DEBUG_ASSERT_POINTER(group);
-
- MALI_DEBUG_PRINT(2, ("Group: timeout handler for %s at %u\n",
- mali_group_core_description(group),
- _mali_osk_time_tickcount()));
-
- if (mali_core_timeout < 65533)
- mali_core_timeout++;
- if (NULL != group->gp_core) {
- mali_group_schedule_bottom_half_gp(group);
- } else {
- MALI_DEBUG_ASSERT_POINTER(group->pp_core);
- mali_group_schedule_bottom_half_pp(group);
- }
+ struct mali_group *group = (struct mali_group *)data;
+ MALI_DEBUG_ASSERT_POINTER(group);
+
+ MALI_DEBUG_PRINT(2, ("Group: timeout handler for %s at %u\n",
+ mali_group_core_description(group),
+ _mali_osk_time_tickcount()));
+
+ if (mali_core_timeout < 65533)
+ mali_core_timeout++;
+ if (NULL != group->gp_core) {
+ mali_group_schedule_bottom_half_gp(group);
+ } else {
+ MALI_DEBUG_ASSERT_POINTER(group->pp_core);
+ mali_group_schedule_bottom_half_pp(group);
+ }
}
mali_bool mali_group_zap_session(struct mali_group *group,
- struct mali_session_data *session)
+ struct mali_session_data *session)
{
- MALI_DEBUG_ASSERT_POINTER(group);
- MALI_DEBUG_ASSERT_POINTER(session);
- MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
-
- if (group->session != session) {
- /* not running from this session */
- return MALI_TRUE; /* success */
- }
-
- if (group->is_working) {
- /* The Zap also does the stall and disable_stall */
- mali_bool zap_success = mali_mmu_zap_tlb(group->mmu);
- return zap_success;
- } else {
- /* Just remove the session instead of zapping */
- mali_group_clear_session(group);
- return MALI_TRUE; /* success */
- }
+ MALI_DEBUG_ASSERT_POINTER(group);
+ MALI_DEBUG_ASSERT_POINTER(session);
+ MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
+
+ if (group->session != session) {
+ /* not running from this session */
+ return MALI_TRUE; /* success */
+ }
+
+ if (group->is_working) {
+ /* The Zap also does the stall and disable_stall */
+ mali_bool zap_success = mali_mmu_zap_tlb(group->mmu);
+ return zap_success;
+ } else {
+ /* Just remove the session instead of zapping */
+ mali_group_clear_session(group);
+ return MALI_TRUE; /* success */
+ }
}
#if defined(CONFIG_MALI400_PROFILING)
static void mali_group_report_l2_cache_counters_per_core(struct mali_group *group, u32 core_num)
{
- u32 source0 = 0;
- u32 value0 = 0;
- u32 source1 = 0;
- u32 value1 = 0;
- u32 profiling_channel = 0;
-
- MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
-
- switch (core_num) {
- case 0:
- profiling_channel = MALI_PROFILING_EVENT_TYPE_SINGLE |
- MALI_PROFILING_EVENT_CHANNEL_GPU |
- MALI_PROFILING_EVENT_REASON_SINGLE_GPU_L20_COUNTERS;
- break;
- case 1:
- profiling_channel = MALI_PROFILING_EVENT_TYPE_SINGLE |
- MALI_PROFILING_EVENT_CHANNEL_GPU |
- MALI_PROFILING_EVENT_REASON_SINGLE_GPU_L21_COUNTERS;
- break;
- case 2:
- profiling_channel = MALI_PROFILING_EVENT_TYPE_SINGLE |
- MALI_PROFILING_EVENT_CHANNEL_GPU |
- MALI_PROFILING_EVENT_REASON_SINGLE_GPU_L22_COUNTERS;
- break;
- default:
- profiling_channel = MALI_PROFILING_EVENT_TYPE_SINGLE |
- MALI_PROFILING_EVENT_CHANNEL_GPU |
- MALI_PROFILING_EVENT_REASON_SINGLE_GPU_L20_COUNTERS;
- break;
- }
-
- if (0 == core_num) {
- mali_l2_cache_core_get_counter_values(group->l2_cache_core[0], &source0, &value0, &source1, &value1);
- }
- if (1 == core_num) {
- if (1 == mali_l2_cache_get_id(group->l2_cache_core[0])) {
- mali_l2_cache_core_get_counter_values(group->l2_cache_core[0], &source0, &value0, &source1, &value1);
- } else if (1 == mali_l2_cache_get_id(group->l2_cache_core[1])) {
- mali_l2_cache_core_get_counter_values(group->l2_cache_core[1], &source0, &value0, &source1, &value1);
- }
- }
- if (2 == core_num) {
- if (2 == mali_l2_cache_get_id(group->l2_cache_core[0])) {
- mali_l2_cache_core_get_counter_values(group->l2_cache_core[0], &source0, &value0, &source1, &value1);
- } else if (2 == mali_l2_cache_get_id(group->l2_cache_core[1])) {
- mali_l2_cache_core_get_counter_values(group->l2_cache_core[1], &source0, &value0, &source1, &value1);
- }
- }
-
- _mali_osk_profiling_add_event(profiling_channel, source1 << 8 | source0, value0, value1, 0, 0);
+ u32 source0 = 0;
+ u32 value0 = 0;
+ u32 source1 = 0;
+ u32 value1 = 0;
+ u32 profiling_channel = 0;
+
+ MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
+
+ switch (core_num) {
+ case 0:
+ profiling_channel = MALI_PROFILING_EVENT_TYPE_SINGLE |
+ MALI_PROFILING_EVENT_CHANNEL_GPU |
+ MALI_PROFILING_EVENT_REASON_SINGLE_GPU_L20_COUNTERS;
+ break;
+ case 1:
+ profiling_channel = MALI_PROFILING_EVENT_TYPE_SINGLE |
+ MALI_PROFILING_EVENT_CHANNEL_GPU |
+ MALI_PROFILING_EVENT_REASON_SINGLE_GPU_L21_COUNTERS;
+ break;
+ case 2:
+ profiling_channel = MALI_PROFILING_EVENT_TYPE_SINGLE |
+ MALI_PROFILING_EVENT_CHANNEL_GPU |
+ MALI_PROFILING_EVENT_REASON_SINGLE_GPU_L22_COUNTERS;
+ break;
+ default:
+ profiling_channel = MALI_PROFILING_EVENT_TYPE_SINGLE |
+ MALI_PROFILING_EVENT_CHANNEL_GPU |
+ MALI_PROFILING_EVENT_REASON_SINGLE_GPU_L20_COUNTERS;
+ break;
+ }
+
+ if (0 == core_num) {
+ mali_l2_cache_core_get_counter_values(group->l2_cache_core[0], &source0, &value0, &source1, &value1);
+ }
+ if (1 == core_num) {
+ if (1 == mali_l2_cache_get_id(group->l2_cache_core[0])) {
+ mali_l2_cache_core_get_counter_values(group->l2_cache_core[0], &source0, &value0, &source1, &value1);
+ } else if (1 == mali_l2_cache_get_id(group->l2_cache_core[1])) {
+ mali_l2_cache_core_get_counter_values(group->l2_cache_core[1], &source0, &value0, &source1, &value1);
+ }
+ }
+ if (2 == core_num) {
+ if (2 == mali_l2_cache_get_id(group->l2_cache_core[0])) {
+ mali_l2_cache_core_get_counter_values(group->l2_cache_core[0], &source0, &value0, &source1, &value1);
+ } else if (2 == mali_l2_cache_get_id(group->l2_cache_core[1])) {
+ mali_l2_cache_core_get_counter_values(group->l2_cache_core[1], &source0, &value0, &source1, &value1);
+ }
+ }
+
+ _mali_osk_profiling_add_event(profiling_channel, source1 << 8 | source0, value0, value1, 0, 0);
}
#endif /* #if defined(CONFIG_MALI400_PROFILING) */