ARM: mali400: r5p2_rel0: sync codes for TM1 from r5p0_rel0 53/69353/2
authorJoonyoung Shim <jy0922.shim@samsung.com>
Tue, 10 May 2016 07:18:10 +0000 (16:18 +0900)
committerJoonyoung Shim <jy0922.shim@samsung.com>
Mon, 23 May 2016 06:41:26 +0000 (15:41 +0900)
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>
18 files changed:
drivers/gpu/arm/mali400/r5p2_rel0/Kbuild
drivers/gpu/arm/mali400/r5p2_rel0/Makefile
drivers/gpu/arm/mali400/r5p2_rel0/common/mali_executor.c
drivers/gpu/arm/mali400/r5p2_rel0/common/mali_group.h
drivers/gpu/arm/mali400/r5p2_rel0/common/mali_hw_core.h
drivers/gpu/arm/mali400/r5p2_rel0/common/mali_kernel_core.c
drivers/gpu/arm/mali400/r5p2_rel0/common/mali_l2_cache.c
drivers/gpu/arm/mali400/r5p2_rel0/common/mali_mem_validation.c
drivers/gpu/arm/mali400/r5p2_rel0/common/mali_mmu_page_directory.c
drivers/gpu/arm/mali400/r5p2_rel0/common/mali_pmu.c
drivers/gpu/arm/mali400/r5p2_rel0/common/mali_scheduler.c
drivers/gpu/arm/mali400/r5p2_rel0/common/mali_session.h
drivers/gpu/arm/mali400/r5p2_rel0/include/linux/mali/mali_utgard_ioctl.h
drivers/gpu/arm/mali400/r5p2_rel0/include/linux/mali/mali_utgard_uk_types.h
drivers/gpu/arm/mali400/r5p2_rel0/linux/mali_kernel_linux.c
drivers/gpu/arm/mali400/r5p2_rel0/linux/mali_linux_trace.h
drivers/gpu/arm/mali400/r5p2_rel0/linux/mali_memory.c
drivers/gpu/arm/mali400/r5p2_rel0/linux/mali_sync.c

index 7fe484f..ab2a41e 100644 (file)
@@ -13,7 +13,7 @@
 # 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
@@ -142,6 +142,8 @@ obj-$(CONFIG_MALI400) := mali.o
 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)
@@ -154,16 +156,16 @@ ifeq ($(MALI_UPPER_HALF_SCHEDULING),1)
        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
@@ -174,7 +176,7 @@ CHANGED_REVISION := $(shell $(SVN_INFO) | grep '^Last Changed Rev: ' | cut -d: -
 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)
@@ -191,6 +193,7 @@ endif
 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 )
@@ -198,7 +201,7 @@ VERSION_STRINGS += REPO_URL=$(REPO_URL)
 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
index 94c0a31..cf7e51b 100644 (file)
@@ -7,15 +7,16 @@
 # 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
@@ -89,7 +90,7 @@ include $(KDIR)/.config
 
 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
@@ -101,10 +102,10 @@ endif
 
 # 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
index 3e195cd..10e519d 100644 (file)
@@ -118,8 +118,6 @@ static _mali_osk_wait_queue_t *executor_notify_core_change_wait_queue = NULL;
 /*
  * ---------- 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);
@@ -153,6 +151,9 @@ static void mali_executor_set_state_pp_physical(struct mali_group *group,
                _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 ----------
  */
@@ -509,7 +510,7 @@ void mali_executor_schedule_from_mask(mali_scheduler_mask mask, mali_bool deferr
 _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",
@@ -533,10 +534,12 @@ _mali_osk_errcode_t mali_executor_interrupt_gp(struct mali_group *group,
                            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;
+                       }
                }
        }
 
@@ -637,7 +640,7 @@ _mali_osk_errcode_t mali_executor_interrupt_gp(struct mali_group *group,
 _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",
@@ -649,6 +652,7 @@ _mali_osk_errcode_t mali_executor_interrupt_pp(struct mali_group *group,
        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;
        }
 
@@ -671,13 +675,14 @@ _mali_osk_errcode_t mali_executor_interrupt_pp(struct mali_group *group,
                            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 */
@@ -738,7 +743,7 @@ _mali_osk_errcode_t mali_executor_interrupt_pp(struct mali_group *group,
 _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),
@@ -754,10 +759,12 @@ _mali_osk_errcode_t mali_executor_interrupt_mmu(struct mali_group *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)
@@ -1341,13 +1348,13 @@ _mali_osk_errcode_t _mali_ukk_gp_suspend_response(_mali_uk_gp_suspend_response_s
  * ---------- 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);
index efcd7dc..de242c2 100644 (file)
@@ -248,9 +248,9 @@ MALI_STATIC_INLINE mali_bool mali_group_is_working(struct mali_group *group)
        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)
index 9fbac23..e58e57e 100644 (file)
@@ -41,12 +41,20 @@ enum mali_interrupt_result {
        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));
@@ -55,6 +63,13 @@ MALI_STATIC_INLINE u32 mali_hw_core_register_read(struct mali_hw_core *core, u32
 
 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);
@@ -65,6 +80,12 @@ MALI_STATIC_INLINE void mali_hw_core_register_write_relaxed(struct mali_hw_core
  * 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) {
@@ -74,6 +95,12 @@ MALI_STATIC_INLINE void mali_hw_core_register_write_relaxed_conditional(struct m
 
 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);
@@ -82,6 +109,12 @@ MALI_STATIC_INLINE void mali_hw_core_register_write(struct mali_hw_core *core, u
 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));
 
