* [PATCH 0/4] powerpc: several cleanup patches for the FPU
@ 2013-07-14 9:02 Kevin Hao
2013-07-14 9:02 ` [PATCH 1/4] powerpc: remove the unused function disable_kernel_fp() Kevin Hao
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Kevin Hao @ 2013-07-14 9:02 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc
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_defconfig
Also 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(-)
--
1.8.1.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/4] powerpc: remove the unused function disable_kernel_fp()
2013-07-14 9:02 [PATCH 0/4] powerpc: several cleanup patches for the FPU Kevin Hao
@ 2013-07-14 9:02 ` Kevin Hao
2013-07-14 9:02 ` [PATCH 2/4] powerpc: remove the redundant flush_fp_to_thread() in setup_sigcontext() Kevin Hao
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Kevin Hao @ 2013-07-14 9:02 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc
The only using of function disable_kernel_fp() was already dropped
in the commit 5daf9071 (powerpc: merge align.c).
Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
arch/powerpc/include/asm/switch_to.h | 1 -
arch/powerpc/kernel/misc_64.S | 13 -------------
2 files changed, 14 deletions(-)
diff --git a/arch/powerpc/include/asm/switch_to.h b/arch/powerpc/include/asm/switch_to.h
index 49a13e0..33e1cd8 100644
--- a/arch/powerpc/include/asm/switch_to.h
+++ b/arch/powerpc/include/asm/switch_to.h
@@ -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);
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index 6820e45..8110abe 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -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
--
1.8.1.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/4] powerpc: remove the redundant flush_fp_to_thread() in setup_sigcontext()
2013-07-14 9:02 [PATCH 0/4] powerpc: several cleanup patches for the FPU Kevin Hao
2013-07-14 9:02 ` [PATCH 1/4] powerpc: remove the unused function disable_kernel_fp() Kevin Hao
@ 2013-07-14 9:02 ` Kevin Hao
2013-07-14 9:02 ` [PATCH 3/4] powerpc: make flush_fp_to_thread() nop when CONFIG_PPC_FPU is disabled Kevin Hao
2013-07-14 9:02 ` [PATCH 4/4] powerpc: remove the empty giveup_fpu() function on 32bit kernel Kevin Hao
3 siblings, 0 replies; 5+ messages in thread
From: Kevin Hao @ 2013-07-14 9:02 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc
In 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.
Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
arch/powerpc/kernel/signal_64.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 887e99d..cb833bf 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -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);
--
1.8.1.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] powerpc: make flush_fp_to_thread() nop when CONFIG_PPC_FPU is disabled
2013-07-14 9:02 [PATCH 0/4] powerpc: several cleanup patches for the FPU Kevin Hao
2013-07-14 9:02 ` [PATCH 1/4] powerpc: remove the unused function disable_kernel_fp() Kevin Hao
2013-07-14 9:02 ` [PATCH 2/4] powerpc: remove the redundant flush_fp_to_thread() in setup_sigcontext() Kevin Hao
@ 2013-07-14 9:02 ` Kevin Hao
2013-07-14 9:02 ` [PATCH 4/4] powerpc: remove the empty giveup_fpu() function on 32bit kernel Kevin Hao
3 siblings, 0 replies; 5+ messages in thread
From: Kevin Hao @ 2013-07-14 9:02 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc
In 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.
Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
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(-)
diff --git a/arch/powerpc/include/asm/switch_to.h b/arch/powerpc/include/asm/switch_to.h
index 33e1cd8..39cf0f6 100644
--- a/arch/powerpc/include/asm/switch_to.h
+++ b/arch/powerpc/include/asm/switch_to.h
@@ -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 *);
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index c517dbe..0ec255a 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -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)
{
diff --git a/arch/powerpc/math-emu/math.c b/arch/powerpc/math-emu/math.c
index f9ef347..d1ebac7 100644
--- a/arch/powerpc/math-emu/math.c
+++ b/arch/powerpc/math-emu/math.c
@@ -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);
--
1.8.1.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] powerpc: remove the empty giveup_fpu() function on 32bit kernel
2013-07-14 9:02 [PATCH 0/4] powerpc: several cleanup patches for the FPU Kevin Hao
` (2 preceding siblings ...)
2013-07-14 9:02 ` [PATCH 3/4] powerpc: make flush_fp_to_thread() nop when CONFIG_PPC_FPU is disabled Kevin Hao
@ 2013-07-14 9:02 ` Kevin Hao
3 siblings, 0 replies; 5+ messages in thread
From: Kevin Hao @ 2013-07-14 9:02 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc
Instead of implementing an empty giveup_fpu() function for each
32bit processor type, replace them with an unique empty inline
function.
Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
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(-)
diff --git a/arch/powerpc/include/asm/switch_to.h b/arch/powerpc/include/asm/switch_to.h
index 39cf0f6..2c7edde 100644
--- a/arch/powerpc/include/asm/switch_to.h
+++ b/arch/powerpc/include/asm/switch_to.h
@@ -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
diff --git a/arch/powerpc/kernel/head_40x.S b/arch/powerpc/kernel/head_40x.S
index 8a9b6f5..67ee0d6 100644
--- a/arch/powerpc/kernel/head_40x.S
+++ b/arch/powerpc/kernel/head_40x.S
@@ -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:
diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S
index 97e2671..c334f53 100644
--- a/arch/powerpc/kernel/head_44x.S
+++ b/arch/powerpc/kernel/head_44x.S
@@ -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
diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S
index b2a5860..1b92a97 100644
--- a/arch/powerpc/kernel/head_8xx.S
+++ b/arch/powerpc/kernel/head_8xx.S
@@ -691,10 +691,6 @@ modified_instr:
b 151b
#endif
- .globl giveup_fpu
-giveup_fpu:
- blr
-
/*
* This is where the main kernel code starts.
*/
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index d10a7ca..289afaf 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -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.
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index c296665..689ef81 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -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 */
--
1.8.1.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-07-14 9:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-14 9:02 [PATCH 0/4] powerpc: several cleanup patches for the FPU Kevin Hao
2013-07-14 9:02 ` [PATCH 1/4] powerpc: remove the unused function disable_kernel_fp() Kevin Hao
2013-07-14 9:02 ` [PATCH 2/4] powerpc: remove the redundant flush_fp_to_thread() in setup_sigcontext() Kevin Hao
2013-07-14 9:02 ` [PATCH 3/4] powerpc: make flush_fp_to_thread() nop when CONFIG_PPC_FPU is disabled Kevin Hao
2013-07-14 9:02 ` [PATCH 4/4] powerpc: remove the empty giveup_fpu() function on 32bit kernel Kevin Hao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).