MALI: utgard: RK: remove core_scaling in "platform specific code"
authorchenzhen <chenzhen@rock-chips.com>
Wed, 30 Nov 2016 01:14:39 +0000 (09:14 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Wed, 5 Apr 2017 09:15:52 +0000 (17:15 +0800)
DDK integrate_guide says
"not to use core_scaling on r5p0-01rel0 and later."

Change-Id: Ibb3eddac75548bb9f6763dc4dc9bad540746191f
Signed-off-by: chenzhen <chenzhen@rock-chips.com>
drivers/gpu/arm/mali400/mali/Kbuild
drivers/gpu/arm/mali400/mali/platform/rk30/arm_core_scaling.c [deleted file]
drivers/gpu/arm/mali400/mali/platform/rk30/arm_core_scaling.h [deleted file]
drivers/gpu/arm/mali400/mali/platform/rk30/mali_platform.c
drivers/gpu/arm/mali400/mali/platform/rk30/rk3066.c

index c3038ca111b5d613cad59f987f347ee2d9d247be..ae42b53c8ad9afeb133a0aac2dd3a7c22bd14e49 100755 (executable)
@@ -41,8 +41,7 @@ ifneq ($(MALI_PLATFORM),)
        mali-y += \
                platform/$(MALI_PLATFORM)/mali_platform.o \
                platform/$(MALI_PLATFORM)/rk3066.o \
-               platform/$(MALI_PLATFORM)/mali_dvfs.o \
-               platform/$(MALI_PLATFORM)/arm_core_scaling.o
+               platform/$(MALI_PLATFORM)/mali_dvfs.o
 endif
 
 mali-y += \
diff --git a/drivers/gpu/arm/mali400/mali/platform/rk30/arm_core_scaling.c b/drivers/gpu/arm/mali400/mali/platform/rk30/arm_core_scaling.c
deleted file mode 100644 (file)
index e95d60d..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * This confidential and proprietary software may be used only as
- * authorised by a licensing agreement from ARM Limited
- * (C) COPYRIGHT 2013-2014 ARM Limited
- * ALL RIGHTS RESERVED
- * The entire notice above must be reproduced on all authorised
- * copies and copies may only be made to the extent permitted
- * by a licensing agreement from ARM Limited.
- */
-
-/**
- * @file arm_core_scaling.c
- * Example core scaling policy.
- */
-
-/* #define ENABLE_DEBUG_LOG */
-#include "custom_log.h"
-
-#include "arm_core_scaling.h"
-
-#include <linux/mali/mali_utgard.h>
-#include "mali_kernel_common.h"
-
-#include <linux/workqueue.h>
-
-static int num_cores_total;
-static int num_cores_enabled;
-
-/**
- * 对连续的 request_to_disable_on_core 的计数.
- */
-static int count_of_requests_to_disable_one_core;
-/**
- * 在 count_of_requests_to_disable_one_core 等于本 value 的时候,
- * 将执行确实的 disable_one_core 操作.
- */
-#define NUM_OF_REQUESTS_TO_REALLY_DISABLE_ONE_CORE             (10)
-
-static struct work_struct wq_work;
-
-static void set_num_cores(struct work_struct *work)
-{
-       int err = mali_perf_set_num_pp_cores(num_cores_enabled);
-
-       MALI_DEBUG_ASSERT(0 == err);
-       MALI_IGNORE(err);
-}
-
-static void enable_one_core(void)
-{
-       if (num_cores_enabled < num_cores_total) {
-               ++num_cores_enabled;
-               schedule_work(&wq_work);
-               MALI_DEBUG_PRINT(3, ("Core scaling: Enabling one more core\n"));
-       }
-
-       MALI_DEBUG_ASSERT(1 <= num_cores_enabled);
-       MALI_DEBUG_ASSERT(num_cores_total >= num_cores_enabled);
-}
-
-static void disable_one_core(void)
-{
-       if (1 < num_cores_enabled) {
-               --num_cores_enabled;
-               schedule_work(&wq_work);
-               MALI_DEBUG_PRINT(3, ("Core scaling: Disabling one core\n"));
-       }
-
-       MALI_DEBUG_ASSERT(1 <= num_cores_enabled);
-       MALI_DEBUG_ASSERT(num_cores_total >= num_cores_enabled);
-}
-
-static void enable_max_num_cores(void)
-{
-       if (num_cores_enabled < num_cores_total) {
-               num_cores_enabled = num_cores_total;
-               schedule_work(&wq_work);
-               MALI_DEBUG_PRINT(3,
-                                ("Core scaling: Enabling max num of cores\n"));
-       }
-
-       MALI_DEBUG_ASSERT(num_cores_total == num_cores_enabled);
-}
-
-void mali_core_scaling_init(int num_pp_cores)
-{
-       INIT_WORK(&wq_work, set_num_cores);
-
-       num_cores_total   = num_pp_cores;
-       num_cores_enabled = num_pp_cores;
-
-       /* NOTE: Mali is not fully initialized at this point. */
-}
-
-void mali_core_scaling_sync(int num_cores)
-{
-       num_cores_enabled = num_cores;
-}
-
-void mali_core_scaling_term(void)
-{
-       flush_scheduled_work();
-}
-
-#define PERCENT_OF(percent, max) ((int) ((percent)*(max)/100.0 + 0.5))
-
-void mali_core_scaling_update(struct mali_gpu_utilization_data *data)
-{
-       /*
-        * This function implements a very trivial PP core scaling algorithm.
-        *
-        * It is _NOT_ of production quality.
-        * The only intention behind this algorithm is to exercise and test the
-        * core scaling functionality of the driver.
-        * It is _NOT_ tuned for neither power saving nor performance!
-        *
-        * Other metrics than PP utilization need to be considered as well
-        * in order to make a good core scaling algorithm.
-        */
-
-       MALI_DEBUG_PRINT(3,
-                        ("Utilization:(%3d, %3d, %3d), cores enabled: %d/%d\n",
-                         data->utilization_gpu,
-                         data->utilization_gp,
-                         data->utilization_pp,
-                         num_cores_enabled,
-                         num_cores_total));
-
-       /* NOTE:
-        * this function
-        * is normally called directly
-        *      from the utilization callback
-        *              which is in timer context. */
-
-       if (PERCENT_OF(90, 256) < data->utilization_pp) {
-               V("to enable max num of pp_cores.");
-               enable_max_num_cores();
-               count_of_requests_to_disable_one_core = 0;
-       } else if (PERCENT_OF(50, 256) < data->utilization_pp) {
-               V("to enable more one pp_core.");
-               enable_one_core();
-               count_of_requests_to_disable_one_core = 0;
-       } else if (PERCENT_OF(40, 256) < data->utilization_pp) {
-               count_of_requests_to_disable_one_core = 0;
-       } else if (PERCENT_OF(0, 256) < data->utilization_pp) {
-               count_of_requests_to_disable_one_core++;
-               if (count_of_requests_to_disable_one_core
-                       >= NUM_OF_REQUESTS_TO_REALLY_DISABLE_ONE_CORE) {
-                       V("to disable a pp_core.");
-                       disable_one_core();
-                       count_of_requests_to_disable_one_core = 0;
-               }
-       } else {
-               count_of_requests_to_disable_one_core = 0;
-       }
-}
diff --git a/drivers/gpu/arm/mali400/mali/platform/rk30/arm_core_scaling.h b/drivers/gpu/arm/mali400/mali/platform/rk30/arm_core_scaling.h
deleted file mode 100644 (file)
index 84fe221..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * This confidential and proprietary software may be used only as
- * authorised by a licensing agreement from ARM Limited
- * (C) COPYRIGHT 2013-2014 ARM Limited
- * ALL RIGHTS RESERVED
- * The entire notice above must be reproduced on all authorised
- * copies and copies may only be made to the extent permitted
- * by a licensing agreement from ARM Limited.
- */
-
-/**
- * @file arm_core_scaling.h
- * Example core scaling policy.
- */
-
-#ifndef __ARM_CORE_SCALING_H__
-#define __ARM_CORE_SCALING_H__
-
-struct mali_gpu_utilization_data;
-
-/**
- * Initialize core scaling policy.
- * .DP : core_scaling_policy, core_scaling_facility.
- *
- * @note
- * The core scaling policy will assume
- *      that all PP cores are on initially.
- *
- * @param num_pp_cores
- *      Total number of PP cores.
- */
-void mali_core_scaling_init(int num_pp_cores);
-
-/**
- * Terminate core scaling policy.
- */
-void mali_core_scaling_term(void);
-
-/**
- * Update core scaling policy
- *      with new utilization data.
- *
- * @param data
- *      Utilization data.
- */
-void mali_core_scaling_update(struct mali_gpu_utilization_data *data);
-
-void mali_core_scaling_sync(int num_cores);
-
-#endif /* __ARM_CORE_SCALING_H__ */
index 00d4e09891fd02da26d792292fcf988c0e6a1cfb..2c7576167a13b307d484a6c2fad7c58818d92f9c 100644 (file)
 
 #include "mali_kernel_common.h"
 #include "mali_osk.h"
-#include "arm_core_scaling.h"
 #include "mali_platform.h"
 
-/*
- * 是否使能 core_scaling 机制.
- * .DP : core_scaling : 根据当前 mali_utilization_data,
- *                     配置 mali_gpu 中具体使用的 pp_core 的个数.
- */
-static int mali_core_scaling_enable;
-
 u32 mali_group_error;
 
 /*
@@ -324,7 +316,6 @@ _mali_osk_errcode_t mali_platform_init(struct platform_device *pdev)
        mali_drv_data->clock_set_lock =
                _mali_osk_mutex_init(_MALI_OSK_LOCKFLAG_ORDERED,
                                     _MALI_OSK_LOCK_ORDER_UTILIZATION);
-       mali_core_scaling_enable = 1;
 
        return 0;
 term_clk:
@@ -340,7 +331,6 @@ _mali_osk_errcode_t mali_platform_deinit(struct platform_device *pdev)
 
        mali_remove_sysfs(dev);
 
-       mali_core_scaling_term();
        mali_clock_term(dev);
        _mali_osk_mutex_term(drv_data->clock_set_lock);
 
@@ -408,9 +398,6 @@ void mali_gpu_utilization_handler(struct mali_gpu_utilization_data *data)
        if (data->utilization_pp > 256)
                return;
 
-       if (mali_core_scaling_enable)
-               mali_core_scaling_update(data);
-
        /* dev_dbg(mali_dev, "utilization:%d\r\n", data->utilization_pp); */
 
        mali_dvfs_event(mali_dev, data->utilization_pp);
index f7d264459da1da9ad51c1ec5ec8f52f99a69b3f2..91556e25e8660938a9776022c992ead091f8b74b 100644 (file)
@@ -39,7 +39,6 @@
 #include <linux/mali/mali_utgard.h>
 #include "mali_kernel_common.h"
 #include "mali_platform.h"
-#include "arm_core_scaling.h"
 
 #ifdef CONFIG_PM_RUNTIME
 static int mali_runtime_suspend(struct device *device)
@@ -219,23 +218,7 @@ static void mali_platform_device_add_config(struct platform_device *pdev)
  */
 int mali_platform_device_init(struct platform_device *pdev)
 {
-// error
        int err = 0;
-       int num_pp_cores = 0;
-
-       D("mali_platform_device_register() called\n");
-
-       if (of_machine_is_compatible("rockchip,rk3036"))
-               num_pp_cores = 1;
-       else if (of_machine_is_compatible("rockchip,rk3228h"))
-               num_pp_cores = 2;
-       else if (of_machine_is_compatible("rockchip,rk3328h"))
-               num_pp_cores = 2;
-       else
-               num_pp_cores = 2;
-
-       D("to add config.");
-       mali_platform_device_add_config(pdev);
 
        D("to add data to platform_device..");
        /* 将 platform_specific_data 添加到 platform_device_of_mali_gpu.
@@ -253,8 +236,6 @@ int mali_platform_device_init(struct platform_device *pdev)
                        pm_runtime_use_autosuspend(&(pdev->dev));
                        pm_runtime_enable(&(pdev->dev));
 #endif
-                       MALI_DEBUG_ASSERT(0 < num_pp_cores);
-                       mali_core_scaling_init(num_pp_cores);
                        return 0;
                }
        }