Module: xenomai-2.6
Branch: master
Commit: d09932cfd0ca422989b3c3a9d736236d74590ade
URL:    
http://git.xenomai.org/?p=xenomai-2.6.git;a=commit;h=d09932cfd0ca422989b3c3a9d736236d74590ade

Author: Philippe Gerum <r...@xenomai.org>
Date:   Tue Nov 19 10:28:40 2013 +0100

powerpc: sanitize SPE handling

switchtest: we support SPE in user-space, but there is no point in
checking for fprs sanity between context switches since we have no
such registers in this case.

kernel handling: enabling SPE implicitly means disabling HW_FPU
handling in the Xenomai nucleus, so tracking the SPE context for
real-time kthreads is unsupported. However, we do have proper SPE
save/restore code in our user context switching code, which enables it
for real-time threads in userland.

This patch is based on:
http://lists.debian.org/debian-powerpc/2011/07/msg00026.html

---

 include/asm-powerpc/fptest.h |   21 +++++++++++++++++----
 ksrc/arch/powerpc/Kconfig    |    2 +-
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/include/asm-powerpc/fptest.h b/include/asm-powerpc/fptest.h
index ab56a8d..0dcb98d 100644
--- a/include/asm-powerpc/fptest.h
+++ b/include/asm-powerpc/fptest.h
@@ -40,7 +40,9 @@ static inline void fp_features_init(void)
 {
 }
 
-static inline void fp_regs_set(unsigned val)
+#ifndef __NO_FPRS__            /* i.e. has FPU, not SPE */
+
+static inline void fp_regs_set(unsigned int val)
 {
        uint64_t fpval = val;
        __asm__ __volatile__("lfd       0, %0\n"
@@ -80,12 +82,12 @@ static inline void fp_regs_set(unsigned val)
 #define FPTEST_REGVAL(n) {                                             \
        uint64_t t;                                                     \
        __asm__ __volatile__("  stfd    " #n ", %0" : "=m" (t));        \
-       e[n] = (unsigned)t;                                             \
+       e[n] = (unsigned int)t;                                         \
        }
 
-static inline unsigned fp_regs_check(unsigned val)
+static inline unsigned fp_regs_check(unsigned int val)
 {
-       unsigned i, result = val;
+       unsigned int i, result = val;
        uint32_t e[32];
 
        FPTEST_REGVAL(0);
@@ -130,4 +132,15 @@ static inline unsigned fp_regs_check(unsigned val)
        return result;
 }
 
+#else  /* __NO_FPRS__ */
+
+static inline void fp_regs_set(unsigned int val) { }
+
+static inline unsigned fp_regs_check(unsigned int val)
+{
+       return val;
+}
+
+#endif /* __NO_FPRS__ */
+
 #endif /* !_XENO_ASM_POWERPC_FPTEST_H */
diff --git a/ksrc/arch/powerpc/Kconfig b/ksrc/arch/powerpc/Kconfig
index 3a2c5fd..e72afa0 100644
--- a/ksrc/arch/powerpc/Kconfig
+++ b/ksrc/arch/powerpc/Kconfig
@@ -8,7 +8,7 @@ config XENO_FASTSYNCH
 
 config XENO_HW_MATH_EMU
         bool
-       default y if MATH_EMU || 8XX_MINIMAL_FPEMU
+       default y if MATH_EMU || MATH_EMULATION || 8XX_MINIMAL_FPEMU
 
 source "kernel/xenomai/nucleus/Kconfig"
 


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to