4.14 is always eager, unfortunately we will need a few ifdefs inside the eager fpu support as well.
Signed-off-by: Henning Schild <henning.sch...@siemens.com> --- .../arch/x86/include/asm/xenomai/wrappers.h | 4 ++++ kernel/cobalt/arch/x86/thread.c | 21 ++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/wrappers.h b/kernel/cobalt/arch/x86/include/asm/xenomai/wrappers.h index a47730106..a4cc368a5 100644 --- a/kernel/cobalt/arch/x86/include/asm/xenomai/wrappers.h +++ b/kernel/cobalt/arch/x86/include/asm/xenomai/wrappers.h @@ -32,6 +32,10 @@ LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) #define IPIPE_X86_FPU_EAGER #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) +#define IPIPE_X86_FPU_EAGER +#endif + #if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0) #include <asm/i387.h> diff --git a/kernel/cobalt/arch/x86/thread.c b/kernel/cobalt/arch/x86/thread.c index 18cf636e5..2668ce274 100644 --- a/kernel/cobalt/arch/x86/thread.c +++ b/kernel/cobalt/arch/x86/thread.c @@ -42,6 +42,7 @@ static struct kmem_cache *xstate_cache; #define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE) #endif +#ifndef IPIPE_X86_FPU_EAGER #if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0) #include <asm/i387.h> #include <asm/fpu-internal.h> @@ -72,6 +73,9 @@ static inline void x86_fpregs_activate(struct task_struct *t) #define x86_xstate_alignment __alignof__(union fpregs_state) #endif +#else /* IPIPE_X86_FPU_EAGER */ +#define x86_xstate_alignment __alignof__(union fpregs_state) +#endif /* ! IPIPE_X86_FPU_EAGER */ #if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0) /* @@ -465,9 +469,15 @@ void xnarch_leave_root(struct xnthread *root) // save fpregs from in-kernel use copy_fpregs_to_fpstate(rootcb->kfpu); kernel_fpu_enable(); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) + // restore current's fpregs + __cpu_invalidate_fpregs_state(); + switch_fpu_finish(¤t->thread.fpu, smp_processor_id()); +#else // mark current thread as not owning the FPU anymore if (¤t->thread.fpu.fpstate_active) fpregs_deactivate(¤t->thread.fpu); +#endif } void xnarch_switch_fpu(struct xnthread *from, struct xnthread *to) @@ -528,7 +538,11 @@ void xnarch_init_shadow_tcb(struct xnthread *thread) #else /* IPIPE_X86_FPU_EAGER */ /* XNFPU is always set */ xnthread_set_state(thread, XNFPU); +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) fpu__activate_fpstate_read(&p->thread.fpu); +#else + fpu__initialize(&p->thread.fpu); +#endif #endif /* ! IPIPE_X86_FPU_EAGER */ } @@ -537,7 +551,12 @@ int mach_x86_thread_init(void) xstate_cache = kmem_cache_create("cobalt_x86_xstate", fpu_kernel_xstate_size, x86_xstate_alignment, - SLAB_NOTRACK, NULL); +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) + SLAB_NOTRACK, +#else + 0, +#endif + NULL); if (xstate_cache == NULL) return -ENOMEM; -- 2.19.0 _______________________________________________ Xenomai mailing list Xenomai@xenomai.org https://xenomai.org/mailman/listinfo/xenomai