Skip to content

Commit

Permalink
module: freebsd: fix aarch64 fpu handling
Browse files Browse the repository at this point in the history
Just like x86, aarch64 needs to use the fpu_kern(9) API around FPU
usage, otherwise we panic promptly at boot as soon as ZFS attempts to
do checksum benchmarking.

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
  • Loading branch information
kevans91 committed Apr 6, 2023
1 parent 6bab4bc commit bd049f3
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions include/os/freebsd/spl/sys/simd_aarch64.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,23 @@
#define _FREEBSD_SIMD_AARCH64_H

#include <sys/types.h>
#include <sys/ucontext.h>
#include <machine/elf.h>
#include <machine/fpu.h>
#include <machine/md_var.h>
#include <machine/pcb.h>

#define kfpu_allowed() 1
#define kfpu_initialize(tsk) do {} while (0)
#define kfpu_begin() do {} while (0)
#define kfpu_end() do {} while (0)
#define kfpu_begin() do { \
if (__predict_false(!is_fpu_kern_thread(0))) \
fpu_kern_enter(curthread, NULL, FPU_KERN_NOCTX); \
} while (0)

#define kfpu_end() do { \
if (__predict_false(curthread->td_pcb->pcb_fpflags & PCB_FP_NOSAVE)) \
fpu_kern_leave(curthread, NULL); \
} while (0)
#define kfpu_init() (0)
#define kfpu_fini() do {} while (0)

Expand Down

0 comments on commit bd049f3

Please sign in to comment.