MIPS: Replace CONFIG_MIPS64 and CONFIG_MIPS32_R2
PATCH 1/2 MIPS: Replace CONFIG_MIPS64 and CONFIG_MIPS32_R2
From: Paul Bolle <[email protected]>
Commit 597ce1723e0f ("MIPS: Support for 64-bit FP with O32 binaries") introduced references to two undefined Kconfig macros. CONFIG_MIPS32_R2 should clearly be replaced with CONFIG_CPU_MIPS32_R2. And CONFIG_MIPS64 should apparently be replaced with CONFIG_64BIT.
--- arch/mips/include/asm/asmmacro.h | 4 ++-- arch/mips/include/asm/fpu.h | 2 +- arch/mips/kernel/r4k_fpu.S | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-)
arch/mips/include/asm/asmmacro.h +2 -2
@@ -106,7 +106,7 @@ .endm .macro fpu_save_double thread status tmp -#if defined(CONFIG_MIPS64 ) || defined(CONFIG_CPU_MIPS32_R2 ) +#if defined(CONFIG_64BIT ) || defined(CONFIG_CPU_MIPS32_R2 ) sll \tmp, \status, 5 bgez \tmp, 10f fpu_save_16odd \thread
@@ -159,7 +159,7 @@ .endm .macro fpu_restore_double thread status tmp -#if defined(CONFIG_MIPS64 ) || defined(CONFIG_CPU_MIPS32_R2 ) +#if defined(CONFIG_64BIT ) || defined(CONFIG_CPU_MIPS32_R2 ) sll \tmp, \status, 5 bgez \tmp, 10f # 16 register mode?
arch/mips/include/asm/fpu.h +1 -1
@@ -57,7 +57,7 @@ static inline int __enable_fpu(enum fpu_mode mode)return 0 ;case FPU_64BIT : -#if !(defined(CONFIG_CPU_MIPS32_R2 ) || defined(CONFIG_MIPS64 )) +#if !(defined(CONFIG_CPU_MIPS32_R2 ) || defined(CONFIG_64BIT ))/* we only have a 32-bit FPU */ return SIGFPE ;#endif
arch/mips/kernel/r4k_fpu.S +4 -4
@@ -36,9 +36,9 @@ LEAF(_save_fp_context) cfc1 t1, fcr31 -#if defined(CONFIG_64BIT) || defined(CONFIG_MIPS32_R2) +#if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2) .set push -#ifdef CONFIG_MIPS32_R2 +#ifdef CONFIG_CPU_MIPS32_R2 .set mips64r2 mfc0 t0, CP0_STATUS sll t0, t0, 5
@@ -149,9 +149,9 @@ LEAF(_save_fp_context32) LEAF(_restore_fp_context) EX lw t0, SC_FPC_CSR(a0) -#if defined(CONFIG_64BIT) || defined(CONFIG_MIPS32_R2) +#if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2) .set push -#ifdef CONFIG_MIPS32_R2 +#ifdef CONFIG_CPU_MIPS32_R2 .set mips64r2 mfc0 t0, CP0_STATUS sll t0, t0, 5
Signature · 1 line
1.7.7.3
PATCH 2/2 MIPS: fpu: fix conflict of register usage
In _restore_fp_context/_restore_fp_context32, t0 is used for both CP0_Status and CP1_FCSR. This is a mistake and cause FP exeception on boot, so fix it.
--- arch/mips/kernel/r4k_fpu.S | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
arch/mips/kernel/r4k_fpu.S +4 -4
@@ -147,7 +147,7 @@ LEAF(_save_fp_context32) * - cp1 status/control register */ LEAF(_restore_fp_context) - EX lw t0, SC_FPC_CSR(a0) + EX lw t1, SC_FPC_CSR(a0) #if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2) .set push
@@ -192,7 +192,7 @@ LEAF(_restore_fp_context) EX ldc1 $f26, SC_FPREGS+208(a0) EX ldc1 $f28, SC_FPREGS+224(a0) EX ldc1 $f30, SC_FPREGS+240(a0) - ctc1 t0, fcr31 + ctc1 t1, fcr31 jr ra li v0, 0 # success END(_restore_fp_context)
@@ -200,7 +200,7 @@ LEAF(_restore_fp_context) #ifdef CONFIG_MIPS32_COMPAT LEAF(_restore_fp_context32) /* Restore an o32 sigcontext. */ - EX lw t0, SC32_FPC_CSR(a0) + EX lw t1, SC32_FPC_CSR(a0) mfc0 t0, CP0_STATUS sll t0, t0, 5
@@ -240,7 +240,7 @@ LEAF(_restore_fp_context32) EX ldc1 $f26, SC32_FPREGS+208(a0) EX ldc1 $f28, SC32_FPREGS+224(a0) EX ldc1 $f30, SC32_FPREGS+240(a0) - ctc1 t0, fcr31 + ctc1 t1, fcr31 jr ra li v0, 0 # success END(_restore_fp_context32)
Signature · 1 line
1.7.7.3
Re: [PATCH 2/2] MIPS: fpu: fix conflict of register usage
Quoted 3 lines · * Huacai Chen ([email protected]) [140215 16:14]:
In _restore_fp_context/_restore_fp_context32, t0 is used for both
CP0_StatusandCP1_FCSR. This is a mistake and cause FP exeception on boot, so fix it.
I can confirm that it fixes boot-up on loongson 3 too.
Quoted 1 line
Signed-off-by Huacai Chen <[email protected]>
Thanks,
Andi