xtensa: extract init_kio
KIO region placement may be specified in the device tree, that's why it's initialized with the rest of MMU after the early_init_devtree. In order to support KASAN the MMU must be initialized earlier. Separate KIO initialization from the rest of MMU initialization. Reinitialize KIO if its location is specified in the device tree. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
This commit is contained in:
parent
501c26e82d
commit
c2edb35ae3
|
@ -52,6 +52,7 @@ DECLARE_PER_CPU(unsigned long, asid_cache);
|
|||
#define ASID_INSERT(x) (0x03020001 | (((x) & ASID_MASK) << 8))
|
||||
|
||||
void init_mmu(void);
|
||||
void init_kio(void);
|
||||
|
||||
static inline void set_rasid_register (unsigned long val)
|
||||
{
|
||||
|
|
|
@ -3,6 +3,10 @@ static inline void init_mmu(void)
|
|||
{
|
||||
}
|
||||
|
||||
static inline void init_kio(void)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -207,6 +207,8 @@ static int __init xtensa_dt_io_area(unsigned long node, const char *uname,
|
|||
/* round down to nearest 256MB boundary */
|
||||
xtensa_kio_paddr &= 0xf0000000;
|
||||
|
||||
init_kio();
|
||||
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
|
@ -245,6 +247,10 @@ void __init early_init_devtree(void *params)
|
|||
|
||||
void __init init_arch(bp_tag_t *bp_start)
|
||||
{
|
||||
/* Initialize MMU. */
|
||||
|
||||
init_mmu();
|
||||
|
||||
/* Parse boot parameters */
|
||||
|
||||
if (bp_start)
|
||||
|
@ -262,10 +268,6 @@ void __init init_arch(bp_tag_t *bp_start)
|
|||
/* Early hook for platforms */
|
||||
|
||||
platform_init(bp_start);
|
||||
|
||||
/* Initialize MMU. */
|
||||
|
||||
init_mmu();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -82,6 +82,23 @@ void init_mmu(void)
|
|||
set_itlbcfg_register(0);
|
||||
set_dtlbcfg_register(0);
|
||||
#endif
|
||||
init_kio();
|
||||
local_flush_tlb_all();
|
||||
|
||||
/* Set rasid register to a known value. */
|
||||
|
||||
set_rasid_register(ASID_INSERT(ASID_USER_FIRST));
|
||||
|
||||
/* Set PTEVADDR special register to the start of the page
|
||||
* table, which is in kernel mappable space (ie. not
|
||||
* statically mapped). This register's value is undefined on
|
||||
* reset.
|
||||
*/
|
||||
set_ptevaddr_register(XCHAL_PAGE_TABLE_VADDR);
|
||||
}
|
||||
|
||||
void init_kio(void)
|
||||
{
|
||||
#if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY && defined(CONFIG_OF)
|
||||
/*
|
||||
* Update the IO area mapping in case xtensa_kio_paddr has changed
|
||||
|
@ -95,17 +112,4 @@ void init_mmu(void)
|
|||
write_itlb_entry(__pte(xtensa_kio_paddr + CA_BYPASS),
|
||||
XCHAL_KIO_BYPASS_VADDR + 6);
|
||||
#endif
|
||||
|
||||
local_flush_tlb_all();
|
||||
|
||||
/* Set rasid register to a known value. */
|
||||
|
||||
set_rasid_register(ASID_INSERT(ASID_USER_FIRST));
|
||||
|
||||
/* Set PTEVADDR special register to the start of the page
|
||||
* table, which is in kernel mappable space (ie. not
|
||||
* statically mapped). This register's value is undefined on
|
||||
* reset.
|
||||
*/
|
||||
set_ptevaddr_register(PGTABLE_START);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue