Skip to content

Commit 913a112

Browse files
committed
simd_powerpc.h: enable FPU on FreeBSD
FreeBSD nowadays supports FPU in the kernel on powerpc*, so enable it. Including machine/pcpu.h needs to be done before including sys/types.h, hence this order. Signed-off-by: Piotr Kubaj <[email protected]>
1 parent dd2a46b commit 913a112

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

include/os/freebsd/spl/sys/simd_powerpc.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,26 @@
4444
#ifndef _FREEBSD_SIMD_POWERPC_H
4545
#define _FREEBSD_SIMD_POWERPC_H
4646

47+
#include <machine/pcpu.h>
48+
4749
#include <sys/types.h>
4850
#include <sys/cdefs.h>
4951

5052
#include <machine/pcb.h>
5153
#include <machine/cpu.h>
54+
#include <machine/fpu.h>
5255

53-
#define kfpu_allowed() 0
56+
#define kfpu_allowed() 1
5457
#define kfpu_initialize(tsk) do {} while (0)
55-
#define kfpu_begin() do {} while (0)
56-
#define kfpu_end() do {} while (0)
57-
#define kfpu_init() (0)
58+
#define kfpu_begin() { \
59+
if (__predict_false(!is_fpu_kern_thread(0))) \
60+
fpu_kern_enter(PCPU_GET(curthread), NULL, FPU_KERN_NOCTX);\
61+
}
62+
#define kfpu_end() { \
63+
if (__predict_false(PCPU_GET(curthread)->td_pcb->pcb_flags & \
64+
PCB_KERN_FPU_NOSAVE))\
65+
fpu_kern_leave(PCPU_GET(curthread), NULL); \
66+
}#define kfpu_init() (0)
5867
#define kfpu_fini() do {} while (0)
5968

6069
/*

0 commit comments

Comments
 (0)