xref: /linux/tools/testing/selftests/arm64/signal/sve_helpers.h (revision 3fd6c59042dbba50391e30862beac979491145fe)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) 2024 ARM Limited
4  *
5  * Common helper functions for SVE and SME functionality.
6  */
7 
8 #ifndef __SVE_HELPERS_H__
9 #define __SVE_HELPERS_H__
10 
11 #include <stdbool.h>
12 
13 #define VLS_USE_SVE	false
14 #define VLS_USE_SME	true
15 
16 extern unsigned int vls[];
17 extern unsigned int nvls;
18 
19 int sve_fill_vls(bool use_sme, int min_vls);
20 
get_svcr(void)21 static inline uint64_t get_svcr(void)
22 {
23 	uint64_t val;
24 
25 	asm volatile (
26 		"mrs	%0, S3_3_C4_C2_2\n"
27 		: "=r"(val)
28 		:
29 		: "cc");
30 
31 	return val;
32 }
33 
34 #endif
35