Skip to content

Commit ca4d5c4

Browse files
Ley Foon TanDinh Nguyen
authored andcommitted
FogBugz #175951: nios2: Move the MMU initialization
The current MMU initialization consists only in the flush of all the TLB entries. This is done based in the cpuinfo values that specify the TLB geometry. Hence, the current calling of mmu_init() *before* the cpuinfo is setup is wrong and doesn't perform any TLB flushing. Fix it by moving the call to mmu_init() to be done *after* the cpuinfo has been correctly filled. This commit fixes soft-reboots, which are currently broken. Upon soft-reboot (from a system that has entered userspace) the TLB would be filled and were previously never flushed. Such systems booting from a soft-reboot would fail to enter userpace, panic'ing like this: Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Signed-off-by: Ley Foon Tan <lftan@altera.com>
1 parent f817037 commit ca4d5c4

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

arch/nios2/kernel/setup.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,6 @@ asmlinkage void __init nios2_boot_init(unsigned r4, unsigned r5, unsigned r6,
112112
unsigned dtb_passed = 0;
113113
char cmdline_passed[COMMAND_LINE_SIZE] = { 0, };
114114

115-
#ifdef CONFIG_MMU
116-
mmu_init();
117-
#endif
118-
119115
#if defined(CONFIG_PASS_CMDLINE)
120116
if (r4 == 0x534f494e) { /* r4 is magic NIOS */
121117
#if defined(CONFIG_BLK_DEV_INITRD)
@@ -213,6 +209,8 @@ void __init setup_arch(char **cmdline_p)
213209
copy_exception_handler(cpuinfo.exception_addr);
214210

215211
#ifdef CONFIG_MMU
212+
mmu_init();
213+
216214
copy_fast_tlb_miss_handler(cpuinfo.fast_tlb_miss_exc_addr);
217215

218216
/*

0 commit comments

Comments
 (0)