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

Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus

Pull MIPS fixes from Ralf Baechle:
"A set of MIPS fixes for 4.9:

- lots of fixes for printk continuations
- six fixes for FP related code.
- fix max_low_pfn with disabled highmem
- fix KASLR handling of NULL FDT and KASLR for generic kernels
- fix build of compressed image
- provide default mips_cpc_default_phys_base to ignore CPC
- fix reboot on Malta"

* 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus:
MIPS: Fix max_low_pfn with disabled highmem
MIPS: Correct MIPS I FP sigcontext layout
MIPS: Fix ISA I/II FP signal context offsets
MIPS: Remove FIR from ISA I FP signal context
MIPS: Fix ISA I FP sigcontext access violation handling
MIPS: Fix FCSR Cause bit handling for correct SIGFPE issue
MIPS: ptrace: Also initialize the FP context on individual FCSR writes
MIPS: dump_tlb: Fix printk continuations
MIPS: Fix __show_regs() output
MIPS: traps: Fix output of show_code
MIPS: traps: Fix output of show_stacktrace
MIPS: traps: Fix output of show_backtrace
MIPS: Fix build of compressed image
MIPS: generic: Fix KASLR for generic kernel.
MIPS: KASLR: Fix handling of NULL FDT
MIPS: Malta: Fixup reboot
MIPS: CPC: Provide default mips_cpc_default_phys_base to ignore CPC

