git: b4efc6277634 - main - LinuxKPI: Do not use explicit context in FPU sections on powerpc64

From: Vladimir Kondratyev <wulf_at_FreeBSD.org>
Date: Sun, 24 Dec 2023 13:20:02 UTC
The branch main has been updated by wulf:

URL: https://cgit.FreeBSD.org/src/commit/?id=b4efc62776344a9aaada5a0866e453e528a0e977

commit b4efc62776344a9aaada5a0866e453e528a0e977
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2023-12-24 12:48:06 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2023-12-24 12:48:06 +0000

    LinuxKPI: Do not use explicit context in FPU sections on powerpc64
    
    It is not supported yet.
    
    Sponsored by:   Serenity Cyber Security, LLC
    Fixes:  5a3bd281672b ("LinuxKPI: Add explicit software context to FPU sections")
    MFC after:      1 week
---
 sys/compat/linuxkpi/common/include/linux/compat.h | 5 -----
 sys/compat/linuxkpi/common/src/linux_current.c    | 9 ++++++---
 sys/compat/linuxkpi/common/src/linux_fpu.c        | 3 ++-
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/compat.h b/sys/compat/linuxkpi/common/include/linux/compat.h
index 7922e884beb1..d357abce732b 100644
--- a/sys/compat/linuxkpi/common/include/linux/compat.h
+++ b/sys/compat/linuxkpi/common/include/linux/compat.h
@@ -33,11 +33,6 @@
 #include <sys/proc.h>
 #include <sys/malloc.h>
 
-#if defined(__aarch64__) || defined(__arm__) || defined(__amd64__) ||	\
-    defined(__i386__) || defined(__powerpc64__)
-#define	LKPI_HAVE_FPU_CTX
-#endif
-
 struct domainset;
 struct thread;
 struct task_struct;
diff --git a/sys/compat/linuxkpi/common/src/linux_current.c b/sys/compat/linuxkpi/common/src/linux_current.c
index 668185094cbe..04ad4e30aa54 100644
--- a/sys/compat/linuxkpi/common/src/linux_current.c
+++ b/sys/compat/linuxkpi/common/src/linux_current.c
@@ -43,7 +43,8 @@
 #include <sys/sysctl.h>
 #include <vm/uma.h>
 
-#ifdef LKPI_HAVE_FPU_CTX
+#if defined(__aarch64__) || defined(__arm__) || defined(__amd64__) ||	\
+    defined(__i386__)
 #include <machine/fpu.h>
 #endif
 
@@ -160,7 +161,8 @@ linux_alloc_current(struct thread *td, int flags)
 int
 linux_set_fpu_ctx(struct task_struct *task)
 {
-#ifdef LKPI_HAVE_FPU_CTX
+#if defined(__aarch64__) || defined(__arm__) || defined(__amd64__) ||	\
+    defined(__i386__)
 	if (task->fpu_ctx == NULL && curthread->td_critnest == 0)
 		task->fpu_ctx = fpu_kern_alloc_ctx(FPU_KERN_NOWAIT);
 #endif
@@ -190,7 +192,8 @@ void
 linux_free_current(struct task_struct *ts)
 {
 	mmput(ts->mm);
-#ifdef LKPI_HAVE_FPU_CTX
+#if defined(__aarch64__) || defined(__arm__) || defined(__amd64__) ||	\
+    defined(__i386__)
 	if (ts->fpu_ctx != NULL)
 		fpu_kern_free_ctx(ts->fpu_ctx);
 #endif
diff --git a/sys/compat/linuxkpi/common/src/linux_fpu.c b/sys/compat/linuxkpi/common/src/linux_fpu.c
index d510bc208b88..ef7f252cdd9e 100644
--- a/sys/compat/linuxkpi/common/src/linux_fpu.c
+++ b/sys/compat/linuxkpi/common/src/linux_fpu.c
@@ -35,7 +35,8 @@
 
 #include <asm/fpu/api.h>
 
-#ifdef LKPI_HAVE_FPU_CTX
+#if defined(__aarch64__) || defined(__arm__) || defined(__amd64__) ||	\
+    defined(__i386__) || defined(__powerpc64__)
 
 #include <machine/fpu.h>