drm/panel-edp: Add BOE NV140FHM-NZ panel entry
[drm/drm-misc.git] / arch / riscv / kernel / kernel_mode_fpu.c
blob0ac8348876c499c492568c2fbf216cdd6b5ff51b
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright (C) 2023 SiFive
4 */
6 #include <linux/export.h>
7 #include <linux/preempt.h>
9 #include <asm/csr.h>
10 #include <asm/fpu.h>
11 #include <asm/processor.h>
12 #include <asm/switch_to.h>
14 void kernel_fpu_begin(void)
16 preempt_disable();
17 fstate_save(current, task_pt_regs(current));
18 csr_set(CSR_SSTATUS, SR_FS);
20 EXPORT_SYMBOL_GPL(kernel_fpu_begin);
22 void kernel_fpu_end(void)
24 csr_clear(CSR_SSTATUS, SR_FS);
25 fstate_restore(current, task_pt_regs(current));
26 preempt_enable();
28 EXPORT_SYMBOL_GPL(kernel_fpu_end);