+287 -235
+1 -1
arch/mips/Makefile
··· 263 263 264 264 bootvars-y = VMLINUX_LOAD_ADDRESS=$(load-y) \ 265 265 VMLINUX_ENTRY_ADDRESS=$(entry-y) \ 266 - PLATFORM=$(platform-y) 266 + PLATFORM="$(platform-y)" 267 267 ifdef CONFIG_32BIT 268 268 bootvars-y += ADDR_BITS=32 269 269 endif
+2 -1
arch/mips/boot/dts/mti/malta.dts
··· 84 84 fpga_regs: system-controller@1f000000 { 85 85 compatible = "mti,malta-fpga", "syscon", "simple-mfd"; 86 86 reg = <0x1f000000 0x1000>; 87 + native-endian; 87 88 88 89 reboot { 89 90 compatible = "syscon-reboot"; 90 91 regmap = <&fpga_regs>; 91 92 offset = <0x500>; 92 - mask = <0x4d>; 93 + mask = <0x42>; 93 94 }; 94 95 }; 95 96
+10 -6
arch/mips/generic/init.c
··· 30 30 31 31 void __init prom_init(void) 32 32 { 33 + plat_get_fdt(); 34 + BUG_ON(!fdt); 35 + } 36 + 37 + void __init *plat_get_fdt(void) 38 + { 33 39 const struct mips_machine *check_mach; 34 40 const struct of_device_id *match; 41 + 42 + if (fdt) 43 + /* Already set up */ 44 + return (void *)fdt; 35 45 36 46 if ((fw_arg0 == -2) && !fdt_check_header((void *)fw_arg1)) { 37 47 /* ··· 85 75 /* Retrieve the machine's FDT */ 86 76 fdt = mach->fdt; 87 77 } 88 - 89 - BUG_ON(!fdt); 90 - } 91 - 92 - void __init *plat_get_fdt(void) 93 - { 94 78 return (void *)fdt; 95 79 } 96 80
+13
arch/mips/include/asm/fpu_emulator.h
··· 63 63 extern int fpu_emulator_cop1Handler(struct pt_regs *xcp, 64 64 struct mips_fpu_struct *ctx, int has_fpu, 65 65 void *__user *fault_addr); 66 + void force_fcr31_sig(unsigned long fcr31, void __user *fault_addr, 67 + struct task_struct *tsk); 66 68 int process_fpemu_return(int sig, void __user *fault_addr, 67 69 unsigned long fcr31); 68 70 int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn, ··· 81 79 82 80 for (i = 0; i < 32; i++) 83 81 set_fpr64(&t->thread.fpu.fpr[i], 0, SIGNALLING_NAN); 82 + } 83 + 84 + /* 85 + * Mask the FCSR Cause bits according to the Enable bits, observing 86 + * that Unimplemented is always enabled. 87 + */ 88 + static inline unsigned long mask_fcr31_x(unsigned long fcr31) 89 + { 90 + return fcr31 & (FPU_CSR_UNI_X | 91 + ((fcr31 & FPU_CSR_ALL_E) << 92 + (ffs(FPU_CSR_ALL_X) - ffs(FPU_CSR_ALL_E)))); 84 93 } 85 94 86 95 #endif /* _ASM_FPU_EMULATOR_H */
+18
arch/mips/include/asm/switch_to.h
··· 76 76 } while (0) 77 77 78 78 /* 79 + * Check FCSR for any unmasked exceptions pending set with `ptrace', 80 + * clear them and send a signal. 81 + */ 82 + #define __sanitize_fcr31(next) \ 83 + do { \ 84 + unsigned long fcr31 = mask_fcr31_x(next->thread.fpu.fcr31); \ 85 + void __user *pc; \ 86 + \ 87 + if (unlikely(fcr31)) { \ 88 + pc = (void __user *)task_pt_regs(next)->cp0_epc; \ 89 + next->thread.fpu.fcr31 &= ~fcr31; \ 90 + force_fcr31_sig(fcr31, pc, next); \ 91 + } \ 92 + } while (0) 93 + 94 + /* 79 95 * For newly created kernel threads switch_to() will return to 80 96 * ret_from_kernel_thread, newly created user threads to ret_from_fork. 81 97 * That is, everything following resume() will be skipped for new threads. ··· 101 85 do { \ 102 86 __mips_mt_fpaff_switch_to(prev); \ 103 87 lose_fpu_inatomic(1, prev); \ 88 + if (tsk_used_math(next)) \ 89 + __sanitize_fcr31(next); \ 104 90 if (cpu_has_dsp) { \ 105 91 __save_dsp(prev); \ 106 92 __restore_dsp(next); \
+10 -1
arch/mips/kernel/mips-cpc.c
··· 21 21 22 22 static DEFINE_PER_CPU_ALIGNED(unsigned long, cpc_core_lock_flags); 23 23 24 + phys_addr_t __weak mips_cpc_default_phys_base(void) 25 + { 26 + return 0; 27 + } 28 + 24 29 /** 25 30 * mips_cpc_phys_base - retrieve the physical base address of the CPC 26 31 * ··· 48 43 if (cpc_base & CM_GCR_CPC_BASE_CPCEN_MSK) 49 44 return cpc_base & CM_GCR_CPC_BASE_CPCBASE_MSK; 50 45 51 - /* Otherwise, give it the default address & enable it */ 46 + /* Otherwise, use the default address */ 52 47 cpc_base = mips_cpc_default_phys_base(); 48 + if (!cpc_base) 49 + return cpc_base; 50 + 51 + /* Enable the CPC, mapped at the default address */ 53 52 write_gcr_cpc_base(cpc_base | CM_GCR_CPC_BASE_CPCEN_MSK); 54 53 return cpc_base; 55 54 }
+5 -5
arch/mips/kernel/mips-r2-to-r6-emul.c
··· 899 899 * mipsr2_decoder: Decode and emulate a MIPS R2 instruction 900 900 * @regs: Process register set 901 901 * @inst: Instruction to decode and emulate 902 - * @fcr31: Floating Point Control and Status Register returned 902 + * @fcr31: Floating Point Control and Status Register Cause bits returned 903 903 */ 904 904 int mipsr2_decoder(struct pt_regs *regs, u32 inst, unsigned long *fcr31) 905 905 { ··· 1172 1172 1173 1173 err = fpu_emulator_cop1Handler(regs, &current->thread.fpu, 0, 1174 1174 &fault_addr); 1175 - *fcr31 = current->thread.fpu.fcr31; 1176 1175 1177 1176 /* 1178 - * We can't allow the emulated instruction to leave any of 1179 - * the cause bits set in $fcr31. 1177 + * We can't allow the emulated instruction to leave any 1178 + * enabled Cause bits set in $fcr31. 1180 1179 */ 1181 - current->thread.fpu.fcr31 &= ~FPU_CSR_ALL_X; 1180 + *fcr31 = res = mask_fcr31_x(current->thread.fpu.fcr31); 1181 + current->thread.fpu.fcr31 &= ~res; 1182 1182 1183 1183 /* 1184 1184 * this is a tricky issue - lose_fpu() uses LL/SC atomics
+4 -4
arch/mips/kernel/ptrace.c
··· 79 79 } 80 80 81 81 /* 82 - * Poke at FCSR according to its mask. Don't set the cause bits as 83 - * this is currently not handled correctly in FP context restoration 84 - * and will cause an oops if a corresponding enable bit is set. 82 + * Poke at FCSR according to its mask. Set the Cause bits even 83 + * if a corresponding Enable bit is set. This will be noticed at 84 + * the time the thread is switched to and SIGFPE thrown accordingly. 85 85 */ 86 86 static void ptrace_setfcr31(struct task_struct *child, u32 value) 87 87 { 88 88 u32 fcr31; 89 89 u32 mask; 90 90 91 - value &= ~FPU_CSR_ALL_X; 92 91 fcr31 = child->thread.fpu.fcr31; 93 92 mask = boot_cpu_data.fpu_msk31; 94 93 child->thread.fpu.fcr31 = (value & ~mask) | (fcr31 & mask); ··· 816 817 break; 817 818 #endif 818 819 case FPC_CSR: 820 + init_fp_ctx(child); 819 821 ptrace_setfcr31(child, data); 820 822 break; 821 823 case DSP_BASE ... DSP_BASE + 5: {
+58 -80
arch/mips/kernel/r2300_fpu.S
··· 21 21 #define EX(a,b) \ 22 22 9: a,##b; \ 23 23 .section __ex_table,"a"; \ 24 + PTR 9b,fault; \ 25 + .previous 26 + 27 + #define EX2(a,b) \ 28 + 9: a,##b; \ 29 + .section __ex_table,"a"; \ 24 30 PTR 9b,bad_stack; \ 31 + PTR 9b+4,bad_stack; \ 25 32 .previous 26 33 27 34 .set noreorder 28 35 .set mips1 29 - /* Save floating point context */ 36 + 37 + /** 38 + * _save_fp_context() - save FP context from the FPU 39 + * @a0 - pointer to fpregs field of sigcontext 40 + * @a1 - pointer to fpc_csr field of sigcontext 41 + * 42 + * Save FP context, including the 32 FP data registers and the FP 43 + * control & status register, from the FPU to signal context. 44 + */ 30 45 LEAF(_save_fp_context) 31 46 .set push 32 47 SET_HARDFLOAT 33 48 li v0, 0 # assume success 34 - cfc1 t1,fcr31 35 - EX(swc1 $f0,(SC_FPREGS+0)(a0)) 36 - EX(swc1 $f1,(SC_FPREGS+8)(a0)) 37 - EX(swc1 $f2,(SC_FPREGS+16)(a0)) 38 - EX(swc1 $f3,(SC_FPREGS+24)(a0)) 39 - EX(swc1 $f4,(SC_FPREGS+32)(a0)) 40 - EX(swc1 $f5,(SC_FPREGS+40)(a0)) 41 - EX(swc1 $f6,(SC_FPREGS+48)(a0)) 42 - EX(swc1 $f7,(SC_FPREGS+56)(a0)) 43 - EX(swc1 $f8,(SC_FPREGS+64)(a0)) 44 - EX(swc1 $f9,(SC_FPREGS+72)(a0)) 45 - EX(swc1 $f10,(SC_FPREGS+80)(a0)) 46 - EX(swc1 $f11,(SC_FPREGS+88)(a0)) 47 - EX(swc1 $f12,(SC_FPREGS+96)(a0)) 48 - EX(swc1 $f13,(SC_FPREGS+104)(a0)) 49 - EX(swc1 $f14,(SC_FPREGS+112)(a0)) 50 - EX(swc1 $f15,(SC_FPREGS+120)(a0)) 51 - EX(swc1 $f16,(SC_FPREGS+128)(a0)) 52 - EX(swc1 $f17,(SC_FPREGS+136)(a0)) 53 - EX(swc1 $f18,(SC_FPREGS+144)(a0)) 54 - EX(swc1 $f19,(SC_FPREGS+152)(a0)) 55 - EX(swc1 $f20,(SC_FPREGS+160)(a0)) 56 - EX(swc1 $f21,(SC_FPREGS+168)(a0)) 57 - EX(swc1 $f22,(SC_FPREGS+176)(a0)) 58 - EX(swc1 $f23,(SC_FPREGS+184)(a0)) 59 - EX(swc1 $f24,(SC_FPREGS+192)(a0)) 60 - EX(swc1 $f25,(SC_FPREGS+200)(a0)) 61 - EX(swc1 $f26,(SC_FPREGS+208)(a0)) 62 - EX(swc1 $f27,(SC_FPREGS+216)(a0)) 63 - EX(swc1 $f28,(SC_FPREGS+224)(a0)) 64 - EX(swc1 $f29,(SC_FPREGS+232)(a0)) 65 - EX(swc1 $f30,(SC_FPREGS+240)(a0)) 66 - EX(swc1 $f31,(SC_FPREGS+248)(a0)) 67 - EX(sw t1,(SC_FPC_CSR)(a0)) 68 - cfc1 t0,$0 # implementation/version 49 + cfc1 t1, fcr31 50 + EX2(s.d $f0, 0(a0)) 51 + EX2(s.d $f2, 16(a0)) 52 + EX2(s.d $f4, 32(a0)) 53 + EX2(s.d $f6, 48(a0)) 54 + EX2(s.d $f8, 64(a0)) 55 + EX2(s.d $f10, 80(a0)) 56 + EX2(s.d $f12, 96(a0)) 57 + EX2(s.d $f14, 112(a0)) 58 + EX2(s.d $f16, 128(a0)) 59 + EX2(s.d $f18, 144(a0)) 60 + EX2(s.d $f20, 160(a0)) 61 + EX2(s.d $f22, 176(a0)) 62 + EX2(s.d $f24, 192(a0)) 63 + EX2(s.d $f26, 208(a0)) 64 + EX2(s.d $f28, 224(a0)) 65 + EX2(s.d $f30, 240(a0)) 69 66 jr ra 67 + EX(sw t1, (a1)) 70 68 .set pop 71 - .set nomacro 72 - EX(sw t0,(SC_FPC_EIR)(a0)) 73 - .set macro 74 69 END(_save_fp_context) 75 70 76 - /* 77 - * Restore FPU state: 78 - * - fp gp registers 79 - * - cp1 status/control register 71 + /** 72 + * _restore_fp_context() - restore FP context to the FPU 73 + * @a0 - pointer to fpregs field of sigcontext 74 + * @a1 - pointer to fpc_csr field of sigcontext 80 75 * 81 - * We base the decision which registers to restore from the signal stack 82 - * frame on the current content of c0_status, not on the content of the 83 - * stack frame which might have been changed by the user. 76 + * Restore FP context, including the 32 FP data registers and the FP 77 + * control & status register, from signal context to the FPU. 84 78 */ 85 79 LEAF(_restore_fp_context) 86 80 .set push 87 81 SET_HARDFLOAT 88 82 li v0, 0 # assume success 89 - EX(lw t0,(SC_FPC_CSR)(a0)) 90 - EX(lwc1 $f0,(SC_FPREGS+0)(a0)) 91 - EX(lwc1 $f1,(SC_FPREGS+8)(a0)) 92 - EX(lwc1 $f2,(SC_FPREGS+16)(a0)) 93 - EX(lwc1 $f3,(SC_FPREGS+24)(a0)) 94 - EX(lwc1 $f4,(SC_FPREGS+32)(a0)) 95 - EX(lwc1 $f5,(SC_FPREGS+40)(a0)) 96 - EX(lwc1 $f6,(SC_FPREGS+48)(a0)) 97 - EX(lwc1 $f7,(SC_FPREGS+56)(a0)) 98 - EX(lwc1 $f8,(SC_FPREGS+64)(a0)) 99 - EX(lwc1 $f9,(SC_FPREGS+72)(a0)) 100 - EX(lwc1 $f10,(SC_FPREGS+80)(a0)) 101 - EX(lwc1 $f11,(SC_FPREGS+88)(a0)) 102 - EX(lwc1 $f12,(SC_FPREGS+96)(a0)) 103 - EX(lwc1 $f13,(SC_FPREGS+104)(a0)) 104 - EX(lwc1 $f14,(SC_FPREGS+112)(a0)) 105 - EX(lwc1 $f15,(SC_FPREGS+120)(a0)) 106 - EX(lwc1 $f16,(SC_FPREGS+128)(a0)) 107 - EX(lwc1 $f17,(SC_FPREGS+136)(a0)) 108 - EX(lwc1 $f18,(SC_FPREGS+144)(a0)) 109 - EX(lwc1 $f19,(SC_FPREGS+152)(a0)) 110 - EX(lwc1 $f20,(SC_FPREGS+160)(a0)) 111 - EX(lwc1 $f21,(SC_FPREGS+168)(a0)) 112 - EX(lwc1 $f22,(SC_FPREGS+176)(a0)) 113 - EX(lwc1 $f23,(SC_FPREGS+184)(a0)) 114 - EX(lwc1 $f24,(SC_FPREGS+192)(a0)) 115 - EX(lwc1 $f25,(SC_FPREGS+200)(a0)) 116 - EX(lwc1 $f26,(SC_FPREGS+208)(a0)) 117 - EX(lwc1 $f27,(SC_FPREGS+216)(a0)) 118 - EX(lwc1 $f28,(SC_FPREGS+224)(a0)) 119 - EX(lwc1 $f29,(SC_FPREGS+232)(a0)) 120 - EX(lwc1 $f30,(SC_FPREGS+240)(a0)) 121 - EX(lwc1 $f31,(SC_FPREGS+248)(a0)) 83 + EX(lw t0, (a1)) 84 + EX2(l.d $f0, 0(a0)) 85 + EX2(l.d $f2, 16(a0)) 86 + EX2(l.d $f4, 32(a0)) 87 + EX2(l.d $f6, 48(a0)) 88 + EX2(l.d $f8, 64(a0)) 89 + EX2(l.d $f10, 80(a0)) 90 + EX2(l.d $f12, 96(a0)) 91 + EX2(l.d $f14, 112(a0)) 92 + EX2(l.d $f16, 128(a0)) 93 + EX2(l.d $f18, 144(a0)) 94 + EX2(l.d $f20, 160(a0)) 95 + EX2(l.d $f22, 176(a0)) 96 + EX2(l.d $f24, 192(a0)) 97 + EX2(l.d $f26, 208(a0)) 98 + EX2(l.d $f28, 224(a0)) 99 + EX2(l.d $f30, 240(a0)) 122 100 jr ra 123 - ctc1 t0,fcr31 101 + ctc1 t0, fcr31 124 102 .set pop 125 103 END(_restore_fp_context) 126 104 .set reorder
+48 -41
arch/mips/kernel/r6000_fpu.S
··· 21 21 .set push 22 22 SET_HARDFLOAT 23 23 24 - /* Save floating point context */ 24 + /** 25 + * _save_fp_context() - save FP context from the FPU 26 + * @a0 - pointer to fpregs field of sigcontext 27 + * @a1 - pointer to fpc_csr field of sigcontext 28 + * 29 + * Save FP context, including the 32 FP data registers and the FP 30 + * control & status register, from the FPU to signal context. 31 + */ 25 32 LEAF(_save_fp_context) 26 33 mfc0 t0,CP0_STATUS 27 34 sll t0,t0,2 ··· 37 30 38 31 cfc1 t1,fcr31 39 32 /* Store the 16 double precision registers */ 40 - sdc1 $f0,(SC_FPREGS+0)(a0) 41 - sdc1 $f2,(SC_FPREGS+16)(a0) 42 - sdc1 $f4,(SC_FPREGS+32)(a0) 43 - sdc1 $f6,(SC_FPREGS+48)(a0) 44 - sdc1 $f8,(SC_FPREGS+64)(a0) 45 - sdc1 $f10,(SC_FPREGS+80)(a0) 46 - sdc1 $f12,(SC_FPREGS+96)(a0) 47 - sdc1 $f14,(SC_FPREGS+112)(a0) 48 - sdc1 $f16,(SC_FPREGS+128)(a0) 49 - sdc1 $f18,(SC_FPREGS+144)(a0) 50 - sdc1 $f20,(SC_FPREGS+160)(a0) 51 - sdc1 $f22,(SC_FPREGS+176)(a0) 52 - sdc1 $f24,(SC_FPREGS+192)(a0) 53 - sdc1 $f26,(SC_FPREGS+208)(a0) 54 - sdc1 $f28,(SC_FPREGS+224)(a0) 55 - sdc1 $f30,(SC_FPREGS+240)(a0) 33 + sdc1 $f0,0(a0) 34 + sdc1 $f2,16(a0) 35 + sdc1 $f4,32(a0) 36 + sdc1 $f6,48(a0) 37 + sdc1 $f8,64(a0) 38 + sdc1 $f10,80(a0) 39 + sdc1 $f12,96(a0) 40 + sdc1 $f14,112(a0) 41 + sdc1 $f16,128(a0) 42 + sdc1 $f18,144(a0) 43 + sdc1 $f20,160(a0) 44 + sdc1 $f22,176(a0) 45 + sdc1 $f24,192(a0) 46 + sdc1 $f26,208(a0) 47 + sdc1 $f28,224(a0) 48 + sdc1 $f30,240(a0) 56 49 jr ra 57 - sw t0,SC_FPC_CSR(a0) 50 + sw t0,(a1) 58 51 1: jr ra 59 52 nop 60 53 END(_save_fp_context) 61 54 62 - /* Restore FPU state: 63 - * - fp gp registers 64 - * - cp1 status/control register 55 + /** 56 + * _restore_fp_context() - restore FP context to the FPU 57 + * @a0 - pointer to fpregs field of sigcontext 58 + * @a1 - pointer to fpc_csr field of sigcontext 65 59 * 66 - * We base the decision which registers to restore from the signal stack 67 - * frame on the current content of c0_status, not on the content of the 68 - * stack frame which might have been changed by the user. 60 + * Restore FP context, including the 32 FP data registers and the FP 61 + * control & status register, from signal context to the FPU. 69 62 */ 70 63 LEAF(_restore_fp_context) 71 64 mfc0 t0,CP0_STATUS 72 65 sll t0,t0,2 73 66 74 67 bgez t0,1f 75 - lw t0,SC_FPC_CSR(a0) 68 + lw t0,(a1) 76 69 /* Restore the 16 double precision registers */ 77 - ldc1 $f0,(SC_FPREGS+0)(a0) 78 - ldc1 $f2,(SC_FPREGS+16)(a0) 79 - ldc1 $f4,(SC_FPREGS+32)(a0) 80 - ldc1 $f6,(SC_FPREGS+48)(a0) 81 - ldc1 $f8,(SC_FPREGS+64)(a0) 82 - ldc1 $f10,(SC_FPREGS+80)(a0) 83 - ldc1 $f12,(SC_FPREGS+96)(a0) 84 - ldc1 $f14,(SC_FPREGS+112)(a0) 85 - ldc1 $f16,(SC_FPREGS+128)(a0) 86 - ldc1 $f18,(SC_FPREGS+144)(a0) 87 - ldc1 $f20,(SC_FPREGS+160)(a0) 88 - ldc1 $f22,(SC_FPREGS+176)(a0) 89 - ldc1 $f24,(SC_FPREGS+192)(a0) 90 - ldc1 $f26,(SC_FPREGS+208)(a0) 91 - ldc1 $f28,(SC_FPREGS+224)(a0) 92 - ldc1 $f30,(SC_FPREGS+240)(a0) 70 + ldc1 $f0,0(a0) 71 + ldc1 $f2,16(a0) 72 + ldc1 $f4,32(a0) 73 + ldc1 $f6,48(a0) 74 + ldc1 $f8,64(a0) 75 + ldc1 $f10,80(a0) 76 + ldc1 $f12,96(a0) 77 + ldc1 $f14,112(a0) 78 + ldc1 $f16,128(a0) 79 + ldc1 $f18,144(a0) 80 + ldc1 $f20,160(a0) 81 + ldc1 $f22,176(a0) 82 + ldc1 $f24,192(a0) 83 + ldc1 $f26,208(a0) 84 + ldc1 $f28,224(a0) 85 + ldc1 $f30,240(a0) 93 86 jr ra 94 87 ctc1 t0,fcr31 95 88 1: jr ra
+1 -1
arch/mips/kernel/relocate.c
··· 200 200 201 201 #if defined(CONFIG_USE_OF) 202 202 /* Get any additional entropy passed in device tree */ 203 - { 203 + if (initial_boot_params) { 204 204 int node, len; 205 205 u64 *prop; 206 206
+13
arch/mips/kernel/setup.c
··· 368 368 end = PFN_DOWN(boot_mem_map.map[i].addr 369 369 + boot_mem_map.map[i].size); 370 370 371 + #ifndef CONFIG_HIGHMEM 372 + /* 373 + * Skip highmem here so we get an accurate max_low_pfn if low 374 + * memory stops short of high memory. 375 + * If the region overlaps HIGHMEM_START, end is clipped so 376 + * max_pfn excludes the highmem portion. 377 + */ 378 + if (start >= PFN_DOWN(HIGHMEM_START)) 379 + continue; 380 + if (end > PFN_DOWN(HIGHMEM_START)) 381 + end = PFN_DOWN(HIGHMEM_START); 382 + #endif 383 + 371 384 if (end > max_low_pfn) 372 385 max_low_pfn = end; 373 386 if (start < min_low_pfn)
+73 -64
arch/mips/kernel/traps.c
··· 156 156 print_ip_sym(pc); 157 157 pc = unwind_stack(task, &sp, pc, &ra); 158 158 } while (pc); 159 - printk("\n"); 159 + pr_cont("\n"); 160 160 } 161 161 162 162 /* ··· 174 174 printk("Stack :"); 175 175 i = 0; 176 176 while ((unsigned long) sp & (PAGE_SIZE - 1)) { 177 - if (i && ((i % (64 / field)) == 0)) 178 - printk("\n "); 177 + if (i && ((i % (64 / field)) == 0)) { 178 + pr_cont("\n"); 179 + printk(" "); 180 + } 179 181 if (i > 39) { 180 - printk(" ..."); 182 + pr_cont(" ..."); 181 183 break; 182 184 } 183 185 184 186 if (__get_user(stackdata, sp++)) { 185 - printk(" (Bad stack address)"); 187 + pr_cont(" (Bad stack address)"); 186 188 break; 187 189 } 188 190 189 - printk(" %0*lx", field, stackdata); 191 + pr_cont(" %0*lx", field, stackdata); 190 192 i++; 191 193 } 192 - printk("\n"); 194 + pr_cont("\n"); 193 195 show_backtrace(task, regs); 194 196 } 195 197 ··· 231 229 long i; 232 230 unsigned short __user *pc16 = NULL; 233 231 234 - printk("\nCode:"); 232 + printk("Code:"); 235 233 236 234 if ((unsigned long)pc & 1) 237 235 pc16 = (unsigned short __user *)((unsigned long)pc & ~1); 238 236 for(i = -3 ; i < 6 ; i++) { 239 237 unsigned int insn; 240 238 if (pc16 ? __get_user(insn, pc16 + i) : __get_user(insn, pc + i)) { 241 - printk(" (Bad address in epc)\n"); 239 + pr_cont(" (Bad address in epc)\n"); 242 240 break; 243 241 } 244 - printk("%c%0*x%c", (i?' ':'<'), pc16 ? 4 : 8, insn, (i?' ':'>')); 242 + pr_cont("%c%0*x%c", (i?' ':'<'), pc16 ? 4 : 8, insn, (i?' ':'>')); 245 243 } 244 + pr_cont("\n"); 246 245 } 247 246 248 247 static void __show_regs(const struct pt_regs *regs) ··· 262 259 if ((i % 4) == 0) 263 260 printk("$%2d :", i); 264 261 if (i == 0) 265 - printk(" %0*lx", field, 0UL); 262 + pr_cont(" %0*lx", field, 0UL); 266 263 else if (i == 26 || i == 27) 267 - printk(" %*s", field, ""); 264 + pr_cont(" %*s", field, ""); 268 265 else 269 - printk(" %0*lx", field, regs->regs[i]); 266 + pr_cont(" %0*lx", field, regs->regs[i]); 270 267 271 268 i++; 272 269 if ((i % 4) == 0) 273 - printk("\n"); 270 + pr_cont("\n"); 274 271 } 275 272 276 273 #ifdef CONFIG_CPU_HAS_SMARTMIPS ··· 291 288 292 289 if (cpu_has_3kex) { 293 290 if (regs->cp0_status & ST0_KUO) 294 - printk("KUo "); 291 + pr_cont("KUo "); 295 292 if (regs->cp0_status & ST0_IEO) 296 - printk("IEo "); 293 + pr_cont("IEo "); 297 294 if (regs->cp0_status & ST0_KUP) 298 - printk("KUp "); 295 + pr_cont("KUp "); 299 296 if (regs->cp0_status & ST0_IEP) 300 - printk("IEp "); 297 + pr_cont("IEp "); 301 298 if (regs->cp0_status & ST0_KUC) 302 - printk("KUc "); 299 + pr_cont("KUc "); 303 300 if (regs->cp0_status & ST0_IEC) 304 - printk("IEc "); 301 + pr_cont("IEc "); 305 302 } else if (cpu_has_4kex) { 306 303 if (regs->cp0_status & ST0_KX) 307 - printk("KX "); 304 + pr_cont("KX "); 308 305 if (regs->cp0_status & ST0_SX) 309 - printk("SX "); 306 + pr_cont("SX "); 310 307 if (regs->cp0_status & ST0_UX) 311 - printk("UX "); 308 + pr_cont("UX "); 312 309 switch (regs->cp0_status & ST0_KSU) { 313 310 case KSU_USER: 314 - printk("USER "); 311 + pr_cont("USER "); 315 312 break; 316 313 case KSU_SUPERVISOR: 317 - printk("SUPERVISOR "); 314 + pr_cont("SUPERVISOR "); 318 315 break; 319 316 case KSU_KERNEL: 320 - printk("KERNEL "); 317 + pr_cont("KERNEL "); 321 318 break; 322 319 default: 323 - printk("BAD_MODE "); 320 + pr_cont("BAD_MODE "); 324 321 break; 325 322 } 326 323 if (regs->cp0_status & ST0_ERL) 327 - printk("ERL "); 324 + pr_cont("ERL "); 328 325 if (regs->cp0_status & ST0_EXL) 329 - printk("EXL "); 326 + pr_cont("EXL "); 330 327 if (regs->cp0_status & ST0_IE) 331 - printk("IE "); 328 + pr_cont("IE "); 332 329 } 333 - printk("\n"); 330 + pr_cont("\n"); 334 331 335 332 exccode = (cause & CAUSEF_EXCCODE) >> CAUSEB_EXCCODE; 336 333 printk("Cause : %08x (ExcCode %02x)\n", cause, exccode); ··· 708 705 exception_exit(prev_state); 709 706 } 710 707 708 + /* 709 + * Send SIGFPE according to FCSR Cause bits, which must have already 710 + * been masked against Enable bits. This is impotant as Inexact can 711 + * happen together with Overflow or Underflow, and `ptrace' can set 712 + * any bits. 713 + */ 714 + void force_fcr31_sig(unsigned long fcr31, void __user *fault_addr, 715 + struct task_struct *tsk) 716 + { 717 + struct siginfo si = { .si_addr = fault_addr, .si_signo = SIGFPE }; 718 + 719 + if (fcr31 & FPU_CSR_INV_X) 720 + si.si_code = FPE_FLTINV; 721 + else if (fcr31 & FPU_CSR_DIV_X) 722 + si.si_code = FPE_FLTDIV; 723 + else if (fcr31 & FPU_CSR_OVF_X) 724 + si.si_code = FPE_FLTOVF; 725 + else if (fcr31 & FPU_CSR_UDF_X) 726 + si.si_code = FPE_FLTUND; 727 + else if (fcr31 & FPU_CSR_INE_X) 728 + si.si_code = FPE_FLTRES; 729 + else 730 + si.si_code = __SI_FAULT; 731 + force_sig_info(SIGFPE, &si, tsk); 732 + } 733 + 711 734 int process_fpemu_return(int sig, void __user *fault_addr, unsigned long fcr31) 712 735 { 713 736 struct siginfo si = { 0 }; ··· 744 715 return 0; 745 716 746 717 case SIGFPE: 747 - si.si_addr = fault_addr; 748 - si.si_signo = sig; 749 - /* 750 - * Inexact can happen together with Overflow or Underflow. 751 - * Respect the mask to deliver the correct exception. 752 - */ 753 - fcr31 &= (fcr31 & FPU_CSR_ALL_E) << 754 - (ffs(FPU_CSR_ALL_X) - ffs(FPU_CSR_ALL_E)); 755 - if (fcr31 & FPU_CSR_INV_X) 756 - si.si_code = FPE_FLTINV; 757 - else if (fcr31 & FPU_CSR_DIV_X) 758 - si.si_code = FPE_FLTDIV; 759 - else if (fcr31 & FPU_CSR_OVF_X) 760 - si.si_code = FPE_FLTOVF; 761 - else if (fcr31 & FPU_CSR_UDF_X) 762 - si.si_code = FPE_FLTUND; 763 - else if (fcr31 & FPU_CSR_INE_X) 764 - si.si_code = FPE_FLTRES; 765 - else 766 - si.si_code = __SI_FAULT; 767 - force_sig_info(sig, &si, current); 718 + force_fcr31_sig(fcr31, fault_addr, current); 768 719 return 1; 769 720 770 721 case SIGBUS: ··· 808 799 /* Run the emulator */ 809 800 sig = fpu_emulator_cop1Handler(regs, &current->thread.fpu, 1, 810 801 &fault_addr); 811 - fcr31 = current->thread.fpu.fcr31; 812 802 813 803 /* 814 - * We can't allow the emulated instruction to leave any of 815 - * the cause bits set in $fcr31. 804 + * We can't allow the emulated instruction to leave any 805 + * enabled Cause bits set in $fcr31. 816 806 */ 817 - current->thread.fpu.fcr31 &= ~FPU_CSR_ALL_X; 807 + fcr31 = mask_fcr31_x(current->thread.fpu.fcr31); 808 + current->thread.fpu.fcr31 &= ~fcr31; 818 809 819 810 /* Restore the hardware register state */ 820 811 own_fpu(1); ··· 840 831 goto out; 841 832 842 833 /* Clear FCSR.Cause before enabling interrupts */ 843 - write_32bit_cp1_register(CP1_STATUS, fcr31 & ~FPU_CSR_ALL_X); 834 + write_32bit_cp1_register(CP1_STATUS, fcr31 & ~mask_fcr31_x(fcr31)); 844 835 local_irq_enable(); 845 836 846 837 die_if_kernel("FP exception in kernel code", regs); ··· 862 853 /* Run the emulator */ 863 854 sig = fpu_emulator_cop1Handler(regs, &current->thread.fpu, 1, 864 855 &fault_addr); 865 - fcr31 = current->thread.fpu.fcr31; 866 856 867 857 /* 868 - * We can't allow the emulated instruction to leave any of 869 - * the cause bits set in $fcr31. 858 + * We can't allow the emulated instruction to leave any 859 + * enabled Cause bits set in $fcr31. 870 860 */ 871 - current->thread.fpu.fcr31 &= ~FPU_CSR_ALL_X; 861 + fcr31 = mask_fcr31_x(current->thread.fpu.fcr31); 862 + current->thread.fpu.fcr31 &= ~fcr31; 872 863 873 864 /* Restore the hardware register state */ 874 865 own_fpu(1); /* Using the FPU again. */ ··· 1433 1424 1434 1425 sig = fpu_emulator_cop1Handler(regs, &current->thread.fpu, 0, 1435 1426 &fault_addr); 1436 - fcr31 = current->thread.fpu.fcr31; 1437 1427 1438 1428 /* 1439 1429 * We can't allow the emulated instruction to leave 1440 - * any of the cause bits set in $fcr31. 1430 + * any enabled Cause bits set in $fcr31. 1441 1431 */ 1442 - current->thread.fpu.fcr31 &= ~FPU_CSR_ALL_X; 1432 + fcr31 = mask_fcr31_x(current->thread.fpu.fcr31); 1433 + current->thread.fpu.fcr31 &= ~fcr31; 1443 1434 1444 1435 /* Send a signal if required. */ 1445 1436 if (!process_fpemu_return(sig, fault_addr, fcr31) && !err)
+22 -22
arch/mips/lib/dump_tlb.c
··· 135 135 c0 = (entrylo0 & ENTRYLO_C) >> ENTRYLO_C_SHIFT; 136 136 c1 = (entrylo1 & ENTRYLO_C) >> ENTRYLO_C_SHIFT; 137 137 138 - printk("va=%0*lx asid=%0*lx", 139 - vwidth, (entryhi & ~0x1fffUL), 140 - asidwidth, entryhi & asidmask); 138 + pr_cont("va=%0*lx asid=%0*lx", 139 + vwidth, (entryhi & ~0x1fffUL), 140 + asidwidth, entryhi & asidmask); 141 141 if (cpu_has_guestid) 142 - printk(" gid=%02lx", 143 - (guestctl1 & MIPS_GCTL1_RID) 142 + pr_cont(" gid=%02lx", 143 + (guestctl1 & MIPS_GCTL1_RID) 144 144 >> MIPS_GCTL1_RID_SHIFT); 145 145 /* RI/XI are in awkward places, so mask them off separately */ 146 146 pa = entrylo0 & ~(MIPS_ENTRYLO_RI | MIPS_ENTRYLO_XI); 147 147 if (xpa) 148 148 pa |= (unsigned long long)readx_c0_entrylo0() << 30; 149 149 pa = (pa << 6) & PAGE_MASK; 150 - printk("\n\t["); 150 + pr_cont("\n\t["); 151 151 if (cpu_has_rixi) 152 - printk("ri=%d xi=%d ", 153 - (entrylo0 & MIPS_ENTRYLO_RI) ? 1 : 0, 154 - (entrylo0 & MIPS_ENTRYLO_XI) ? 1 : 0); 155 - printk("pa=%0*llx c=%d d=%d v=%d g=%d] [", 156 - pwidth, pa, c0, 157 - (entrylo0 & ENTRYLO_D) ? 1 : 0, 158 - (entrylo0 & ENTRYLO_V) ? 1 : 0, 159 - (entrylo0 & ENTRYLO_G) ? 1 : 0); 152 + pr_cont("ri=%d xi=%d ", 153 + (entrylo0 & MIPS_ENTRYLO_RI) ? 1 : 0, 154 + (entrylo0 & MIPS_ENTRYLO_XI) ? 1 : 0); 155 + pr_cont("pa=%0*llx c=%d d=%d v=%d g=%d] [", 156 + pwidth, pa, c0, 157 + (entrylo0 & ENTRYLO_D) ? 1 : 0, 158 + (entrylo0 & ENTRYLO_V) ? 1 : 0, 159 + (entrylo0 & ENTRYLO_G) ? 1 : 0); 160 160 /* RI/XI are in awkward places, so mask them off separately */ 161 161 pa = entrylo1 & ~(MIPS_ENTRYLO_RI | MIPS_ENTRYLO_XI); 162 162 if (xpa) 163 163 pa |= (unsigned long long)readx_c0_entrylo1() << 30; 164 164 pa = (pa << 6) & PAGE_MASK; 165 165 if (cpu_has_rixi) 166 - printk("ri=%d xi=%d ", 167 - (entrylo1 & MIPS_ENTRYLO_RI) ? 1 : 0, 168 - (entrylo1 & MIPS_ENTRYLO_XI) ? 1 : 0); 169 - printk("pa=%0*llx c=%d d=%d v=%d g=%d]\n", 170 - pwidth, pa, c1, 171 - (entrylo1 & ENTRYLO_D) ? 1 : 0, 172 - (entrylo1 & ENTRYLO_V) ? 1 : 0, 173 - (entrylo1 & ENTRYLO_G) ? 1 : 0); 166 + pr_cont("ri=%d xi=%d ", 167 + (entrylo1 & MIPS_ENTRYLO_RI) ? 1 : 0, 168 + (entrylo1 & MIPS_ENTRYLO_XI) ? 1 : 0); 169 + pr_cont("pa=%0*llx c=%d d=%d v=%d g=%d]\n", 170 + pwidth, pa, c1, 171 + (entrylo1 & ENTRYLO_D) ? 1 : 0, 172 + (entrylo1 & ENTRYLO_V) ? 1 : 0, 173 + (entrylo1 & ENTRYLO_G) ? 1 : 0); 174 174 } 175 175 printk("\n"); 176 176
+9 -9
arch/mips/lib/r3k_dump_tlb.c
··· 53 53 */ 54 54 printk("Index: %2d ", i); 55 55 56 - printk("va=%08lx asid=%08lx" 57 - " [pa=%06lx n=%d d=%d v=%d g=%d]", 58 - entryhi & PAGE_MASK, 59 - entryhi & asid_mask, 60 - entrylo0 & PAGE_MASK, 61 - (entrylo0 & R3K_ENTRYLO_N) ? 1 : 0, 62 - (entrylo0 & R3K_ENTRYLO_D) ? 1 : 0, 63 - (entrylo0 & R3K_ENTRYLO_V) ? 1 : 0, 64 - (entrylo0 & R3K_ENTRYLO_G) ? 1 : 0); 56 + pr_cont("va=%08lx asid=%08lx" 57 + " [pa=%06lx n=%d d=%d v=%d g=%d]", 58 + entryhi & PAGE_MASK, 59 + entryhi & asid_mask, 60 + entrylo0 & PAGE_MASK, 61 + (entrylo0 & R3K_ENTRYLO_N) ? 1 : 0, 62 + (entrylo0 & R3K_ENTRYLO_D) ? 1 : 0, 63 + (entrylo0 & R3K_ENTRYLO_V) ? 1 : 0, 64 + (entrylo0 & R3K_ENTRYLO_G) ? 1 : 0); 65 65 } 66 66 } 67 67 printk("\n");