Skip to contentSkip to conversation

m68k: add ColdFire FPU support for the V4e ColdFire CPU's

PATCH New [email protected] 3 participants 7 messages Nov 3, 2011 – Nov 4, 2011 m68k architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 m68k: add ColdFire FPU support for the V4e ColdFire CPU's

Hi All,

Here is an improved patch set for FPU support on the ColdFire V4e. Much cleaner than the ifdefery for this in the ColdFire/MMU patch set I sent recently. (So of course this replaces that patch).

Does anyone know why some of the code for using fsave/frestore is surrounded by ".chip" directives and others are not? For example in arch/m68k/kernel/process_mm.c you will find this:

       __asm__ volatile (".chip 68k/68881\n\t"
                          "frestore %0\n\t"
                          ".chip 68k" : : "m" (*sc->sc_fpstate));

and you will also find this:

	asm volatile ("frestore %0" : : "m" (p->thread.fpstate[0]));

I can use the second form directly on ColdFire, but not the first...

Regards
Greg

#1 lore raw

PATCH 1/1 m68k: add ColdFire FPU support for the V4e ColdFire CPU's

From: Greg Ungerer <[email protected]>

The V4e ColdFire CPU family also has an integrated FPU (as well as the MMU). So add code to support this hardware along side the existing m68k FPU code.

The ColdFire FPU is of course different to all previous 68k FP units. It is close in operation to the 68060, but not completely compatible. The biggest issue to deal with is that the ColdFire FPU multi-move instructions are different. It does not support multi-moving the FP control registers, and the multi-move of the FP data registers uses a different instruction neumonic.

---
 arch/m68k/include/asm/fpu.h   |    2 +
 arch/m68k/kernel/process_mm.c |   57 +++++++++++----
 arch/m68k/kernel/setup_mm.c   |    2 +-
 arch/m68k/kernel/signal_mm.c  |  156 ++++++++++++++++++++++++++++-------------
 4 files changed, 152 insertions(+), 65 deletions(-)
arch/m68k/include/asm/fpu.h +2 -0
index ffb6b8c..526db9d 100644
@@ -12,6 +12,8 @@
 #define FPSTATESIZE (96)
 #elif defined(CONFIG_M68KFPU_EMU)
 #define FPSTATESIZE (28)
+#elif defined(CONFIG_COLDFIRE) && defined(CONFIG_MMU)
+#define FPSTATESIZE (16)
 #elif defined(CONFIG_M68060)
 #define FPSTATESIZE (12)
 #else
arch/m68k/kernel/process_mm.c +43 -14

75 lines not on this page · raw message

arch/m68k/kernel/setup_mm.c +1 -1
index b3938ad..d872ce4 100644
@@ -236,7 +236,7 @@ void __init setup_arch(char **cmdline_p)
 	 *  with them, we should add a test to check_bugs() below] */
 #ifndef CONFIG_M68KFPU_EMU_ONLY
 	/* clear the fpu if we have one */
-	if (m68k_fputype & (FPU_68881|FPU_68882|FPU_68040|FPU_68060)) {
+	if (m68k_fputype & (FPU_68881|FPU_68882|FPU_68040|FPU_68060|FPU_COLDFIRE)) {
 		volatile int zero = 0;
 		asm volatile ("frestore %0" : : "m" (zero));
 	}
arch/m68k/kernel/signal_mm.c +106 -50

242 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#2 lore raw
Quoted 5 lines · On Thu, 3 Nov 2011, [email protected] wrote:

#define FPSTATESIZE (96)
#elif defined(CONFIG_M68KFPU_EMU)
#define FPSTATESIZE (28)

arch/m68k/include/asm/fpu.h +2 -0
+#elif defined(CONFIG_COLDFIRE) && defined(CONFIG_MMU)
+#define FPSTATESIZE (16)

...

Review

Quoted 1 line
(quoted diff) +1 -0
+	if (CPU_IS_COLDFIRE) {

Is it actually possible to run the same kernel binary on CF and 680x0? If not, shouldn't these run-time tests be compile-time #ifdefs?

Finn

#3 lore raw
Quoted 2 lines · On Thu, 3 Nov 2011, I wrote:

Is it actually possible to run the same kernel binary on CF and 680x0? If not, shouldn't these run-time tests be compile-time #ifdefs?

Oops, I forgot about the compiler's optimiser...

Finn

#4 lore raw

Hi Finn,

Quoted 6 lines · Finn Thain
Quoted 2 lines · On Thu, 3 Nov 2011, I wrote:

Is it actually possible to run the same kernel binary on CF and 680x0? If not, shouldn't these run-time tests be compile-time #ifdefs?

Oops, I forgot about the compiler's optimiser...

Yeah, thats right. Most of the code here is optimized out currently.

It may be possible to have a single image boot on both m68k and ColdFire. And where ever possible I am leaving the option open in the code. But we have quite a few hurdles to jump over before the code will actually be able to do it.

Regards
Greg

------------------------------------------------------------------------

Greg Ungerer  --  Principal Engineer        EMAIL:     [email protected]
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
8 Gardner Close                             FAX:         +61 7 3217 5323
Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com
#5 lore raw
In reply to [email protected]
Quoted 6 lines · On Thu, Nov 3, 2011 at 06:54, <[email protected]> wrote:

The ColdFire FPU is of course different to all previous 68k FP units. It is close in operation to the 68060, but not completely compatible. The biggest issue to deal with is that the ColdFire FPU multi-move instructions are different. It does not support multi-moving the FP control registers, and the multi-move of the FP data registers uses a different instruction neumonic.

mnemonic

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds

#6 lore raw

Hi Geert,

Quoted 9 lines · Geert Uytterhoeven
Quoted 6 lines · On Thu, Nov 3, 2011 at 06:54,<[email protected]> wrote:

The ColdFire FPU is of course different to all previous 68k FP units. It is close in operation to the 68060, but not completely compatible. The biggest issue to deal with is that the ColdFire FPU multi-move instructions are different. It does not support multi-moving the FP control registers, and the multi-move of the FP data registers uses a different instruction neumonic.

mnemonic

Thanks!

Regards
Greg

------------------------------------------------------------------------

Greg Ungerer  --  Principal Engineer        EMAIL:     [email protected]
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
8 Gardner Close                             FAX:         +61 7 3217 5323
Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com