git: 7f1a7506cbf7 - main - Revert "LinuxKPI: Do not use explicit context in FPU sections on powerpc64"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 10 Feb 2024 22:03:21 UTC
The branch main has been updated by wulf:
URL: https://cgit.FreeBSD.org/src/commit/?id=7f1a7506cbf7f28698b50a5af56cdf4de9aaa8b0
commit 7f1a7506cbf7f28698b50a5af56cdf4de9aaa8b0
Author: Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2024-02-10 22:01:50 +0000
Commit: Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2024-02-10 22:01:50 +0000
Revert "LinuxKPI: Do not use explicit context in FPU sections on powerpc64"
kmalloc() support within FPU sections will be redone in other way.
This reverts commit b4efc62776344a9aaada5a0866e453e528a0e977.
Sponsored by: Serenity Cyber Security, LLC
Requested by: jhb
---
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, 9 insertions(+), 8 deletions(-)
diff --git a/sys/compat/linuxkpi/common/include/linux/compat.h b/sys/compat/linuxkpi/common/include/linux/compat.h
index d357abce732b..7922e884beb1 100644
--- a/sys/compat/linuxkpi/common/include/linux/compat.h
+++ b/sys/compat/linuxkpi/common/include/linux/compat.h
@@ -33,6 +33,11 @@
#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 64b5b8be4c6a..d269552c4ffa 100644
--- a/sys/compat/linuxkpi/common/src/linux_current.c
+++ b/sys/compat/linuxkpi/common/src/linux_current.c
@@ -43,8 +43,7 @@
#include <sys/sysctl.h>
#include <vm/uma.h>
-#if defined(__aarch64__) || defined(__arm__) || defined(__amd64__) || \
- defined(__i386__)
+#ifdef LKPI_HAVE_FPU_CTX
#include <machine/fpu.h>
#endif
@@ -161,8 +160,7 @@ linux_alloc_current(struct thread *td, int flags)
int
linux_set_fpu_ctx(struct task_struct *task)
{
-#if defined(__aarch64__) || defined(__arm__) || defined(__amd64__) || \
- defined(__i386__)
+#ifdef LKPI_HAVE_FPU_CTX
if (task->fpu_ctx == NULL && curthread->td_critnest == 0)
task->fpu_ctx = fpu_kern_alloc_ctx(FPU_KERN_NOWAIT);
#endif
@@ -192,8 +190,7 @@ void
linux_free_current(struct task_struct *ts)
{
mmput(ts->mm);
-#if defined(__aarch64__) || defined(__arm__) || defined(__amd64__) || \
- defined(__i386__)
+#ifdef LKPI_HAVE_FPU_CTX
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 ef7f252cdd9e..d510bc208b88 100644
--- a/sys/compat/linuxkpi/common/src/linux_fpu.c
+++ b/sys/compat/linuxkpi/common/src/linux_fpu.c
@@ -35,8 +35,7 @@
#include <asm/fpu/api.h>
-#if defined(__aarch64__) || defined(__arm__) || defined(__amd64__) || \
- defined(__i386__) || defined(__powerpc64__)
+#ifdef LKPI_HAVE_FPU_CTX
#include <machine/fpu.h>