Spectrum added some codes on r5p0_rel0 public, so do it on r5p2_rel0.
But except some codes related with below defines
SPRD_MEM_OPT_PAGE_TABLE_SHRINK
MALI_IOC_MEM_INIT
MALI_IOC_MEM_TERM
because we cannot add them by changed codes from r5p2_rel0.
Change-Id: I1423e7ce5181d4f1a08f3fbd01f9d426290eff29
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
# set up defaults if not defined by the user
TIMESTAMP ?= default
OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB ?= 16
-USING_GPU_UTILIZATION ?= 0
+USING_GPU_UTILIZATION ?= 1
PROFILING_SKIP_PP_JOBS ?= 0
PROFILING_SKIP_PP_AND_GP_JOBS ?= 0
MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP ?= 0
ccflags-y += $(EXTRA_DEFINES)
# Set up our defines, which will be passed to gcc
+ccflags-y += -DSPRD_GPU_BOOST
+
ccflags-y += -DMALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP=$(MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP)
ccflags-y += -DMALI_PP_SCHEDULER_KEEP_SUB_JOB_STARTS_ALIGNED=$(MALI_PP_SCHEDULER_KEEP_SUB_JOB_STARTS_ALIGNED)
ccflags-y += -DMALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS=$(MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS)
ccflags-y += -DMALI_UPPER_HALF_SCHEDULING
endif
-ccflags-$(CONFIG_MALI400_UMP) += -I$(src)/../../ump/include/ump
+ccflags-$(CONFIG_MALI400_UMP) += -I$(src)/../ump/include/ump
ccflags-$(CONFIG_MALI400_DEBUG) += -DDEBUG
# Use our defines when compiling
-ccflags-y += -I$(src) -I$(src)/include -I$(src)/common -I$(src)/linux -I$(src)/platform
+ccflags-y += -I$(src) -I$(src)/include -I$(src)/common -I$(src)/linux -I$(src)/platform -I$(src)/platform/$(MALI_PLATFORM)
# Get subversion revision number, fall back to only ${MALI_RELEASE_NAME} if no svn info is available
MALI_RELEASE_NAME=$(shell cat $(src)/.version 2> /dev/null)
-SVN_INFO = (cd $(src); svn info 2>/dev/null)
+#SVN_INFO = (cd $(src); svn info 2>/dev/null)
ifneq ($(shell $(SVN_INFO) 2>/dev/null),)
# SVN detected
REPO_URL := $(shell $(SVN_INFO) | grep '^URL: ' | cut -d: -f2- | cut -b2-)
else # SVN
-GIT_REV := $(shell cd $(src); git describe --always 2>/dev/null)
+#GIT_REV := $(shell cd $(src); git describe --always 2>/dev/null)
ifneq ($(GIT_REV),)
# Git detected
DRIVER_REV := $(MALI_RELEASE_NAME)-$(GIT_REV)
endif
ccflags-y += -DSVN_REV_STRING=\"$(DRIVER_REV)\"
+ccflags-y += -fno-PIC
VERSION_STRINGS :=
VERSION_STRINGS += API_VERSION=$(shell cd $(src); grep "\#define _MALI_API_VERSION" $(FILES_PREFIX)include/linux/mali/mali_utgard_uk_types.h | cut -d' ' -f 3 )
VERSION_STRINGS += REVISION=$(DRIVER_REV)
VERSION_STRINGS += CHANGED_REVISION=$(CHANGED_REVISION)
VERSION_STRINGS += CHANGE_DATE=$(CHANGE_DATE)
-VERSION_STRINGS += BUILD_DATE=$(shell date)
+#VERSION_STRINGS += BUILD_DATE=$(shell date)
ifdef CONFIG_MALI400_DEBUG
VERSION_STRINGS += BUILD=debug
else
# 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.
#
-
+USING_UMP=0
USE_UMPV2=0
-USING_PROFILING ?= 1
+USING_PROFILING ?= 0
USING_INTERNAL_PROFILING ?= 0
-USING_DVFS ?= 1
+USING_DVFS ?= 0
MALI_HEATMAPS_ENABLED ?= 0
MALI_DMA_BUF_MAP_ON_ATTACH ?= 1
MALI_PMU_PARALLEL_POWER_UP ?= 0
-USING_DT ?= 0
+MALI_SHARED_INTERRUPTS ?= 1
+USING_DT ?= 1
# The Makefile sets up "arch" based on the CONFIG, creates the version info
# string and the __malidrv_build_info.c file, and then call the Linux build
ifeq ($(ARCH), arm)
# when compiling for ARM we're cross compiling
-export CROSS_COMPILE ?= $(call check_cc2, arm-linux-gnueabi-gcc, arm-linux-gnueabi-, arm-none-linux-gnueabi-)
+export CROSS_COMPILE ?= $(call check_cc2, arm-linux-gnueabi-gcc, arm-linux-gnueabi-, arm-eabi-)
endif
# report detected/selected settings
# Set up build config
export CONFIG_MALI400=m
-export CONFIG_MALI450=y
+# export CONFIG_MALI450=y
export EXTRA_DEFINES += -DCONFIG_MALI400=1
-export EXTRA_DEFINES += -DCONFIG_MALI450=1
+# export EXTRA_DEFINES += -DCONFIG_MALI450=1
ifneq ($(MALI_PLATFORM),)
export EXTRA_DEFINES += -DMALI_FAKE_PLATFORM_DEVICE=1
/*
* ---------- Forward declaration of static functions ----------
*/
-static void mali_executor_lock(void);
-static void mali_executor_unlock(void);
static mali_bool mali_executor_is_suspended(void *data);
static mali_bool mali_executor_is_working(void);
static void mali_executor_disable_empty_virtual(void);
_mali_osk_list_t *new_list,
u32 *new_count);
+extern bool mali_is_on(void);
+extern void mali_executor_lock(void);
+extern void mali_executor_unlock(void);
/*
* ---------- Actual implementation ----------
*/
_mali_osk_errcode_t mali_executor_interrupt_gp(struct mali_group *group,
mali_bool in_upper_half)
{
- enum mali_interrupt_result int_result;
+ enum mali_interrupt_result int_result = MALI_INTERRUPT_RESULT_NONE;
mali_bool time_out = MALI_FALSE;
MALI_DEBUG_PRINT(4, ("Executor: GP interrupt from %s in %s half\n",
mali_gp_job_get_id(group->gp_running_job),
mali_group_core_description(group)));
} else {
- int_result = mali_group_get_interrupt_result_gp(group);
- if (MALI_INTERRUPT_RESULT_NONE == int_result) {
- mali_executor_unlock();
- return _MALI_OSK_ERR_FAULT;
+ if (mali_is_on()) {
+ int_result = mali_group_get_interrupt_result_gp(group);
+ if (MALI_INTERRUPT_RESULT_NONE == int_result) {
+ mali_executor_unlock();
+ return _MALI_OSK_ERR_FAULT;
+ }
}
}
_mali_osk_errcode_t mali_executor_interrupt_pp(struct mali_group *group,
mali_bool in_upper_half)
{
- enum mali_interrupt_result int_result;
+ enum mali_interrupt_result int_result = MALI_INTERRUPT_RESULT_NONE;
mali_bool time_out = MALI_FALSE;
MALI_DEBUG_PRINT(4, ("Executor: PP interrupt from %s in %s half\n",
if (!mali_group_is_working(group)) {
/* Not working, so nothing to do */
mali_executor_unlock();
+ MALI_DEBUG_PRINT(3, ("group is not working while receive the interrupt\n"));
return _MALI_OSK_ERR_FAULT;
}
mali_pp_job_get_id(group->pp_running_job),
mali_group_core_description(group)));
} else {
- int_result = mali_group_get_interrupt_result_pp(group);
- if (MALI_INTERRUPT_RESULT_NONE == int_result) {
- mali_executor_unlock();
- return _MALI_OSK_ERR_FAULT;
+ if (mali_is_on()) {
+ int_result = mali_group_get_interrupt_result_pp(group);
+ if (MALI_INTERRUPT_RESULT_NONE == int_result) {
+ mali_executor_unlock();
+ return _MALI_OSK_ERR_FAULT;
+ }
}
}
-
#if defined(CONFIG_MALI_SHARED_INTERRUPTS)
if (MALI_INTERRUPT_RESULT_NONE == int_result) {
/* No interrupts signalled, so nothing to do */
_mali_osk_errcode_t mali_executor_interrupt_mmu(struct mali_group *group,
mali_bool in_upper_half)
{
- enum mali_interrupt_result int_result;
+ enum mali_interrupt_result int_result = MALI_INTERRUPT_RESULT_NONE;
MALI_DEBUG_PRINT(4, ("Executor: MMU interrupt from %s in %s half\n",
mali_group_core_description(group),
MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
MALI_DEBUG_ASSERT(mali_group_is_working(group));
- int_result = mali_group_get_interrupt_result_mmu(group);
- if (MALI_INTERRUPT_RESULT_NONE == int_result) {
- mali_executor_unlock();
- return _MALI_OSK_ERR_FAULT;
+ if (mali_is_on()) {
+ int_result = mali_group_get_interrupt_result_mmu(group);
+ if (MALI_INTERRUPT_RESULT_NONE == int_result) {
+ mali_executor_unlock();
+ return _MALI_OSK_ERR_FAULT;
+ }
}
#if defined(CONFIG_MALI_SHARED_INTERRUPTS)
* ---------- Implementation of static functions ----------
*/
-static void mali_executor_lock(void)
+void mali_executor_lock(void)
{
_mali_osk_spinlock_irq_lock(mali_executor_lock_obj);
MALI_DEBUG_PRINT(5, ("Executor: lock taken\n"));
}
-static void mali_executor_unlock(void)
+void mali_executor_unlock(void)
{
MALI_DEBUG_PRINT(5, ("Executor: Releasing lock\n"));
_mali_osk_spinlock_irq_unlock(mali_executor_lock_obj);
MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD();
if (mali_group_is_in_virtual(group)) {
struct mali_group *tmp_group = mali_executor_get_virtual_group();
- return tmp_group->is_working;
+ return tmp_group->is_working && (tmp_group->power_is_on);
}
- return group->is_working;
+ return (group->is_working) && (group->power_is_on);
}
MALI_STATIC_INLINE struct mali_gp_job *mali_group_get_running_gp_job(struct mali_group *group)
MALI_INTERRUPT_RESULT_ERROR
};
+extern bool mali_is_on(void);
+
_mali_osk_errcode_t mali_hw_core_create(struct mali_hw_core *core, const _mali_osk_resource_t *resource, u32 reg_size);
void mali_hw_core_delete(struct mali_hw_core *core);
MALI_STATIC_INLINE u32 mali_hw_core_register_read(struct mali_hw_core *core, u32 relative_address)
{
u32 read_val;
+ if (!mali_is_on()){
+ MALI_DEBUG_PRINT(1, ("mali_hw_core_register_read find mali is OFF, top error\n"));
+ dump_stack();
+ return 0;
+ }
+
read_val = _mali_osk_mem_ioread32(core->mapped_registers, relative_address);
MALI_DEBUG_PRINT(6, ("register_read for core %s, relative addr=0x%04X, val=0x%08X\n",
core->description, relative_address, read_val));
MALI_STATIC_INLINE void mali_hw_core_register_write_relaxed(struct mali_hw_core *core, u32 relative_address, u32 new_val)
{
+ if (!mali_is_on())
+ {
+ MALI_DEBUG_PRINT(1, ("mali_hw_core_register_write_relaxed find mali is OFF, top error\n"));
+ dump_stack();
+ return;
+ }
+
MALI_DEBUG_PRINT(6, ("register_write_relaxed for core %s, relative addr=0x%04X, val=0x%08X\n",
core->description, relative_address, new_val));
_mali_osk_mem_iowrite32_relaxed(core->mapped_registers, relative_address, new_val);
* If the new value is different, the old value will also be updated */
MALI_STATIC_INLINE void mali_hw_core_register_write_relaxed_conditional(struct mali_hw_core *core, u32 relative_address, u32 new_val, const u32 old_val)
{
+ if (!mali_is_on())
+ {
+ MALI_DEBUG_PRINT(1, ("mali_hw_core_register_write_relaxed_conditional find mali is OFF, top error\n"));
+ dump_stack();
+ return;
+ }
MALI_DEBUG_PRINT(6, ("register_write_relaxed for core %s, relative addr=0x%04X, val=0x%08X\n",
core->description, relative_address, new_val));
if (old_val != new_val) {
MALI_STATIC_INLINE void mali_hw_core_register_write(struct mali_hw_core *core, u32 relative_address, u32 new_val)
{
+ if (!mali_is_on())
+ {
+ MALI_DEBUG_PRINT(1, ("mali_hw_core_register_write find mali is OFF, top error\n"));
+ dump_stack();
+ return;
+ }
MALI_DEBUG_PRINT(6, ("register_write for core %s, relative addr=0x%04X, val=0x%08X\n",
core->description, relative_address, new_val));
_mali_osk_mem_iowrite32(core->mapped_registers, relative_address, new_val);
MALI_STATIC_INLINE void mali_hw_core_register_write_array_relaxed(struct mali_hw_core *core, u32 relative_address, u32 *write_array, u32 nr_of_regs)
{
u32 i;
+ if (!mali_is_on())
+ {
+ MALI_DEBUG_PRINT(1, ("mali_hw_core_register_write_array_relaxed find mali is OFF, top error\n"));
+ dump_stack();
+ return;
+ }
MALI_DEBUG_PRINT(6, ("register_write_array: for core %s, relative addr=0x%04X, nr of regs=%u\n",
core->description, relative_address, nr_of_regs));
MALI_STATIC_INLINE void mali_hw_core_register_write_array_relaxed_conditional(struct mali_hw_core *core, u32 relative_address, u32 *write_array, u32 nr_of_regs, const u32 *old_array)
{
u32 i;
+ if (!mali_is_on())
+ {
+ MALI_DEBUG_PRINT(1, ("mali_hw_core_register_write_array_relaxed_conditional find mali is OFF, top error\n"));
+ dump_stack();
+ return;
+ }
MALI_DEBUG_PRINT(6, ("register_write_array: for core %s, relative addr=0x%04X, nr of regs=%u\n",
core->description, relative_address, nr_of_regs));
return err;
}
- err = mali_executor_initialize();
- if (_MALI_OSK_ERR_OK != err) {
- mali_terminate_subsystems();
- return err;
- }
-
err = mali_scheduler_initialize();
if (_MALI_OSK_ERR_OK != err) {
mali_terminate_subsystems();
#endif
session->use_high_priority_job_queue = MALI_FALSE;
-
+#ifdef SPRD_GPU_BOOST
+ session->level = 0;
+#endif
/* Initialize list of PP jobs on this session. */
_MALI_OSK_INIT_LIST_HEAD(&session->pp_job_list);
pages[j]);
if (_MALI_OSK_ERR_OK != ret) {
MALI_PRINT_ERROR(("Failed to invalidate cache (page)\n"));
+ dump_stack();
}
}
if (phys_addr < (phys_addr + size)) { /* Don't allow overflow (or zero size) */
if ((0 == (phys_addr & (~_MALI_OSK_CPU_PAGE_MASK))) &&
(0 == (size & (~_MALI_OSK_CPU_PAGE_MASK)))) {
+#if 0
if ((phys_addr >= mali_mem_validator.phys_base) &&
((phys_addr + (size - 1)) >= mali_mem_validator.phys_base) &&
(phys_addr <= (mali_mem_validator.phys_base + (mali_mem_validator.size - 1))) &&
- ((phys_addr + (size - 1)) <= (mali_mem_validator.phys_base + (mali_mem_validator.size - 1)))) {
+ ((phys_addr + (size - 1)) <= (mali_mem_validator.phys_base + (mali_mem_validator.size - 1))) )
+#endif
+ {
MALI_DEBUG_PRINT(3, ("Accepted range 0x%08X + size 0x%08X (= 0x%08X)\n", phys_addr, size, (phys_addr + size - 1)));
return _MALI_OSK_ERR_OK;
}
mali_dma_addr pde_phys;
int i;
- if (last_pde < first_pde)
+ if (last_pde < first_pde){
+ MALI_DEBUG_PRINT(2,("function = %s, line =%d, last_pde < first_pde \n", __FUNCTION__, __LINE__));
return _MALI_OSK_ERR_INVALID_ARGS;
+ }
for (i = first_pde; i <= last_pde; i++) {
if (0 == (_mali_osk_mem_ioread32(pagedir->page_directory_mapped,
err = mali_mmu_get_table_page(&pde_phys, &pde_mapping);
if (_MALI_OSK_ERR_OK != err) {
- MALI_PRINT_ERROR(("Failed to allocate page table page.\n"));
+ MALI_PRINT_ERROR(("Failed to allocate page table page( %d).\n", err));
return err;
}
pagedir->page_entries_mapped[i] = pde_mapping;
mali_mmu_dump_page(pagedir->page_directory_mapped, pagedir->page_directory, info)
);
- for (i = 0; i < 1024; i++) {
+ for (i = 0; i < sizeof(pagedir->page_entries_mapped) / sizeof(pagedir->page_entries_mapped[0]); i++) {
if (NULL != pagedir->page_entries_mapped[i]) {
MALI_CHECK_NO_ERROR(
mali_mmu_dump_page(pagedir->page_entries_mapped[i],
PMU_REG_ADDR_MGMT_INT_CLEAR, PMU_REG_VAL_IRQ);
}
-#if defined(DEBUG)
- /* Verify power status of domains after power down */
- stat = mali_hw_core_register_read(&pmu->hw_core,
- PMU_REG_ADDR_MGMT_STATUS);
- MALI_DEBUG_ASSERT(mask == (stat & mask));
-#endif
-
return _MALI_OSK_ERR_OK;
}
}
#endif
-#if defined(DEBUG)
- /* Verify power status of domains after power up */
- stat = mali_hw_core_register_read(&pmu->hw_core,
- PMU_REG_ADDR_MGMT_STATUS);
- MALI_DEBUG_ASSERT(0 == (stat & mask));
-#endif /* defined(DEBUG) */
-
return _MALI_OSK_ERR_OK;
}
}
point_ptr = (u32 __user *)(uintptr_t)mali_gp_job_get_timeline_point_ptr(job);
-
+#ifdef SPRD_GPU_BOOST
+ {
+ extern int gpu_boost_level;
+ extern int gpu_boost_sf_level;
+ if (99 == session->level)
+ {
+ gpu_boost_sf_level = 1;
+ }
+ else
+ {
+ if (gpu_boost_level < session->level)
+ gpu_boost_level = session->level;
+ }
+ }
+#endif
point = mali_scheduler_submit_gp_job(session, job);
if (0 != _mali_osk_put_user(((u32) point), point_ptr)) {
}
point_ptr = (u32 __user *)(uintptr_t)mali_pp_job_get_timeline_point_ptr(job);
-
+#ifdef SPRD_GPU_BOOST
+ {
+ extern int gpu_boost_level;
+ extern int gpu_boost_sf_level;
+ if (99 == session->level)
+ {
+ gpu_boost_sf_level = 1;
+ }
+ else
+ {
+ if (gpu_boost_level < session->level)
+ gpu_boost_level = session->level;
+ }
+ }
+#endif
point = mali_scheduler_submit_pp_job(session, job);
job = NULL;
}
point_ptr = (u32 __user *)(uintptr_t)mali_pp_job_get_timeline_point_ptr(pp_job);
-
+#ifdef SPRD_GPU_BOOST
+ {
+ extern int gpu_boost_level;
+ extern int gpu_boost_sf_level;
+ if (99 == session->level)
+ {
+ gpu_boost_sf_level = 1;
+ }
+ else
+ {
+ if (gpu_boost_level < session->level)
+ gpu_boost_level = session->level;
+ }
+ }
+#endif
/* Submit GP job. */
mali_scheduler_submit_gp_job(session, gp_job);
gp_job = NULL;
size_t max_mali_mem_allocated_size; /**< The past max mali memory allocated size, which include mali os memory and mali dedicated memory. */
/* Added for new memroy system */
struct mali_allocation_manager allocation_mgr;
+#ifdef SPRD_GPU_BOOST
+ int level;
+#endif
};
_mali_osk_errcode_t mali_session_initialize(void);
#define MALI_IOC_TIMELINE_CREATE_SYNC_FENCE _IOWR(MALI_IOC_CORE_BASE, _MALI_UK_TIMELINE_CREATE_SYNC_FENCE, _mali_uk_timeline_create_sync_fence_s)
#define MALI_IOC_SOFT_JOB_START _IOWR(MALI_IOC_CORE_BASE, _MALI_UK_SOFT_JOB_START, _mali_uk_soft_job_start_s)
#define MALI_IOC_SOFT_JOB_SIGNAL _IOWR(MALI_IOC_CORE_BASE, _MALI_UK_SOFT_JOB_SIGNAL, _mali_uk_soft_job_signal_s)
+#define MALI_IOC_SET_GPU_BOOST_LEVEL _IOWR(MALI_IOC_CORE_BASE, _MALI_UK_SET_GPU_BOOST_LEVEL, int)
#define MALI_IOC_MEM_ALLOC _IOWR(MALI_IOC_MEMORY_BASE, _MALI_UK_ALLOC_MEM, _mali_uk_alloc_mem_s)
#define MALI_IOC_MEM_FREE _IOWR(MALI_IOC_MEMORY_BASE, _MALI_UK_FREE_MEM, _mali_uk_free_mem_s)
_MALI_UK_TIMELINE_CREATE_SYNC_FENCE, /**< _mali_ukk_timeline_create_sync_fence() */
_MALI_UK_SOFT_JOB_START, /**< _mali_ukk_soft_job_start() */
_MALI_UK_SOFT_JOB_SIGNAL, /**< _mali_ukk_soft_job_signal() */
+ _MALI_UK_SET_GPU_BOOST_LEVEL, /**< set gpu level to control frequency */
/** Memory functions */
#include <linux/miscdevice.h>
#include <linux/bug.h>
#include <linux/of.h>
-
+#ifdef CONFIG_PM_RUNTIME
+#include <linux/pm_runtime.h>
+#endif
#include <linux/mali/mali_utgard.h>
#include "mali_kernel_common.h"
#include "mali_session.h"
static struct mali_gpu_clk_item mali_gpu_clk[2];
#endif
+#include <linux/dma-mapping.h>
+
/* Streamline support for the Mali driver */
#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_MALI400_PROFILING)
/* Ask Linux to create the tracepoints */
module_param(mali_debug_level, int, S_IRUSR | S_IWUSR | S_IWGRP | S_IRGRP | S_IROTH); /* rw-rw-r-- */
MODULE_PARM_DESC(mali_debug_level, "Higher number, more dmesg output");
+int gpu_freq_cur = 0;
+module_param(gpu_freq_cur, int, S_IRUSR | S_IRGRP | S_IROTH); /* r-r-r-- */
+MODULE_PARM_DESC(gpu_freq_cur, "GPU gpu_freq_cur");
+
+int gpu_freq_min_limit = -1;
+module_param(gpu_freq_min_limit, int, S_IRUSR | S_IWUSR | S_IWGRP | S_IRGRP | S_IROTH); /* rw-rw-r-- */
+MODULE_PARM_DESC(gpu_freq_min_limit, "GPU min_freq limit");
+
+int gpu_freq_max_limit = -1;
+module_param(gpu_freq_max_limit, int, S_IRUSR | S_IWUSR | S_IWGRP | S_IRGRP | S_IROTH); /* rw-rw-r-- */
+MODULE_PARM_DESC(gpu_freq_max_limit, "GPU max_freq limit");
+
+char* gpu_freq_list = NULL;
+module_param(gpu_freq_list, charp,S_IRUSR | S_IRGRP | S_IROTH ); /* r-r-r-- */
+MODULE_PARM_DESC(gpu_freq_list, "GPU freq_list");
+
+int gpu_boost_level=0;
+module_param(gpu_boost_level, int, S_IRUSR | S_IRGRP | S_IROTH); /* r-r-r-- */
+MODULE_PARM_DESC(gpu_boost_level, "GPU gpu_boost_level");
+
+int gpu_boost_sf_level = 0;
+module_param(gpu_boost_sf_level, int, S_IRUSR | S_IRGRP | S_IROTH); /* r-r-r-- */
+MODULE_PARM_DESC(gpu_boost_sf_level, "GPU gpu boost surfaceflinger level");
+
extern int mali_max_job_runtime;
module_param(mali_max_job_runtime, int, S_IRUSR | S_IWUSR | S_IWGRP | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(mali_max_job_runtime, "Maximum allowed job runtime in msecs.\nJobs will be killed after this no matter what");
static int mali_driver_runtime_idle(struct device *dev);
#endif
+extern void mali_platform_power_mode_change(int power_mode);
+
#if defined(MALI_FAKE_PLATFORM_DEVICE)
#if defined(CONFIG_MALI_DT)
extern int mali_platform_device_init(struct platform_device *device);
#endif
#ifdef CONFIG_MALI_DT
-static struct of_device_id base_dt_ids[] = {
+struct of_device_id base_dt_ids[] = {
{.compatible = "arm,mali-300"},
{.compatible = "arm,mali-400"},
{.compatible = "arm,mali-450"},
int err = 0;
MALI_DEBUG_PRINT(2, ("Inserting Mali v%d device driver. \n", _MALI_API_VERSION));
- MALI_DEBUG_PRINT(2, ("Compiled: %s, time: %s.\n", __DATE__, __TIME__));
+// MALI_DEBUG_PRINT(2, ("Compiled: %s, time: %s.\n", __DATE__, __TIME__));
MALI_DEBUG_PRINT(2, ("Driver revision: %s\n", SVN_REV_STRING));
#if MALI_ENABLE_CPU_CYCLES
mali_platform_device = pdev;
+#ifdef CONFIG_64BIT
+ static u64 mali_dma_mask = DMA_BIT_MASK(32);
+ pdev->dev.dma_mask = &mali_dma_mask;
+#endif
+
+ err = mali_executor_initialize();
+ if (_MALI_OSK_ERR_OK != err)
+ {
+ MALI_PRINT_ERROR(("mali_executor_initialize failed.\n"));
+ return -EFAULT;
+ }
+
#ifdef CONFIG_MALI_DT
/* If we use DT to initialize our DDK, we have to prepare somethings. */
err = mali_platform_device_init(mali_platform_device);
static int mali_driver_suspend_scheduler(struct device *dev)
{
mali_pm_os_suspend(MALI_TRUE);
+
+ if (pm_runtime_active(dev))
+ mali_platform_power_mode_change(2);
+
/* Tracing the frequency and voltage after mali is suspended */
_mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_SINGLE |
MALI_PROFILING_EVENT_CHANNEL_GPU |
mali_gpu_clk[1].vol / 1000,
0, 0, 0);
#endif
+
+ if (pm_runtime_active(dev))
+ mali_platform_power_mode_change(0);
+
mali_pm_os_resume();
return 0;
}
static int mali_driver_runtime_suspend(struct device *dev)
{
if (MALI_TRUE == mali_pm_runtime_suspend()) {
+ mali_platform_power_mode_change(1);
+
/* Tracing the frequency and voltage after mali is suspended */
_mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_SINGLE |
MALI_PROFILING_EVENT_CHANNEL_GPU |
mali_gpu_clk[1].vol / 1000,
0, 0, 0);
#endif
+ mali_platform_power_mode_change(0);
mali_pm_runtime_resume();
return 0;
static int mali_driver_runtime_idle(struct device *dev)
{
- /* Nothing to do */
+ MALI_DEBUG_PRINT(5, ("%s:%d \n",__FUNCTION__, __LINE__));
+ pm_runtime_suspend(dev);
return 0;
}
#endif
BUILD_BUG_ON(!IS_ALIGNED(sizeof(_mali_uk_get_user_settings_s), sizeof(u64)));
err = get_user_settings_wrapper(session_data, (_mali_uk_get_user_settings_s __user *)arg);
break;
-
+#ifdef SPRD_GPU_BOOST
+ case MALI_IOC_SET_GPU_BOOST_LEVEL:
+ err = get_user(session_data->level,(int __user *)arg);
+ break;
+#endif
case MALI_IOC_REQUEST_HIGH_PRIORITY:
BUILD_BUG_ON(!IS_ALIGNED(sizeof(_mali_uk_request_high_priority_s), sizeof(u64)));
err = request_high_priority_wrapper(session_data, (_mali_uk_request_high_priority_s __user *)arg);
TP_fast_assign(
__entry->counter_id = counter_id;
+ __entry->value = value;
),
TP_printk("event %d = %d", __entry->counter_id, __entry->value)
vma->vm_flags |= VM_DONTEXPAND;
#endif
+ /* For CTS5.1_r0.5 security case
+ * force read mapping fail if meet KBASE_REG_COOKIE_MTP or KBASE_REG_COOKIE_TB
+ */
+#define KBASE_REG_COOKIE_MTP 1
+#define KBASE_REG_COOKIE_TB 2
+ if ((vma->vm_pgoff == KBASE_REG_COOKIE_MTP) || (vma->vm_pgoff == KBASE_REG_COOKIE_TB)) {
+ vma->vm_flags &= ~(VM_READ | VM_MAYREAD);
+ }
+
vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
vma->vm_ops = &mali_kernel_vm_ops;
return 0;
}
-
MALI_DEBUG_ASSERT_POINTER(sync_pt);
mpt = to_mali_sync_pt(sync_pt);
+ if (mpt == NULL || mpt->flag == NULL)
+ {
+ MALI_DEBUG_PRINT(2, ("mali timeline NULL resource mpt: %p, mpt->flag: %p\n", (void *)mpt, (void *)(mpt->flag)));
+ return;
+ }
/* It is possible this sync point is just under construct,
* make sure the flag is valid before accessing it