xtensa: mmu: MMU re-initialization API
With power managment is enabled, depending on the SoC power state used when idle, the MMU may lose context and may need to be re-initialized. When re-initializing the MMU, we must not re-create the page table because it may overwrite changes done during the execution, but we still need to set the asid and page table for the current context. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
parent
fe1e7f8d37
commit
f74a84b251
2 changed files with 28 additions and 0 deletions
|
@ -320,6 +320,24 @@ void xtensa_mmu_init(void)
|
||||||
arch_xtensa_mmu_post_init(_current_cpu->id == 0);
|
arch_xtensa_mmu_post_init(_current_cpu->id == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void xtensa_mmu_reinit(void)
|
||||||
|
{
|
||||||
|
/* First initialize the hardware */
|
||||||
|
xtensa_init_paging(xtensa_kernel_ptables);
|
||||||
|
|
||||||
|
#ifdef CONFIG_USERSPACE
|
||||||
|
struct k_thread *thread = _current_cpu->current;
|
||||||
|
struct arch_mem_domain *domain =
|
||||||
|
&(thread->mem_domain_info.mem_domain->arch);
|
||||||
|
|
||||||
|
|
||||||
|
/* Set the page table for current context */
|
||||||
|
xtensa_set_paging(domain->asid, domain->ptables);
|
||||||
|
#endif /* CONFIG_USERSPACE */
|
||||||
|
|
||||||
|
arch_xtensa_mmu_post_init(_current_cpu->id == 0);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_HAS_RESERVED_PAGE_FRAMES
|
#ifdef CONFIG_ARCH_HAS_RESERVED_PAGE_FRAMES
|
||||||
/* Zephyr's linker scripts for Xtensa usually puts
|
/* Zephyr's linker scripts for Xtensa usually puts
|
||||||
* something before z_mapped_start (aka .text),
|
* something before z_mapped_start (aka .text),
|
||||||
|
|
|
@ -123,6 +123,16 @@ extern int xtensa_soc_mmu_ranges_num;
|
||||||
*/
|
*/
|
||||||
void xtensa_mmu_init(void);
|
void xtensa_mmu_init(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Re-initialize hardware MMU.
|
||||||
|
*
|
||||||
|
* This configures the MMU hardware when the cpu lost context and has
|
||||||
|
* re-started.
|
||||||
|
*
|
||||||
|
* It assumes that the page table is already created and accessible in memory.
|
||||||
|
*/
|
||||||
|
void xtensa_mmu_reinit(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Tell other processors to flush TLBs.
|
* @brief Tell other processors to flush TLBs.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue