| 1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 |
/* |
| 3 |
* Copyright (C) 2023 SiFive |
| 4 |
*/ |
| 5 |
|
| 6 |
#ifndef __ASM_FPU_H |
| 7 |
#define __ASM_FPU_H |
| 8 |
|
| 9 |
#include <linux/preempt.h> |
| 10 |
#include <asm/neon.h> |
| 11 |
|
| 12 |
#define kernel_fpu_available() cpu_has_neon() |
| 13 |
|
| 14 |
static inline void kernel_fpu_begin(void) |
| 15 |
{ |
| 16 |
BUG_ON(!in_task()); |
| 17 |
preempt_disable(); |
| 18 |
kernel_neon_begin(NULL); |
| 19 |
} |
| 20 |
|
| 21 |
static inline void kernel_fpu_end(void) |
| 22 |
{ |
| 23 |
kernel_neon_end(NULL); |
| 24 |
preempt_enable(); |
| 25 |
} |
| 26 |
|
| 27 |
#endif /* ! __ASM_FPU_H */ |