Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: tlbex: Remove cpu_has_local_ebase

The cpu_has_local_ebase macro is, confusingly, not used to indicate
whether the EBase register is local to a CPU or not. Instead it
indicates whether we want to generate the TLB refill exception vector
each time a CPU is brought online. Doing this makes little sense on any
system, since we always use the same value for EBase & thus we cannot
have different TLB refill exception handlers per CPU.

Regenerating the code is not only pointless but also can be actively
harmful, as commit 8759934e2b6b ("MIPS: Build uasm-generated code only
once to avoid CPU Hotplug problem") described. That commit introduced
cpu_has_local_ebase to disable the handler regeneration for Loongson
machines, but this is by no means a Loongson-specific problem.

Remove cpu_has_local_ebase & simply generate the TLB refill handler once
during boot, just like the rest of the TLB exception handlers.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Cc: linux-mips@vger.kernel.org

+2 -12
-3
arch/mips/include/asm/cpu-features.h
··· 243 243 #ifndef cpu_has_pindexed_dcache 244 244 #define cpu_has_pindexed_dcache (cpu_data[0].dcache.flags & MIPS_CACHE_PINDEX) 245 245 #endif 246 - #ifndef cpu_has_local_ebase 247 - #define cpu_has_local_ebase 1 248 - #endif 249 246 250 247 /* 251 248 * I-Cache snoops remote store. This only matters on SMP. Some multiprocessors
-1
arch/mips/include/asm/mach-dec/cpu-feature-overrides.h
··· 32 32 #define cpu_has_vtag_icache 0 33 33 #define cpu_has_ic_fills_f_dc 0 34 34 #define cpu_has_pindexed_dcache 0 35 - #define cpu_has_local_ebase 0 36 35 #define cpu_icache_snoops_remote_store 1 37 36 #define cpu_has_mips_4 0 38 37 #define cpu_has_mips_5 0
-1
arch/mips/include/asm/mach-loongson64/cpu-feature-overrides.h
··· 43 43 #define cpu_has_vint 0 44 44 #define cpu_has_vtag_icache 0 45 45 #define cpu_has_watch 1 46 - #define cpu_has_local_ebase 0 47 46 48 47 #ifdef CONFIG_CPU_LOONGSON3 49 48 #define cpu_has_wsbh 1
+2 -7
arch/mips/mm/tlbex.c
··· 2609 2609 2610 2610 if (cpu_has_3kex) { 2611 2611 #ifndef CONFIG_MIPS_PGD_C0_CONTEXT 2612 - if (cpu_has_local_ebase) 2613 - build_r3000_tlb_refill_handler(); 2614 2612 if (!run_once) { 2615 - if (!cpu_has_local_ebase) 2616 - build_r3000_tlb_refill_handler(); 2617 2613 build_setup_pgd(); 2614 + build_r3000_tlb_refill_handler(); 2618 2615 build_r3000_tlb_load_handler(); 2619 2616 build_r3000_tlb_store_handler(); 2620 2617 build_r3000_tlb_modify_handler(); ··· 2635 2638 build_r4000_tlb_modify_handler(); 2636 2639 if (cpu_has_ldpte) 2637 2640 build_loongson3_tlb_refill_handler(); 2638 - else if (!cpu_has_local_ebase) 2641 + else 2639 2642 build_r4000_tlb_refill_handler(); 2640 2643 flush_tlb_handlers(); 2641 2644 run_once++; 2642 2645 } 2643 - if (cpu_has_local_ebase) 2644 - build_r4000_tlb_refill_handler(); 2645 2646 if (cpu_has_xpa) 2646 2647 config_xpa_params(); 2647 2648 if (cpu_has_htw)