mm: tlb: Improve the context saving function
Attempt to invalidate cache for an unmapped address results in cpu exception for the ptl platform. Perform cache invalidation after translation activation in tlb. Add address mapping in mmu for platforms that have it. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
This commit is contained in:
parent
750212c2a9
commit
e4a9503706
1 changed files with 13 additions and 6 deletions
|
|
@ -836,18 +836,25 @@ static void adsp_mm_save_context(void *storage_buffer)
|
|||
|
||||
if (((tlb_entries[entry_idx] & TLB_PADDR_MASK) != entry) ||
|
||||
((tlb_entries[entry_idx] & TLB_ENABLE_BIT) != TLB_ENABLE_BIT)) {
|
||||
/* this page needs remapping, invalidate cache to avoid stalled data
|
||||
* all cache data has been flushed before
|
||||
* do this for pages to remap only
|
||||
*/
|
||||
sys_cache_data_invd_range(UINT_TO_POINTER(phys_addr),
|
||||
CONFIG_MM_DRV_PAGE_SIZE);
|
||||
/* This page needs remapping */
|
||||
|
||||
/* Enable the translation in the TLB entry */
|
||||
entry |= TLB_ENABLE_BIT;
|
||||
|
||||
/* map the page 1:1 virtual to physical */
|
||||
tlb_entries[entry_idx] = entry;
|
||||
|
||||
#ifdef CONFIG_MMU
|
||||
arch_mem_map(UINT_TO_POINTER(phys_addr), phys_addr, CONFIG_MM_DRV_PAGE_SIZE,
|
||||
K_MEM_CACHE_WB);
|
||||
#endif
|
||||
|
||||
/* Invalidate cache to avoid stalled data
|
||||
* all cache data has been flushed before
|
||||
* do this for pages to remap only
|
||||
*/
|
||||
sys_cache_data_invd_range(UINT_TO_POINTER(phys_addr),
|
||||
CONFIG_MM_DRV_PAGE_SIZE);
|
||||
}
|
||||
|
||||
/* save physical address */
|
||||
|
|
|
|||
Loading…
Reference in a new issue