]> Pileus Git - ~andy/linux/commitdiff
powerpc/math-emu: Allow math-emu to be used for HW FPU
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Sun, 9 Jun 2013 07:01:24 +0000 (17:01 +1000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 20 Jun 2013 07:05:09 +0000 (17:05 +1000)
(Including 64-bit ones)

This allow SW emulation by the kernel of optional instructions
such as fsqrt which aren't implemented on some processors, and
thus fixes some Fedora 19 issues such as Anaconda since the
compiler is set to generate those by default on 64-bit.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/Kconfig
arch/powerpc/kernel/traps.c

index c33e3ad2c8fd52c9e0c31dfc272faf3d34902f37..e3009abc7f75b4bface80915dcaf847554cc8fd6 100644 (file)
@@ -298,7 +298,7 @@ config HUGETLB_PAGE_SIZE_VARIABLE
 
 config MATH_EMULATION
        bool "Math emulation"
-       depends on 4xx || 8xx || E200 || PPC_MPC832x || E500
+       depends on 4xx || 8xx || PPC_MPC832x || BOOKE
        ---help---
          Some PowerPC chips designed for embedded applications do not have
          a floating-point unit and therefore do not implement the
@@ -307,6 +307,10 @@ config MATH_EMULATION
          unit, which will allow programs that use floating-point
          instructions to run.
 
+         This is also useful to emulate missing (optional) instructions
+         such as fsqrt on cores that do have an FPU but do not implement
+         them (such as Freescale BookE).
+
 config PPC_TRANSACTIONAL_MEM
        bool "Transactional Memory support for POWERPC"
        depends on PPC_BOOK3S_64
index f18c79c324eff539a25f8a5f10d13566a68eb573..f4b5687b0c66f69c49d74c9308c558c9118c3e01 100644 (file)
@@ -1125,7 +1125,17 @@ void __kprobes program_check_exception(struct pt_regs *regs)
         * ESR_DST (!?) or 0.  In the process of chasing this with the
         * hardware people - not sure if it can happen on any illegal
         * instruction or only on FP instructions, whether there is a
-        * pattern to occurrences etc. -dgibson 31/Mar/2003 */
+        * pattern to occurrences etc. -dgibson 31/Mar/2003
+        */
+
+       /*
+        * If we support a HW FPU, we need to ensure the FP state
+        * if flushed into the thread_struct before attempting
+        * emulation
+        */
+#ifdef CONFIG_PPC_FPU
+       flush_fp_to_thread(current);
+#endif
        switch (do_mathemu(regs)) {
        case 0:
                emulate_single_step(regs);