Skip to contentSkip to conversation

powerpc: Emulate enough of SPE instructions to make gcc happy

RFC PATCH In review Kumar Gala 2 participants 3 messages Apr 2, 2009 PowerPC

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

RFC PATCH 1/1 powerpc: Emulate enough of SPE instructions to make gcc happy

Based on patch from Edmar Wienskoski
---

I posting this to see if anyone would possibly use this support if it was in the stock kernel. It allows us to build and use e500/SPE toolchains on G5 HW.

- k

 arch/powerpc/include/asm/processor.h   |    6 +-
 arch/powerpc/kernel/traps.c            |   60 +++++++++-
 arch/powerpc/math-emu/Makefile         |    1 +
 arch/powerpc/math-emu/math_efp.c       |  219 +++++++++++++++++++++++++++++++-
 arch/powerpc/platforms/Kconfig.cputype |    6 +
 5 files changed, 286 insertions(+), 6 deletions(-)
arch/powerpc/include/asm/processor.h +3 -3
index 9eed29e..331282c 100644
@@ -191,12 +191,12 @@ struct thread_struct {
 	/* VSR status */
 	int		used_vsr;	/* set if process has used altivec */
 #endif /* CONFIG_VSX */
-#ifdef CONFIG_SPE
+#if defined(CONFIG_SPE) || defined(CONFIG_SPE_EMULATION)
 	unsigned long	evr[32];	/* upper 32-bits of SPE regs */
 	u64		acc;		/* Accumulator */
 	unsigned long	spefscr;	/* SPE & eFP status */
 	int		used_spe;	/* set if process has used spe */
-#endif /* CONFIG_SPE */
+#endif /* CONFIG_SPE || CONFIG_SPE_EMULATION */
 };
 
 #define ARCH_MIN_TASKALIGN 16
@@ -205,7 +205,7 @@ struct thread_struct {
 #define INIT_SP_LIMIT \
 	(_ALIGN_UP(sizeof(init_thread_info), 16) + (unsigned long) &init_stack)
 
-#ifdef CONFIG_SPE
+#if defined(CONFIG_SPE) || defined(CONFIG_SPE_EMULATION)
 #define SPEFSCR_INIT .spefscr = SPEFSCR_FINVE | SPEFSCR_FDBZE | SPEFSCR_FUNFE | SPEFSCR_FOVFE,
 #else
 #define SPEFSCR_INIT
arch/powerpc/kernel/traps.c +58 -2

84 lines not on this page · raw message

arch/powerpc/math-emu/Makefile +1 -0
index 0c16ab9..f4eb888 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_MATH_EMULATION)	+= fabs.o fadd.o fadds.o fcmpo.o fcmpu.o \
 					math.o fmr.o lfd.o stfd.o
 
 obj-$(CONFIG_SPE)		+= math_efp.o
+obj-$(CONFIG_SPE_EMULATION)	+= math_efp.o
 
 CFLAGS_fabs.o = -fno-builtin-fabs
 CFLAGS_math.o = -fno-builtin-fabs
arch/powerpc/math-emu/math_efp.c +218 -1

337 lines not on this page · raw message

arch/powerpc/platforms/Kconfig.cputype +6 -0
index 9da795e..1d5fd55 100644
@@ -169,6 +169,12 @@ config ALTIVEC
 
 	  If in doubt, say Y here.
 
+config SPE_EMULATION
+	bool "SPE Emulation Support"
+	depends on (CLASSIC32 || POWER4) && !ALTIVEC && !SPE
+	---help---
+	  This option enables kernel support for the Altivec extensions to the
+
 config VSX
 	bool "VSX Support"
 	depends on POWER4 && ALTIVEC && PPC_FPU
Signature · 1 line
1.5.6.6
#1 lore raw

arch/powerpc/platforms/Kconfig.cputype config ALTIVEC · line 177

Quoted 6 lines · Kumar Gala
arch/powerpc/platforms/Kconfig.cputype +6 -0
+config SPE_EMULATION
+	bool "SPE Emulation Support"
+	depends on (CLASSIC32 || POWER4) && !ALTIVEC && !SPE
+	---help---
+	  This option enables kernel support for the Altivec extensions to the
+

Looks like you kind of trailed off here... :)

cheers, Kyle

author
#2 lore raw
Quoted 10 lines · Kyle McMartin
Quoted 7 lines · Kumar Gala
arch/powerpc/platforms/Kconfig.cputype +5 -0
+config SPE_EMULATION
+	bool "SPE Emulation Support"
+	depends on (CLASSIC32 || POWER4) && !ALTIVEC && !SPE
+	---help---
+	  This option enables kernel support for the Altivec extensions  

to the
+

Looks like you kind of trailed off here... :)

Yeah, the patch is still a bit of a hack.. I'm just trying to gage interest. If there is any than I'll spend some more effort to clean it up.

:)

- k