forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/arch/arm64/kernel/entry-fpsimd.S
....@@ -1,20 +1,9 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * FP/SIMD state saving and restoring
34 *
45 * Copyright (C) 2012 ARM Ltd.
56 * Author: Catalin Marinas <catalin.marinas@arm.com>
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License version 2 as
9
- * published by the Free Software Foundation.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
187 */
198
209 #include <linux/linkage.h>
....@@ -27,34 +16,59 @@
2716 *
2817 * x0 - pointer to struct fpsimd_state
2918 */
30
-ENTRY(fpsimd_save_state)
19
+SYM_FUNC_START(fpsimd_save_state)
3120 fpsimd_save x0, 8
3221 ret
33
-ENDPROC(fpsimd_save_state)
22
+SYM_FUNC_END(fpsimd_save_state)
3423
3524 /*
3625 * Load the FP registers.
3726 *
3827 * x0 - pointer to struct fpsimd_state
3928 */
40
-ENTRY(fpsimd_load_state)
29
+SYM_FUNC_START(fpsimd_load_state)
4130 fpsimd_restore x0, 8
4231 ret
43
-ENDPROC(fpsimd_load_state)
32
+SYM_FUNC_END(fpsimd_load_state)
4433
4534 #ifdef CONFIG_ARM64_SVE
46
-ENTRY(sve_save_state)
35
+
36
+SYM_FUNC_START(sve_save_state)
4737 sve_save 0, x1, 2
4838 ret
49
-ENDPROC(sve_save_state)
39
+SYM_FUNC_END(sve_save_state)
5040
51
-ENTRY(sve_load_state)
41
+SYM_FUNC_START(sve_load_state)
5242 sve_load 0, x1, x2, 3, x4
5343 ret
54
-ENDPROC(sve_load_state)
44
+SYM_FUNC_END(sve_load_state)
5545
56
-ENTRY(sve_get_vl)
46
+SYM_FUNC_START(sve_get_vl)
5747 _sve_rdvl 0, 1
5848 ret
59
-ENDPROC(sve_get_vl)
49
+SYM_FUNC_END(sve_get_vl)
50
+
51
+/*
52
+ * Load SVE state from FPSIMD state.
53
+ *
54
+ * x0 = pointer to struct fpsimd_state
55
+ * x1 = VQ - 1
56
+ *
57
+ * Each SVE vector will be loaded with the first 128-bits taken from FPSIMD
58
+ * and the rest zeroed. All the other SVE registers will be zeroed.
59
+ */
60
+SYM_FUNC_START(sve_load_from_fpsimd_state)
61
+ sve_load_vq x1, x2, x3
62
+ fpsimd_restore x0, 8
63
+ _for n, 0, 15, _sve_pfalse \n
64
+ _sve_wrffr 0
65
+ ret
66
+SYM_FUNC_END(sve_load_from_fpsimd_state)
67
+
68
+/* Zero all SVE registers but the first 128-bits of each vector */
69
+SYM_FUNC_START(sve_flush_live)
70
+ sve_flush
71
+ ret
72
+SYM_FUNC_END(sve_flush_live)
73
+
6074 #endif /* CONFIG_ARM64_SVE */