powerpc: several cleanup patches for the FPU
cover powerpc: several cleanup patches for the FPU
All these patches passed the build test for the following configurations:
ppc40x_defconfig
ppc64e_defconfig
ppc64_defconfig
mpc85xx_defconfig
mpc85xx_smp_defconfig
corenet32_smp_defconfig
corenet64_smp_defconfig
ppc44x_defconfig
mpc885_ads_defconfig
pseries_defconfigAlso passed the boot test on a t4240qds board.
Kevin Hao (4):
powerpc: remove the unused function disable_kernel_fp()
powerpc: remove the redundant flush_fp_to_thread() in
setup_sigcontext()
powerpc: make flush_fp_to_thread() nop when CONFIG_PPC_FPU is disabled
powerpc: remove the empty giveup_fpu() function on 32bit kernel
arch/powerpc/include/asm/switch_to.h | 11 ++++++++--- arch/powerpc/kernel/head_40x.S | 8 -------- arch/powerpc/kernel/head_44x.S | 10 ---------- arch/powerpc/kernel/head_8xx.S | 4 ---- arch/powerpc/kernel/head_fsl_booke.S | 10 ---------- arch/powerpc/kernel/misc_64.S | 13 ------------- arch/powerpc/kernel/ppc_ksyms.c | 2 ++ arch/powerpc/kernel/process.c | 2 ++ arch/powerpc/kernel/signal_64.c | 2 -- arch/powerpc/math-emu/math.c | 3 +-- 10 files changed, 13 insertions(+), 52 deletions(-)
Signature · 1 line
1.8.1.4
PATCH 1/4 powerpc: remove the unused function disable_kernel_fp()
The only using of function disable_kernel_fp() was already dropped in the commit 5daf9071 (powerpc: merge align.c).
--- arch/powerpc/include/asm/switch_to.h | 1 - arch/powerpc/kernel/misc_64.S | 13 ------------- 2 files changed, 14 deletions(-)
arch/powerpc/include/asm/switch_to.h +0 -1
@@ -18,7 +18,6 @@ extern struct task_struct *_switch(struct thread_struct *prev,extern void giveup_fpu (struct task_struct *);extern void load_up_fpu (void ); -extern void disable_kernel_fp (void );extern void enable_kernel_fp (void );extern void flush_fp_to_thread (struct task_struct *);extern void enable_kernel_altivec (void );
arch/powerpc/kernel/misc_64.S +0 -13
@@ -416,19 +416,6 @@ _GLOBAL(scom970_write) blr #endif /* CONFIG_CPU_FREQ_PMAC64 || CONFIG_CPU_FREQ_MAPLE */ - -/* - * disable_kernel_fp() - * Disable the FPU. - */ -_GLOBAL(disable_kernel_fp) - mfmsr r3 - rldicl r0,r3,(63-MSR_FP_LG),1 - rldicl r3,r0,(MSR_FP_LG+1),0 - mtmsrd r3 /* disable use of fpu now */ - isync - blr - /* kexec_wait(phys_cpu) * * wait for the flag to change, indicating this kernel is going away but
Signature · 1 line
1.8.1.4
PATCH 2/4 powerpc: remove the redundant flush_fp_to_thread() in setup_sigcontext()
In reply to Kevin HaoIn commit c6e6771b(powerpc: Introduce VSX thread_struct and CONFIG_VSX) we add a invocation of flush_fp_to_thread() before copying the FPR or VSR to users. But we already invoke the flush_fp_to_thread() in this function. So remove one of them.
--- arch/powerpc/kernel/signal_64.c | 2 -- 1 file changed, 2 deletions(-)
arch/powerpc/kernel/signal_64.c +0 -2
@@ -96,8 +96,6 @@ static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,unsigned long msr = regs->msr;long err =0 ; -flush_fp_to_thread (current); -#ifdef CONFIG_ALTIVEC err |=__put_user (v_regs, &sc->v_regs);
Signature · 1 line
1.8.1.4
PATCH 3/4 powerpc: make flush_fp_to_thread() nop when CONFIG_PPC_FPU is disabled
In reply to Kevin HaoIn the current kernel, the function flush_fp_to_thread() is not dependent on CONFIG_PPC_FPU. So most invocations of this function is not wrapped by CONFIG_PPC_FPU. Even through we don't really save the FPRs to the thread struct if CONFIG_PPC_FPU is not enabled, but there does have some runtime overhead such as the check for tsk->thread.regs and preempt disable and enable. It really make no sense to do that. So make it a nop when CONFIG_PPC_FPU is disabled. Also remove the wrapped #ifdef CONFIG_PPC_FPU when invoking this function.
--- arch/powerpc/include/asm/switch_to.h | 7 ++++++- arch/powerpc/kernel/process.c | 2 ++ arch/powerpc/math-emu/math.c | 3 +-- 3 files changed, 9 insertions(+), 3 deletions(-)
arch/powerpc/include/asm/switch_to.h +6 -1
@@ -19,7 +19,6 @@ extern struct task_struct *_switch(struct thread_struct *prev,extern void giveup_fpu (struct task_struct *);extern void load_up_fpu (void );extern void enable_kernel_fp (void ); -extern void flush_fp_to_thread (struct task_struct *);extern void enable_kernel_altivec (void );extern void load_up_altivec (struct task_struct *);extern int emulate_altivec (struct pt_regs *);
@@ -37,6 +36,12 @@ static inline void discard_lazy_cpu_state(void) }#endif +#ifdef CONFIG_PPC_FPU +extern void flush_fp_to_thread (struct task_struct *); +#else +static inline void flush_fp_to_thread (struct task_struct *t) { } +#endif +#ifdef CONFIG_ALTIVEC extern void flush_altivec_to_thread (struct task_struct *);extern void giveup_altivec (struct task_struct *);
arch/powerpc/kernel/process.c +2 -0
@@ -74,6 +74,7 @@ struct task_struct *last_task_used_vsx = NULL;struct task_struct *last_task_used_spe =NULL ;#endif +#ifdef CONFIG_PPC_FPU /* * Make sure the floating-point register state in the * the thread_struct is up to date for task tsk.
@@ -107,6 +108,7 @@ void flush_fp_to_thread(struct task_struct *tsk) } }EXPORT_SYMBOL_GPL (flush_fp_to_thread); +#endif void enable_kernel_fp (void ) {
arch/powerpc/math-emu/math.c +1 -2
@@ -7,6 +7,7 @@#include <asm/uaccess.h> #include <asm/reg.h> +#include <asm/switch_to.h> #include <asm/sfp-machine.h> #include <math-emu/double.h>
@@ -425,9 +426,7 @@ do_mathemu(struct pt_regs *regs)* is flushed into the thread_struct before attempting * emulation */ -#ifdef CONFIG_PPC_FPU flush_fp_to_thread (current); -#endif eflag =func (op0, op1, op2, op3);
Signature · 1 line
1.8.1.4
PATCH 4/4 powerpc: remove the empty giveup_fpu() function on 32bit kernel
In reply to Kevin HaoInstead of implementing an empty giveup_fpu() function for each 32bit processor type, replace them with an unique empty inline function.
--- arch/powerpc/include/asm/switch_to.h | 3 ++- arch/powerpc/kernel/head_40x.S | 8 -------- arch/powerpc/kernel/head_44x.S | 10 ---------- arch/powerpc/kernel/head_8xx.S | 4 ---- arch/powerpc/kernel/head_fsl_booke.S | 10 ---------- arch/powerpc/kernel/ppc_ksyms.c | 2 ++ 6 files changed, 4 insertions(+), 33 deletions(-)
arch/powerpc/include/asm/switch_to.h +2 -1
@@ -16,7 +16,6 @@ struct thread_struct;extern struct task_struct *_switch (struct thread_struct *prev,struct thread_struct *next); -extern void giveup_fpu (struct task_struct *);extern void load_up_fpu (void );extern void enable_kernel_fp (void );extern void enable_kernel_altivec (void );
@@ -38,8 +37,10 @@ static inline void discard_lazy_cpu_state(void)#ifdef CONFIG_PPC_FPU extern void flush_fp_to_thread (struct task_struct *); +extern void giveup_fpu (struct task_struct *);#else static inline void flush_fp_to_thread (struct task_struct *t) { } +static inline void giveup_fpu (struct task_struct *t) { }#endif #ifdef CONFIG_ALTIVEC
arch/powerpc/kernel/head_40x.S +0 -8
@@ -822,14 +822,6 @@ finish_tlb_load: rfi /* Should sync shadow TLBs */ b . /* prevent prefetch past rfi */ -/* extern void giveup_fpu(struct task_struct *prev) - * - * The PowerPC 4xx family of processors do not have an FPU, so this just - * returns. - */ -_ENTRY(giveup_fpu) - blr - /* This is where the main kernel code starts. */ start_here:
arch/powerpc/kernel/head_44x.S +0 -10
@@ -784,16 +784,6 @@ _GLOBAL(__fixup_440A_mcheck) sync blr -/* - * extern void giveup_fpu(struct task_struct *prev) - * - * The 44x core does not have an FPU. - */ -#ifndef CONFIG_PPC_FPU -_GLOBAL(giveup_fpu) - blr -#endif - _GLOBAL(set_context) #ifdef CONFIG_BDI_SWITCH
arch/powerpc/kernel/head_8xx.S +0 -4
@@ -691,10 +691,6 @@ modified_instr: b 151b #endif - .globl giveup_fpu -giveup_fpu: - blr - /* * This is where the main kernel code starts. */
arch/powerpc/kernel/head_fsl_booke.S +0 -10
@@ -948,16 +948,6 @@ _GLOBAL(giveup_spe) #endif /* CONFIG_SPE */ /* - * extern void giveup_fpu(struct task_struct *prev) - * - * Not all FSL Book-E cores have an FPU - */ -#ifndef CONFIG_PPC_FPU -_GLOBAL(giveup_fpu) - blr -#endif - -/* * extern void abort(void) * * At present, this routine just applies a system reset.
arch/powerpc/kernel/ppc_ksyms.c +2 -0
@@ -96,7 +96,9 @@ EXPORT_SYMBOL(pci_dram_offset);EXPORT_SYMBOL (start_thread); +#ifdef CONFIG_PPC_FPU EXPORT_SYMBOL (giveup_fpu); +#endif #ifdef CONFIG_ALTIVEC EXPORT_SYMBOL (giveup_altivec);#endif /* CONFIG_ALTIVEC */
Signature · 1 line
1.8.1.4