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

MIPS: Exclude more dsemul code when CONFIG_MIPS_FP_SUPPORT=n

This furthers what commit 42b10815d559 ("MIPS: Don't compile math-emu
when CONFIG_MIPS_FP_SUPPORT=n") has done

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

authored by

Yousong Zhou and committed by
Thomas Bogendoerfer
aebdc6ff d191aaff

+29 -19
+6 -6
arch/mips/include/asm/processor.h
··· 253 253 #ifdef CONFIG_MIPS_FP_SUPPORT 254 254 /* Saved fpu/fpu emulator stuff. */ 255 255 struct mips_fpu_struct fpu FPU_ALIGN; 256 - #endif 257 256 /* Assigned branch delay slot 'emulation' frame */ 258 257 atomic_t bd_emu_frame; 259 258 /* PC of the branch from a branch delay slot 'emulation' */ 260 259 unsigned long bd_emu_branch_pc; 261 260 /* PC to continue from following a branch delay slot 'emulation' */ 262 261 unsigned long bd_emu_cont_pc; 262 + #endif 263 263 #ifdef CONFIG_MIPS_MT_FPAFF 264 264 /* Emulated instruction count */ 265 265 unsigned long emulated_fp; ··· 302 302 .fpr = {{{0,},},}, \ 303 303 .fcr31 = 0, \ 304 304 .msacsr = 0, \ 305 - }, 305 + }, \ 306 + /* Delay slot emulation */ \ 307 + .bd_emu_frame = ATOMIC_INIT(BD_EMUFRAME_NONE), \ 308 + .bd_emu_branch_pc = 0, \ 309 + .bd_emu_cont_pc = 0, 306 310 #else 307 311 # define FPU_INIT 308 312 #endif ··· 338 334 * FPU affinity state (null if not FPAFF) \ 339 335 */ \ 340 336 FPAFF_INIT \ 341 - /* Delay slot emulation */ \ 342 - .bd_emu_frame = ATOMIC_INIT(BD_EMUFRAME_NONE), \ 343 - .bd_emu_branch_pc = 0, \ 344 - .bd_emu_cont_pc = 0, \ 345 337 /* \ 346 338 * Saved DSP stuff \ 347 339 */ \
+8 -2
arch/mips/kernel/process.c
··· 75 75 lose_fpu(0); 76 76 clear_thread_flag(TIF_MSA_CTX_LIVE); 77 77 clear_used_math(); 78 + #ifdef CONFIG_MIPS_FP_SUPPORT 78 79 atomic_set(&current->thread.bd_emu_frame, BD_EMUFRAME_NONE); 80 + #endif 79 81 init_dsp(); 80 82 regs->cp0_epc = pc; 81 83 regs->regs[29] = sp; ··· 178 176 clear_tsk_thread_flag(p, TIF_FPUBOUND); 179 177 #endif /* CONFIG_MIPS_MT_FPAFF */ 180 178 179 + #ifdef CONFIG_MIPS_FP_SUPPORT 181 180 atomic_set(&p->thread.bd_emu_frame, BD_EMUFRAME_NONE); 181 + #endif 182 182 183 183 if (clone_flags & CLONE_SETTLS) 184 184 ti->tp_value = tls; ··· 654 650 { 655 651 unsigned long top = TASK_SIZE & PAGE_MASK; 656 652 657 - /* One page for branch delay slot "emulation" */ 658 - top -= PAGE_SIZE; 653 + if (IS_ENABLED(CONFIG_MIPS_FP_SUPPORT)) { 654 + /* One page for branch delay slot "emulation" */ 655 + top -= PAGE_SIZE; 656 + } 659 657 660 658 /* Space for the VDSO, data page & GIC user page */ 661 659 top -= PAGE_ALIGN(current->thread.abi->vdso->size);
+15 -11
arch/mips/kernel/vdso.c
··· 71 71 72 72 static unsigned long vdso_base(void) 73 73 { 74 - unsigned long base; 74 + unsigned long base = STACK_TOP; 75 75 76 - /* Skip the delay slot emulation page */ 77 - base = STACK_TOP + PAGE_SIZE; 76 + if (IS_ENABLED(CONFIG_MIPS_FP_SUPPORT)) { 77 + /* Skip the delay slot emulation page */ 78 + base += PAGE_SIZE; 79 + } 78 80 79 81 if (current->flags & PF_RANDOMIZE) { 80 82 base += get_random_int() & (VDSO_RANDOMIZE_SIZE - 1); ··· 97 95 if (down_write_killable(&mm->mmap_sem)) 98 96 return -EINTR; 99 97 100 - /* Map delay slot emulation page */ 101 - base = mmap_region(NULL, STACK_TOP, PAGE_SIZE, 102 - VM_READ | VM_EXEC | 103 - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC, 104 - 0, NULL); 105 - if (IS_ERR_VALUE(base)) { 106 - ret = base; 107 - goto out; 98 + if (IS_ENABLED(CONFIG_MIPS_FP_SUPPORT)) { 99 + /* Map delay slot emulation page */ 100 + base = mmap_region(NULL, STACK_TOP, PAGE_SIZE, 101 + VM_READ | VM_EXEC | 102 + VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC, 103 + 0, NULL); 104 + if (IS_ERR_VALUE(base)) { 105 + ret = base; 106 + goto out; 107 + } 108 108 } 109 109 110 110 /*