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

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Thu May 10 01:17:32 2012 +0200

hal/arm: support backport of linux 3.2 VFP fixes

---

 include/asm-arm/hal.h      |    8 +++++++-
 include/asm-arm/wrappers.h |    2 +-
 ksrc/arch/arm/switch.S     |    3 ++-
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/include/asm-arm/hal.h b/include/asm-arm/hal.h
index 42d8a34..68f6542 100644
--- a/include/asm-arm/hal.h
+++ b/include/asm-arm/hal.h
@@ -253,6 +253,10 @@ static inline void rthal_init_fpu(rthal_fpenv_t *fpuenv)
     /* vfpstate has already been zeroed by xnarch_init_fpu */
     fpuenv->vfpstate.hard.fpexc = FPEXC_EN;
     fpuenv->vfpstate.hard.fpscr = FPSCR_ROUND_NEAREST;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) \
+     || defined(CONFIG_VFP_3_2_BACKPORT)) && defined(CONFIG_SMP)
+    fpuenv->vfpstate.hard.cpu = NR_CPUS;
+#endif /* linux >= 3.2.0 */
 #endif
 }
 
@@ -306,7 +310,8 @@ static inline rthal_fpenv_t *rthal_get_fpu_owner(void)
        if (!vfp_owner)
                return NULL;
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) && defined(CONFIG_SMP)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) \
+     || defined(CONFIG_VFP_3_2_BACKPORT)) && defined(CONFIG_SMP)
        if (vfp_owner->hard.cpu != cpu)
                return NULL;
 #endif /* linux >= 3.2.0 */
@@ -327,6 +332,7 @@ static inline rthal_fpenv_t *rthal_get_fpu_owner(void)
        _fpexc;                                                 \
     })
 
+
 #else /* !CONFIG_VFP */
 static inline void rthal_save_fpu(rthal_fpenv_t *fpuenv)
 {
diff --git a/include/asm-arm/wrappers.h b/include/asm-arm/wrappers.h
index c33a936..91a2ec4 100644
--- a/include/asm-arm/wrappers.h
+++ b/include/asm-arm/wrappers.h
@@ -98,7 +98,7 @@ static inline void fp_init(union fp_state *state)
 #define FPEXC_EN FPEXC_ENABLE
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0) && 
!defined(CONFIG_VFP_3_2_BACKPORT)
 #define vfp_current_hw_state last_VFP_context
 #endif /* Linux < 3.1 */
 
diff --git a/ksrc/arch/arm/switch.S b/ksrc/arch/arm/switch.S
index 243ee7f..83f4746 100644
--- a/ksrc/arch/arm/switch.S
+++ b/ksrc/arch/arm/switch.S
@@ -100,7 +100,8 @@ ENTRY(rthal_vfp_save)
  * r1 = current cpu
  */
 ENTRY(rthal_vfp_load)
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) && defined(CONFIG_SMP)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) \
+       || defined(CONFIG_VFP_3_2_BACKPORT)) && defined(CONFIG_SMP)
     str        r1, [r0, #VFP_CPU]
 #endif
     VFPFLDMIA  r0, r2                  @ reload the working registers while


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to