Skip to contentSkip to conversation

cobalt/x86: adapt fpu code with Linux kernel upstream

PATCH Applied Fino Meng 2 participants 3 messages Sep 18, 2020 – Sep 21, 2020

lore
Share & tools
lore

Fino Meng

author
#0 lore raw

PATCH 1/4 cobalt/x86: adapt fpu code with Linux kernel upstream

---
 kernel/cobalt/arch/x86/thread.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
kernel/cobalt/arch/x86/thread.c +5 -1
index ba807ac1e..c33ad832f 100644
@@ -26,6 +26,10 @@
 #include <asm/mmu_context.h>
 #include <asm/processor.h>
 
+#ifdef IPIPE_X86_FPU_EAGER
+extern void fpu__initialize(struct fpu *fpu);
+#endif
+
 static struct kmem_cache *xstate_cache;
 
 #ifdef IPIPE_X86_FPU_EAGER
@@ -472,7 +476,7 @@ void xnarch_leave_root(struct xnthread *root)
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)
 	/* restore current's fpregs */
 	__cpu_invalidate_fpregs_state();
-	switch_fpu_finish(&current->thread.fpu, smp_processor_id());
+	switch_fpu_finish(&current->thread.fpu);
 #else
 	/* mark current thread as not owning the FPU anymore */
 	if (fpregs_active())
Signature · 1 line
2.20.1
#1 lore raw

<no commit message>

When I'm asking questions on the code, there was a need for a commit message.

Quoted 11 lines · Fino Meng
---
  kernel/cobalt/arch/x86/thread.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
kernel/cobalt/arch/x86/thread.c +0 -0
index ba807ac1e..c33ad832f 100644

kernel/cobalt/arch/x86/thread.c line 30

Quoted 5 lines
kernel/cobalt/arch/x86/thread.c +2 -0
@@ -26,6 +26,10 @@
  #include <asm/mmu_context.h>
  #include <asm/processor.h>
 
+#ifdef IPIPE_X86_FPU_EAGER
+extern void fpu__initialize(struct fpu *fpu);

This will go along with ipipe for 5.4 patching that function to be non-static again, right?

kernel/cobalt/arch/x86/thread.c void xnarch_leave_root(struct xnthread *root) · line 479

Quoted 11 lines
kernel/cobalt/arch/x86/thread.c +3 -1
+#endif
+
  static struct kmem_cache *xstate_cache;
 
  #ifdef IPIPE_X86_FPU_EAGER
@@ -472,7 +476,7 @@ void xnarch_leave_root(struct xnthread *root)
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)
  	/* restore current's fpregs */
  	__cpu_invalidate_fpregs_state();
-	switch_fpu_finish(&current->thread.fpu, smp_processor_id());
+	switch_fpu_finish(&current->thread.fpu);

That is not correct for < 5.2 (5f409e20b794).

kernel/cobalt/arch/x86/thread.c void xnarch_leave_root(struct xnthread *root) · line 482

Quoted 4 lines
kernel/cobalt/arch/x86/thread.c +0 -0
  #else
  	/* mark current thread as not owning the FPU anymore */
  	if (fpregs_active())

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
author
#2 lore raw
Quoted 12 lines · Jan Kiszka

<no commit message>

When I'm asking questions on the code, there was a need for a commit message.

Quoted 6 lines · Fino Meng
---
  kernel/cobalt/arch/x86/thread.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
Quoted 12 lines

kernel/cobalt/arch/x86/thread.c line 29

Quoted 9 lines
kernel/cobalt/arch/x86/thread.c +2 -0
index ba807ac1e..c33ad832f 100644
@@ -26,6 +26,10 @@
  #include <asm/mmu_context.h>
  #include <asm/processor.h>
+#ifdef IPIPE_X86_FPU_EAGER
+extern void fpu__initialize(struct fpu *fpu);

This will go along with ipipe for 5.4 patching that function to be non-static again, right?

looks like should use "void fpstate_init(union fpregs_state *state)" to replace "void fpu__initialize(struct fpu *fpu)", the former is still a API in header file.

Quoted 4 lines
Quoted 4 lines
kernel/cobalt/arch/x86/thread.c +2 -0
+#endif
+
  static struct kmem_cache *xstate_cache;
  #ifdef IPIPE_X86_FPU_EAGER
Quoted 8 lines

kernel/cobalt/arch/x86/thread.c void xnarch_leave_root(struct xnthread *root) · line 479

Quoted 6 lines
kernel/cobalt/arch/x86/thread.c +1 -1
@@ -472,7 +476,7 @@ void xnarch_leave_root(struct xnthread *root)
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)
  	/* restore current's fpregs */
  	__cpu_invalidate_fpregs_state();
-	switch_fpu_finish(&current->thread.fpu, smp_processor_id());
+	switch_fpu_finish(&current->thread.fpu);

That is not correct for < 5.2 (5f409e20b794).

preparing V2 patches while fixing the smokey tests.

BR fino

Quoted 10 lines

kernel/cobalt/arch/x86/thread.c void xnarch_leave_root(struct xnthread *root) · line 482

Quoted 4 lines
kernel/cobalt/arch/x86/thread.c +0 -0
  #else
  	/* mark current thread as not owning the FPU anymore */
  	if (fpregs_active())

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux