static void mali_mmu_activate_address_space(struct mali_mmu_core *mmu, u32 page_directory) { mali_mmu_enable_stall(mmu); /* this might fail, but changing the DTE address and ZAP should work anyway... */ mali_hw_core_register_write(&mmu->hw_core, MALI_MMU_REGISTER_DTE_ADDR, page_directory); mali_hw_core_register_write(&mmu->hw_core, MALI_MMU_REGISTER_COMMAND, MALI_MMU_COMMAND_ZAP_CACHE); mali_mmu_disable_stall(mmu); }
_mali_osk_errcode_t mali_mmu_reset(struct mali_mmu_core *mmu) { _mali_osk_errcode_t err = _MALI_OSK_ERR_FAULT; mali_bool stall_success; MALI_DEBUG_ASSERT_POINTER(mmu); /* The _if_ is neccessary when called from mali_mmu_create and NULL==group */ if (mmu->group) { MALI_ASSERT_GROUP_LOCKED(mmu->group); } stall_success = mali_mmu_enable_stall(mmu); /* The stall can not fail in current hw-state */ MALI_DEBUG_ASSERT(stall_success); MALI_DEBUG_PRINT(3, ("Mali MMU: mali_kernel_mmu_reset: %s\n", mmu->hw_core.description)); if (_MALI_OSK_ERR_OK == mali_mmu_raw_reset(mmu)) { mali_hw_core_register_write(&mmu->hw_core, MALI_MMU_REGISTER_INT_MASK, MALI_MMU_INTERRUPT_PAGE_FAULT | MALI_MMU_INTERRUPT_READ_BUS_ERROR); /* no session is active, so just activate the empty page directory */ mali_hw_core_register_write(&mmu->hw_core, MALI_MMU_REGISTER_DTE_ADDR, mali_empty_page_directory); mali_mmu_enable_paging(mmu); err = _MALI_OSK_ERR_OK; } mali_mmu_disable_stall(mmu); return err; }
_mali_osk_errcode_t mali_mmu_reset(struct mali_mmu_core *mmu) { _mali_osk_errcode_t err = _MALI_OSK_ERR_FAULT; mali_bool stall_success; MALI_DEBUG_ASSERT_POINTER(mmu); stall_success = mali_mmu_enable_stall(mmu); if (!stall_success) { err = _MALI_OSK_ERR_BUSY; } MALI_DEBUG_PRINT(3, ("Mali MMU: mali_kernel_mmu_reset: %s\n", mmu->hw_core.description)); if (_MALI_OSK_ERR_OK == mali_mmu_raw_reset(mmu)) { mali_hw_core_register_write(&mmu->hw_core, MALI_MMU_REGISTER_INT_MASK, MALI_MMU_INTERRUPT_PAGE_FAULT | MALI_MMU_INTERRUPT_READ_BUS_ERROR); /* no session is active, so just activate the empty page directory */ mali_hw_core_register_write(&mmu->hw_core, MALI_MMU_REGISTER_DTE_ADDR, mali_empty_page_directory); mali_mmu_enable_paging(mmu); err = _MALI_OSK_ERR_OK; } mali_mmu_disable_stall(mmu); return err; }
void mali_mmu_activate_fault_flush_page_directory(struct mali_mmu_core *mmu) { mali_bool stall_success; MALI_DEBUG_ASSERT_POINTER(mmu); MALI_DEBUG_PRINT(3, ("Activating the page fault flush page directory on MMU %s\n", mmu->hw_core.description)); stall_success = mali_mmu_enable_stall(mmu); /* This function is expect to fail the stalling, since it might be in PageFault mode when it is called */ mali_mmu_activate_address_space(mmu, mali_page_fault_flush_page_directory); if (MALI_TRUE == stall_success) mali_mmu_disable_stall(mmu); }
void mali_mmu_activate_empty_page_directory(struct mali_mmu_core* mmu) { mali_bool stall_success; MALI_DEBUG_ASSERT_POINTER(mmu); MALI_ASSERT_GROUP_LOCKED(mmu->group); MALI_DEBUG_PRINT(3, ("Activating the empty page directory on MMU %s\n", mmu->hw_core.description)); stall_success = mali_mmu_enable_stall(mmu); /* This function can only be called when the core is idle, so it could not fail. */ MALI_DEBUG_ASSERT( stall_success ); mali_mmu_activate_address_space(mmu, mali_empty_page_directory); mali_mmu_disable_stall(mmu); }
void mali_mmu_activate_page_directory(struct mali_mmu_core *mmu, struct mali_page_directory *pagedir) { mali_bool stall_success; MALI_DEBUG_ASSERT_POINTER(mmu); MALI_DEBUG_PRINT(5, ("Asked to activate page directory 0x%x on MMU %s\n", pagedir, mmu->hw_core.description)); stall_success = mali_mmu_enable_stall(mmu); MALI_DEBUG_ASSERT(stall_success); MALI_IGNORE(stall_success); mali_mmu_activate_address_space(mmu, pagedir->page_directory); mali_mmu_disable_stall(mmu); }
mali_bool mali_mmu_activate_page_directory(struct mali_mmu_core *mmu, struct mali_page_directory *pagedir) { mali_bool stall_success; MALI_DEBUG_ASSERT_POINTER(mmu); MALI_ASSERT_GROUP_LOCKED(mmu->group); MALI_DEBUG_PRINT(5, ("Asked to activate page directory 0x%x on MMU %s\n", pagedir, mmu->hw_core.description)); stall_success = mali_mmu_enable_stall(mmu); if ( MALI_FALSE==stall_success ) return MALI_FALSE; mali_mmu_activate_address_space(mmu, pagedir->page_directory); mali_mmu_disable_stall(mmu); return MALI_TRUE; }
mali_bool mali_mmu_zap_tlb(struct mali_mmu_core *mmu) { mali_bool stall_success = mali_mmu_enable_stall(mmu); mali_hw_core_register_write(&mmu->hw_core, MALI_MMU_REGISTER_COMMAND, MALI_MMU_COMMAND_ZAP_CACHE); if (MALI_FALSE == stall_success) { /* False means that it is in Pagefault state. Not possible to disable_stall then */ return MALI_FALSE; } mali_mmu_disable_stall(mmu); return MALI_TRUE; }
void mali_mmu_zap_tlb(struct mali_mmu_core *mmu) { mali_mmu_enable_stall(mmu); /* this might fail */ mali_hw_core_register_write(&mmu->hw_core, MALI_MMU_REGISTER_COMMAND, MALI_MMU_COMMAND_ZAP_CACHE); mali_mmu_disable_stall(mmu); }