diff --git a/sys/compat/linuxkpi/common/include/asm/fpu/api.h b/sys/compat/linuxkpi/common/include/asm/fpu/api.h --- a/sys/compat/linuxkpi/common/include/asm/fpu/api.h +++ b/sys/compat/linuxkpi/common/include/asm/fpu/api.h @@ -32,14 +32,16 @@ #include -extern struct fpu_kern_ctx *__lkpi_fpu_ctx; +/* Technically the Linux API isn't supposed to allow nesting sections either, + * but currently used versions of GPU drivers rely on nesting working, + * so we only enter the section on the outermost level. */ extern unsigned int __lkpi_fpu_ctx_level; static inline void kernel_fpu_begin() { if (__lkpi_fpu_ctx_level++ == 0) { - fpu_kern_enter(curthread, __lkpi_fpu_ctx, FPU_KERN_NORMAL); + fpu_kern_enter(curthread, NULL, FPU_KERN_NOCTX); } } @@ -47,7 +49,7 @@ kernel_fpu_end() { if (--__lkpi_fpu_ctx_level == 0) { - fpu_kern_leave(curthread, __lkpi_fpu_ctx); + fpu_kern_leave(curthread, NULL); } } diff --git a/sys/compat/linuxkpi/common/src/linux_fpu.c b/sys/compat/linuxkpi/common/src/linux_fpu.c --- a/sys/compat/linuxkpi/common/src/linux_fpu.c +++ b/sys/compat/linuxkpi/common/src/linux_fpu.c @@ -25,26 +25,4 @@ * SUCH DAMAGE. */ -#include -#include -#include -#include - -#include - -struct fpu_kern_ctx *__lkpi_fpu_ctx; unsigned int __lkpi_fpu_ctx_level = 0; - -static void -linux_fpu_init(void *arg __unused) -{ - __lkpi_fpu_ctx = fpu_kern_alloc_ctx(0); -} -SYSINIT(linux_fpu, SI_SUB_EVENTHANDLER, SI_ORDER_SECOND, linux_fpu_init, NULL); - -static void -linux_fpu_uninit(void *arg __unused) -{ - fpu_kern_free_ctx(__lkpi_fpu_ctx); -} -SYSUNINIT(linux_fpu, SI_SUB_EVENTHANDLER, SI_ORDER_SECOND, linux_fpu_uninit, NULL);