1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Copyright (C) 2023 SiFive 4 */ 5 6 #ifndef _ASM_POWERPC_FPU_H 7 #define _ASM_POWERPC_FPU_H 8 9 #include <linux/preempt.h> 10 11 #include <asm/cpu_has_feature.h> 12 #include <asm/switch_to.h> 13 14 #define kernel_fpu_available() (!cpu_has_feature(CPU_FTR_FPU_UNAVAILABLE)) 15 16 static inline void kernel_fpu_begin(void) 17 { 18 preempt_disable(); 19 enable_kernel_fp(); 20 } 21 22 static inline void kernel_fpu_end(void) 23 { 24 disable_kernel_fp(); 25 preempt_enable(); 26 } 27 28 #endif /* ! _ASM_POWERPC_FPU_H */ 29