Ejemplo n.º 1
0
void mali_control_timer_term(void)
{
	if (NULL != mali_control_timer) {
		_mali_osk_timer_del(mali_control_timer);
		timer_running = MALI_FALSE;
		_mali_osk_timer_term(mali_control_timer);
		mali_control_timer = NULL;
	}
}
Ejemplo n.º 2
0
void mali_gp_abort_job(struct mali_gp_core *core)
{
    MALI_DEBUG_ASSERT_POINTER(core);
    MALI_ASSERT_GROUP_LOCKED(core->group);

    if (_MALI_OSK_ERR_FAULT != mali_gp_reset(core))
    {
        _mali_osk_timer_del(core->timeout_timer);
    }
}
Ejemplo n.º 3
0
void mali_pm_terminate(void)
{
	mali_platform_deinit();
	_mali_osk_irq_term(wq_irq);
	_mali_osk_timer_del(idle_timer);
	_mali_osk_timer_term(idle_timer);
	_mali_osk_lock_term(mali_pm_lock_execute_state_change);
	_mali_osk_lock_term(mali_pm_lock_set_next_state);
	_mali_osk_lock_term(mali_pm_lock_set_core_states);
}
Ejemplo n.º 4
0
_mali_osk_errcode_t _mali_osk_pm_delete_callback_timer(void)
{
   _mali_osk_timer_del(pm_timer);
#if MALI_LICENSE_IS_GPL
   if (mali_pm_wq)
   {
       flush_workqueue(mali_pm_wq);
   }
#else
   flush_scheduled_work();
#endif
   return _MALI_OSK_ERR_OK;
}
Ejemplo n.º 5
0
_mali_osk_errcode_t mali_pm_initialize(void)
{
	mali_pm_lock_execute_state_change = _mali_osk_lock_init(_MALI_OSK_LOCKFLAG_ORDERED | _MALI_OSK_LOCKFLAG_ORDERED |_MALI_OSK_LOCKFLAG_NONINTERRUPTABLE, 0, _MALI_OSK_LOCK_ORDER_PM_EXECUTE);

	if (NULL != mali_pm_lock_execute_state_change )
	{
		mali_pm_lock_set_next_state = _mali_osk_lock_init(_MALI_OSK_LOCKFLAG_ONELOCK| _MALI_OSK_LOCKFLAG_SPINLOCK_IRQ |_MALI_OSK_LOCKFLAG_NONINTERRUPTABLE, 0, _MALI_OSK_LOCK_ORDER_LAST);

		if (NULL != mali_pm_lock_set_next_state)
		{
			mali_pm_lock_set_core_states = _mali_osk_lock_init(_MALI_OSK_LOCKFLAG_ORDERED | _MALI_OSK_LOCKFLAG_NONINTERRUPTABLE, 0, _MALI_OSK_LOCK_ORDER_PM_CORE_STATE);

			if (NULL != mali_pm_lock_set_core_states)
			{
				idle_timer = _mali_osk_timer_init();
				if (NULL != idle_timer)
				{
					wq_irq = _mali_osk_irq_init(_MALI_OSK_IRQ_NUMBER_PMM,
												mali_pm_upper_half,
												mali_pm_bottom_half,
												NULL,
												NULL,
												(void *)NULL,
												"Mali PM deferred work");
					if (NULL != wq_irq)
					{
						if (_MALI_OSK_ERR_OK == mali_platform_init())
						{
#if MALI_PMM_RUNTIME_JOB_CONTROL_ON
							_mali_osk_pm_dev_enable();
							mali_pm_powerup();
#endif
							return _MALI_OSK_ERR_OK;
						}

						_mali_osk_irq_term(wq_irq);
					}

					_mali_osk_timer_del(idle_timer);
					_mali_osk_timer_term(idle_timer);
				}
				_mali_osk_lock_term(mali_pm_lock_set_core_states);
			}
			_mali_osk_lock_term(mali_pm_lock_set_next_state);
		}
		_mali_osk_lock_term(mali_pm_lock_execute_state_change);
	}

	return _MALI_OSK_ERR_FAULT;
}
Ejemplo n.º 6
0
void mali_control_timer_suspend(mali_bool suspend)
{
	mali_utilization_data_lock();

	if (timer_running == MALI_TRUE) {
		timer_running = MALI_FALSE;

		mali_utilization_data_unlock();

		if (suspend == MALI_TRUE) {
			_mali_osk_timer_del(mali_control_timer);
			mali_utilization_reset();
		}
	} else {
		mali_utilization_data_unlock();
	}
}
Ejemplo n.º 7
0
void power_test_end()
{
	_mali_osk_timer_del( power_test_timer );
	_mali_osk_timer_term( power_test_timer );
	power_test_timer = NULL;
}
Ejemplo n.º 8
0
/* ------ local helper functions below --------- */
static void mali_pp_post_process_job(struct mali_pp_core *core)
{
	MALI_ASSERT_GROUP_LOCKED(core->group);

	if (NULL != core->running_job)
	{
		u32 val0 = 0;
		u32 val1 = 0;
#if MALI_TIMELINE_PROFILING_ENABLED
		int counter_index = COUNTER_FP0_C0 + (2 * core->core_id);
#endif

		if (MALI_HW_CORE_NO_COUNTER != core->counter_src0_used)
		{
			val0 = mali_hw_core_register_read(&core->hw_core, MALI200_REG_ADDR_MGMT_PERF_CNT_0_VALUE);
			if (mali_pp_job_get_perf_counter_flag(core->running_job) &&
			    _MALI_PERFORMANCE_COUNTER_FLAG_SRC0_ENABLE && mali_pp_job_get_perf_counter_src0(core->running_job) == core->counter_src0_used)
			{
				/* We retrieved the counter that user space asked for, so return the value through the job object */
				mali_pp_job_set_perf_counter_value0(core->running_job, core->running_sub_job, val0);
			}
			else
			{
				/* User space asked for a counter, but this is not what we retrived (overridden by counter src set on core) */
				mali_pp_job_set_perf_counter_value0(core->running_job, core->running_sub_job, MALI_HW_CORE_INVALID_VALUE);
			}

#if MALI_TIMELINE_PROFILING_ENABLED
			_mali_osk_profiling_report_hw_counter(counter_index, val0);
#endif
		}

		if (MALI_HW_CORE_NO_COUNTER != core->counter_src1_used)
		{
			val1 = mali_hw_core_register_read(&core->hw_core, MALI200_REG_ADDR_MGMT_PERF_CNT_1_VALUE);
			if (mali_pp_job_get_perf_counter_flag(core->running_job) &&
			    _MALI_PERFORMANCE_COUNTER_FLAG_SRC1_ENABLE && mali_pp_job_get_perf_counter_src1(core->running_job) == core->counter_src1_used)
			{
				/* We retrieved the counter that user space asked for, so return the value through the job object */
				mali_pp_job_set_perf_counter_value1(core->running_job, core->running_sub_job, val1);
			}
			else
			{
				/* User space asked for a counter, but this is not what we retrived (overridden by counter src set on core) */
				mali_pp_job_set_perf_counter_value1(core->running_job, core->running_sub_job, MALI_HW_CORE_INVALID_VALUE);
			}

#if MALI_TIMELINE_PROFILING_ENABLED
			_mali_osk_profiling_report_hw_counter(counter_index + 1, val1);
#endif
		}

#if MALI_TIMELINE_PROFILING_ENABLED
		_mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_STOP|MALI_PROFILING_MAKE_EVENT_CHANNEL_PP(core->core_id),
		                          val0, val1, core->counter_src0_used | (core->counter_src1_used << 8), 0, 0);
#endif

		/* We are no longer running a job... */
		core->running_job = NULL;
		_mali_osk_timer_del(core->timeout_timer);
	}
}
Ejemplo n.º 9
0
static void mali_gp_post_process_job(struct mali_gp_core *core, mali_bool suspend)
{
    MALI_ASSERT_GROUP_LOCKED(core->group);

    if (NULL != core->running_job)
    {
        u32 val0 = 0;
        u32 val1 = 0;
#if MALI_TIMELINE_PROFILING_ENABLED
        u32 event_id;
#endif

#if PROFILING_PRINT_L2_HITRATE_ON_GP_FINISH
        {
            u32 src0, value0, src1, value1, sum, per_thousand, per_thousand_now, diff0, diff1;
            static u32 print_nr=0;
            static u32 prev0=0;
            static u32 prev1=0;
            if ( !(++print_nr&511) )
            {
                mali_l2_cache_core_get_counter_values(mali_l2_cache_core_get_glob_l2_core(0), &src0, &value0, &src1, &value1);
                MALI_DEBUG_ASSERT( src0==20 );
                MALI_DEBUG_ASSERT( src1==21 );

                sum = value0+value1;
                if ( sum > 1000000 )
                {
                    per_thousand = value0 / (sum/1000);
                }
                else
                {
                    per_thousand = (value0*1000) / (sum);
                }
                diff0 = value0-prev0;
                diff1 = value1-prev1;

                sum = diff0 + diff1 ;
                if ( sum > 1000000 )
                {
                    per_thousand_now = diff0 / (sum/1000);
                }
                else
                {
                    per_thousand_now = (diff0*1000) / (sum);
                }

                prev0=value0;
                prev1=value1;
                if (per_thousand_now<=1000)
                {
                    MALI_DEBUG_PRINT(2, ("Mali L2: Read hits/misses:  %d/%d  =  %d thousand_parts total, since previous: %d\n", value0, value1, per_thousand, per_thousand_now));
                }

            }
        }
#endif

        if (MALI_HW_CORE_NO_COUNTER != core->counter_src0_used)
        {
            val0 = mali_hw_core_register_read(&core->hw_core, MALIGP2_REG_ADDR_MGMT_PERF_CNT_0_VALUE);
            if (mali_gp_job_get_perf_counter_flag(core->running_job) &&
                    _MALI_PERFORMANCE_COUNTER_FLAG_SRC0_ENABLE && mali_gp_job_get_perf_counter_src0(core->running_job) == core->counter_src0_used)
            {

                mali_gp_job_set_perf_counter_value0(core->running_job, val0);
            }
            else
            {

                mali_gp_job_set_perf_counter_value0(core->running_job, MALI_HW_CORE_INVALID_VALUE);
            }

#if MALI_TIMELINE_PROFILING_ENABLED
            _mali_osk_profiling_report_hw_counter(COUNTER_VP_C0, val0);
#endif

        }

        if (MALI_HW_CORE_NO_COUNTER != core->counter_src1_used)
        {
            val1 = mali_hw_core_register_read(&core->hw_core, MALIGP2_REG_ADDR_MGMT_PERF_CNT_1_VALUE);
            if (mali_gp_job_get_perf_counter_flag(core->running_job) &&
                    _MALI_PERFORMANCE_COUNTER_FLAG_SRC1_ENABLE && mali_gp_job_get_perf_counter_src1(core->running_job) == core->counter_src1_used)
            {

                mali_gp_job_set_perf_counter_value1(core->running_job, val1);
            }
            else
            {

                mali_gp_job_set_perf_counter_value1(core->running_job, MALI_HW_CORE_INVALID_VALUE);
            }

#if MALI_TIMELINE_PROFILING_ENABLED
            _mali_osk_profiling_report_hw_counter(COUNTER_VP_C1, val1);
#endif
        }

#if MALI_TIMELINE_PROFILING_ENABLED
        if (MALI_TRUE == suspend)
        {
            event_id = MALI_PROFILING_EVENT_TYPE_SUSPEND|MALI_PROFILING_MAKE_EVENT_CHANNEL_GP(0);
        }
        else
        {
            event_id = MALI_PROFILING_EVENT_TYPE_STOP|MALI_PROFILING_MAKE_EVENT_CHANNEL_GP(0);
        }
        _mali_osk_profiling_add_event(event_id, val0, val1, core->counter_src0_used | (core->counter_src1_used << 8), 0, 0);
#endif

        mali_gp_job_set_current_heap_addr(core->running_job,
                                          mali_hw_core_register_read(&core->hw_core, MALIGP2_REG_ADDR_MGMT_PLBU_ALLOC_START_ADDR));

        if (MALI_TRUE != suspend)
        {

            core->running_job = NULL;
            _mali_osk_timer_del(core->timeout_timer);
        }
    }
}
Ejemplo n.º 10
0
static void mali_gp_post_process_job(struct mali_gp_core *core, mali_bool suspend)
{
	MALI_ASSERT_GROUP_LOCKED(core->group);

	if (NULL != core->running_job)
	{
		u32 val0 = 0;
		u32 val1 = 0;
#if MALI_TIMELINE_PROFILING_ENABLED
		u32 event_id;
#endif

		if (MALI_HW_CORE_NO_COUNTER != core->counter_src0_used)
		{
			val0 = mali_hw_core_register_read(&core->hw_core, MALIGP2_REG_ADDR_MGMT_PERF_CNT_0_VALUE);
			if (mali_gp_job_get_perf_counter_flag(core->running_job) &&
			    _MALI_PERFORMANCE_COUNTER_FLAG_SRC0_ENABLE && mali_gp_job_get_perf_counter_src0(core->running_job) == core->counter_src0_used)
			{
				/* We retrieved the counter that user space asked for, so return the value through the job object */
				mali_gp_job_set_perf_counter_value0(core->running_job, val0);
			}
			else
			{
				/* User space asked for a counter, but this is not what we retrived (overridden by counter src set on core) */
				mali_gp_job_set_perf_counter_value0(core->running_job, MALI_HW_CORE_INVALID_VALUE);
			}

#if MALI_TIMELINE_PROFILING_ENABLED
			_mali_osk_profiling_report_hw_counter(COUNTER_VP_C0, val0);
#endif

		}

		if (MALI_HW_CORE_NO_COUNTER != core->counter_src1_used)
		{
			val1 = mali_hw_core_register_read(&core->hw_core, MALIGP2_REG_ADDR_MGMT_PERF_CNT_1_VALUE);
			if (mali_gp_job_get_perf_counter_flag(core->running_job) &&
			    _MALI_PERFORMANCE_COUNTER_FLAG_SRC1_ENABLE && mali_gp_job_get_perf_counter_src1(core->running_job) == core->counter_src1_used)
			{
				/* We retrieved the counter that user space asked for, so return the value through the job object */
				mali_gp_job_set_perf_counter_value1(core->running_job, val1);
			}
			else
			{
				/* User space asked for a counter, but this is not what we retrieved (overridden by counter src set on core) */
				mali_gp_job_set_perf_counter_value1(core->running_job, MALI_HW_CORE_INVALID_VALUE);
			}

#if MALI_TIMELINE_PROFILING_ENABLED
			_mali_osk_profiling_report_hw_counter(COUNTER_VP_C1, val1);
#endif
		}

#if MALI_TIMELINE_PROFILING_ENABLED
		if (MALI_TRUE == suspend)
		{
			event_id = MALI_PROFILING_EVENT_TYPE_SUSPEND|MALI_PROFILING_MAKE_EVENT_CHANNEL_GP(0);
		}
		else
		{
			event_id = MALI_PROFILING_EVENT_TYPE_STOP|MALI_PROFILING_MAKE_EVENT_CHANNEL_GP(0);
		}
		_mali_osk_profiling_add_event(event_id, val0, val1, core->counter_src0_used | (core->counter_src1_used << 8), 0, 0);
#endif

		mali_gp_job_set_current_heap_addr(core->running_job,
		                                  mali_hw_core_register_read(&core->hw_core, MALIGP2_REG_ADDR_MGMT_PLBU_ALLOC_START_ADDR));

		if (MALI_TRUE != suspend)
		{
			/* We are no longer running a job... */
			core->running_job = NULL;
			_mali_osk_timer_del(core->timeout_timer);
		}
	}
}
Ejemplo n.º 11
0
static void mali_pp_post_process_job(struct mali_pp_core *core)
{
    MALI_ASSERT_GROUP_LOCKED(core->group);

    if (NULL != core->running_job)
    {
        u32 val0 = 0;
        u32 val1 = 0;
#if MALI_TIMELINE_PROFILING_ENABLED
        int counter_index = COUNTER_FP0_C0 + (2 * core->core_id);
#endif

        if (MALI_HW_CORE_NO_COUNTER != core->counter_src0_used)
        {
            val0 = mali_hw_core_register_read(&core->hw_core, MALI200_REG_ADDR_MGMT_PERF_CNT_0_VALUE);
            if (mali_pp_job_get_perf_counter_flag(core->running_job) &&
                    _MALI_PERFORMANCE_COUNTER_FLAG_SRC0_ENABLE && mali_pp_job_get_perf_counter_src0(core->running_job) == core->counter_src0_used)
            {

                mali_pp_job_set_perf_counter_value0(core->running_job, core->running_sub_job, val0);
            }
            else
            {

                mali_pp_job_set_perf_counter_value0(core->running_job, core->running_sub_job, MALI_HW_CORE_INVALID_VALUE);
            }

#if MALI_TIMELINE_PROFILING_ENABLED
            _mali_osk_profiling_report_hw_counter(counter_index, val0);
#endif
        }

        if (MALI_HW_CORE_NO_COUNTER != core->counter_src1_used)
        {
            val1 = mali_hw_core_register_read(&core->hw_core, MALI200_REG_ADDR_MGMT_PERF_CNT_1_VALUE);
            if (mali_pp_job_get_perf_counter_flag(core->running_job) &&
                    _MALI_PERFORMANCE_COUNTER_FLAG_SRC1_ENABLE && mali_pp_job_get_perf_counter_src1(core->running_job) == core->counter_src1_used)
            {

                mali_pp_job_set_perf_counter_value1(core->running_job, core->running_sub_job, val1);
            }
            else
            {

                mali_pp_job_set_perf_counter_value1(core->running_job, core->running_sub_job, MALI_HW_CORE_INVALID_VALUE);
            }

#if MALI_TIMELINE_PROFILING_ENABLED
            _mali_osk_profiling_report_hw_counter(counter_index + 1, val1);
#endif
        }

#if MALI_TIMELINE_PROFILING_ENABLED
        _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_STOP|MALI_PROFILING_MAKE_EVENT_CHANNEL_PP(core->core_id),
                                      val0, val1, core->counter_src0_used | (core->counter_src1_used << 8), 0, 0);
#endif


        core->running_job = NULL;
        _mali_osk_timer_del(core->timeout_timer);
    }
}