@@ -97,6 +130,12 @@ MALI_STATIC_INLINE void mali_hw_core_register_write_array_relaxed(struct mali_hw
 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));
 
index 3d48a9f..6709199 100644 (file)
@@ -748,12 +748,6 @@ _mali_osk_errcode_t mali_initialize_subsystems(void)
                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();
@@ -1131,7 +1125,9 @@ _mali_osk_errcode_t _mali_ukk_open(void **context)
 #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);
 
index bd6c7b6..dfc9737 100644 (file)
@@ -455,6 +455,7 @@ void mali_l2_cache_invalidate_all_pages(u32 *pages, u32 num_pages)
                                                         pages[j]);
                        if (_MALI_OSK_ERR_OK != ret) {
                                MALI_PRINT_ERROR(("Failed to invalidate cache (page)\n"));
+                               dump_stack();
                        }
                }
 
index e2b5b2a..eda189c 100644 (file)
@@ -49,10 +49,13 @@ _mali_osk_errcode_t mali_mem_validation_check(u32 phys_addr, u32 size)
        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;
                        }
index a4f4e58..8f64f04 100644 (file)
@@ -122,8 +122,10 @@ _mali_osk_errcode_t mali_mmu_pagedir_map(struct mali_page_directory *pagedir, u3
        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,
@@ -134,7 +136,7 @@ _mali_osk_errcode_t mali_mmu_pagedir_map(struct mali_page_directory *pagedir, u3
 
                        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;
@@ -420,7 +422,7 @@ static _mali_osk_errcode_t dump_mmu_page_table(struct mali_page_directory *paged
                        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],
index f667b65..a30baa9 100644 (file)
@@ -163,13 +163,6 @@ _mali_osk_errcode_t mali_pmu_power_down(struct mali_pmu_core *pmu, u32 mask)
                                            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;
 }
 
@@ -228,13 +221,6 @@ _mali_osk_errcode_t mali_pmu_power_up(struct mali_pmu_core *pmu, u32 mask)
        }
 #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;
 }
 
index 6cb4d45..dbe91e7 100644 (file)
@@ -702,7 +702,21 @@ _mali_osk_errcode_t _mali_ukk_gp_start_job(void *ctx,
        }
 
        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)) {
@@ -736,7 +750,21 @@ _mali_osk_errcode_t _mali_ukk_pp_start_job(void *ctx,
        }
 
        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;
 
@@ -793,7 +821,21 @@ _mali_osk_errcode_t _mali_ukk_pp_and_gp_start_job(void *ctx,
        }
 
        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;
index 31b12c2..02256cf 100644 (file)
@@ -54,6 +54,9 @@ struct mali_session_data {
        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);
index f38e857..72585f4 100644 (file)
@@ -50,6 +50,7 @@ extern "C" {
 #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)
index 7057a6f..4344b2f 100644 (file)
@@ -81,6 +81,7 @@ typedef enum {
        _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 */
 
index 45deb77..e1fe5f3 100644 (file)
@@ -24,7 +24,9 @@
 #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"
@@ -50,6 +52,8 @@ static int is_first_resume = 1;
 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 */
@@ -69,6 +73,30 @@ int mali_debug_level = 2;
 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");
@@ -159,6 +187,8 @@ static int mali_driver_runtime_resume(struct device *dev);
 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);
@@ -196,7 +226,7 @@ static const struct dev_pm_ops mali_dev_pm_ops = {
 #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"},
@@ -365,7 +395,7 @@ int mali_module_init(void)
        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
@@ -470,6 +500,18 @@ static int mali_probe(struct platform_device *pdev)
 
        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);
@@ -549,6 +591,10 @@ static void mali_miscdevice_unregister(void)
 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 |
@@ -575,6 +621,10 @@ static int mali_driver_resume_scheduler(struct device *dev)
                                      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;
 }
@@ -583,6 +633,8 @@ static int mali_driver_resume_scheduler(struct device *dev)
 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 |
@@ -613,6 +665,7 @@ static int mali_driver_runtime_resume(struct device *dev)
                                      mali_gpu_clk[1].vol / 1000,
                                      0, 0, 0);
 #endif
+       mali_platform_power_mode_change(0);
 
        mali_pm_runtime_resume();
        return 0;
@@ -620,7 +673,8 @@ static int mali_driver_runtime_resume(struct device *dev)
 
 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
@@ -740,7 +794,11 @@ static int mali_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
                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);
index c6cd2bf..96c4ab4 100644 (file)
@@ -86,6 +86,7 @@ TRACE_EVENT(mali_hw_counter,
 
            TP_fast_assign(
                    __entry->counter_id = counter_id;
+                   __entry->value = value;
            ),
 
            TP_printk("event %d = %d", __entry->counter_id, __entry->value)
index 39ee64f..c28d7cf 100644 (file)
@@ -163,6 +163,15 @@ int mali_mmap(struct file *filp, struct vm_area_struct *vma)
        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;
 
@@ -423,4 +432,3 @@ unsigned long _mali_page_node_get_pfn(struct mali_page_node *node)
        return 0;
 }
 
-
index eec2dc2..6feb902 100644 (file)
@@ -132,6 +132,11 @@ static void timeline_print_pt(struct seq_file *s, struct sync_pt *sync_pt)
        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