xref: /linux/arch/riscv/include/asm/hwcap.h (revision 20bed0d6ff62d985fe8222958825504b8aad4e88)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copied from arch/arm64/include/asm/hwcap.h
4  *
5  * Copyright (C) 2012 ARM Ltd.
6  * Copyright (C) 2017 SiFive
7  */
8 #ifndef _ASM_RISCV_HWCAP_H
9 #define _ASM_RISCV_HWCAP_H
10 
11 #include <uapi/asm/hwcap.h>
12 
13 #define RISCV_ISA_EXT_A		('a' - 'a')
14 #define RISCV_ISA_EXT_B		('b' - 'a')
15 #define RISCV_ISA_EXT_C		('c' - 'a')
16 #define RISCV_ISA_EXT_D		('d' - 'a')
17 #define RISCV_ISA_EXT_F		('f' - 'a')
18 #define RISCV_ISA_EXT_H		('h' - 'a')
19 #define RISCV_ISA_EXT_I		('i' - 'a')
20 #define RISCV_ISA_EXT_M		('m' - 'a')
21 #define RISCV_ISA_EXT_Q		('q' - 'a')
22 #define RISCV_ISA_EXT_V		('v' - 'a')
23 
24 /*
25  * These macros represent the logical IDs of each multi-letter RISC-V ISA
26  * extension and are used in the ISA bitmap. The logical IDs start from
27  * RISCV_ISA_EXT_BASE, which allows the 0-25 range to be reserved for single
28  * letter extensions. The maximum, RISCV_ISA_EXT_MAX, is defined in order
29  * to allocate the bitmap and may be increased when necessary.
30  *
31  * New extensions should just be added to the bottom, rather than added
32  * alphabetically, in order to avoid unnecessary shuffling.
33  */
34 #define RISCV_ISA_EXT_BASE		26
35 
36 #define RISCV_ISA_EXT_SSCOFPMF		26
37 #define RISCV_ISA_EXT_SSTC		27
38 #define RISCV_ISA_EXT_SVINVAL		28
39 #define RISCV_ISA_EXT_SVPBMT		29
40 #define RISCV_ISA_EXT_ZBB		30
41 #define RISCV_ISA_EXT_ZICBOM		31
42 #define RISCV_ISA_EXT_ZIHINTPAUSE	32
43 #define RISCV_ISA_EXT_SVNAPOT		33
44 #define RISCV_ISA_EXT_ZICBOZ		34
45 #define RISCV_ISA_EXT_SMAIA		35
46 #define RISCV_ISA_EXT_SSAIA		36
47 #define RISCV_ISA_EXT_ZBA		37
48 #define RISCV_ISA_EXT_ZBS		38
49 #define RISCV_ISA_EXT_ZICNTR		39
50 #define RISCV_ISA_EXT_ZICSR		40
51 #define RISCV_ISA_EXT_ZIFENCEI		41
52 #define RISCV_ISA_EXT_ZIHPM		42
53 #define RISCV_ISA_EXT_SMSTATEEN		43
54 #define RISCV_ISA_EXT_ZICOND		44
55 #define RISCV_ISA_EXT_ZBC		45
56 #define RISCV_ISA_EXT_ZBKB		46
57 #define RISCV_ISA_EXT_ZBKC		47
58 #define RISCV_ISA_EXT_ZBKX		48
59 #define RISCV_ISA_EXT_ZKND		49
60 #define RISCV_ISA_EXT_ZKNE		50
61 #define RISCV_ISA_EXT_ZKNH		51
62 #define RISCV_ISA_EXT_ZKR		52
63 #define RISCV_ISA_EXT_ZKSED		53
64 #define RISCV_ISA_EXT_ZKSH		54
65 #define RISCV_ISA_EXT_ZKT		55
66 #define RISCV_ISA_EXT_ZVBB		56
67 #define RISCV_ISA_EXT_ZVBC		57
68 #define RISCV_ISA_EXT_ZVKB		58
69 #define RISCV_ISA_EXT_ZVKG		59
70 #define RISCV_ISA_EXT_ZVKNED		60
71 #define RISCV_ISA_EXT_ZVKNHA		61
72 #define RISCV_ISA_EXT_ZVKNHB		62
73 #define RISCV_ISA_EXT_ZVKSED		63
74 #define RISCV_ISA_EXT_ZVKSH		64
75 #define RISCV_ISA_EXT_ZVKT		65
76 #define RISCV_ISA_EXT_ZFH		66
77 #define RISCV_ISA_EXT_ZFHMIN		67
78 #define RISCV_ISA_EXT_ZIHINTNTL		68
79 #define RISCV_ISA_EXT_ZVFH		69
80 #define RISCV_ISA_EXT_ZVFHMIN		70
81 #define RISCV_ISA_EXT_ZFA		71
82 #define RISCV_ISA_EXT_ZTSO		72
83 #define RISCV_ISA_EXT_ZACAS		73
84 #define RISCV_ISA_EXT_ZVE32X		74
85 #define RISCV_ISA_EXT_ZVE32F		75
86 #define RISCV_ISA_EXT_ZVE64X		76
87 #define RISCV_ISA_EXT_ZVE64F		77
88 #define RISCV_ISA_EXT_ZVE64D		78
89 #define RISCV_ISA_EXT_ZIMOP		79
90 #define RISCV_ISA_EXT_ZCA		80
91 #define RISCV_ISA_EXT_ZCB		81
92 #define RISCV_ISA_EXT_ZCD		82
93 #define RISCV_ISA_EXT_ZCF		83
94 #define RISCV_ISA_EXT_ZCMOP		84
95 #define RISCV_ISA_EXT_ZAWRS		85
96 #define RISCV_ISA_EXT_SVVPTC		86
97 #define RISCV_ISA_EXT_SMMPM		87
98 #define RISCV_ISA_EXT_SMNPM		88
99 #define RISCV_ISA_EXT_SSNPM		89
100 #define RISCV_ISA_EXT_ZABHA		90
101 #define RISCV_ISA_EXT_ZICCRSE		91
102 #define RISCV_ISA_EXT_SVADE		92
103 #define RISCV_ISA_EXT_SVADU		93
104 #define RISCV_ISA_EXT_ZFBFMIN		94
105 #define RISCV_ISA_EXT_ZVFBFMIN		95
106 #define RISCV_ISA_EXT_ZVFBFWMA		96
107 #define RISCV_ISA_EXT_ZAAMO		97
108 #define RISCV_ISA_EXT_ZALRSC		98
109 #define RISCV_ISA_EXT_ZICBOP		99
110 #define RISCV_ISA_EXT_SVRSW60T59B	100
111 #define RISCV_ISA_EXT_ZALASR		101
112 #define RISCV_ISA_EXT_ZILSD		102
113 #define RISCV_ISA_EXT_ZCLSD		103
114 #define RISCV_ISA_EXT_ZICFILP		104
115 #define RISCV_ISA_EXT_ZICFISS		105
116 #define RISCV_ISA_EXT_SSCSRIND		106
117 #define RISCV_ISA_EXT_SMCSRIND		107
118 #define RISCV_ISA_EXT_SMCNTRPMF		108
119 #define RISCV_ISA_EXT_SSCCFG		109
120 #define RISCV_ISA_EXT_SMCDELEG		110
121 #define RISCV_ISA_EXT_SSQOSID		111
122 #define RISCV_ISA_EXT_ZICCLSM		112
123 #define RISCV_ISA_EXT_ZICCAMOA		113
124 #define RISCV_ISA_EXT_ZICCIF		114
125 #define RISCV_ISA_EXT_ZA64RS		115
126 #define RISCV_ISA_EXT_ZIC64B		116
127 #define RISCV_ISA_EXT_SV48		117
128 #define RISCV_ISA_EXT_SV57		118
129 
130 #define RISCV_ISA_EXT_XLINUXENVCFG	127
131 
132 #define RISCV_ISA_EXT_MAX		128
133 #define RISCV_ISA_EXT_INVALID		U32_MAX
134 
135 #ifdef CONFIG_RISCV_M_MODE
136 #define RISCV_ISA_EXT_SxAIA		RISCV_ISA_EXT_SMAIA
137 #define RISCV_ISA_EXT_SUPM		RISCV_ISA_EXT_SMNPM
138 #define RISCV_ISA_EXT_SxCSRIND		RISCV_ISA_EXT_SMCSRIND
139 #else
140 #define RISCV_ISA_EXT_SxAIA		RISCV_ISA_EXT_SSAIA
141 #define RISCV_ISA_EXT_SUPM		RISCV_ISA_EXT_SSNPM
142 #define RISCV_ISA_EXT_SxCSRIND		RISCV_ISA_EXT_SSCSRIND
143 #endif
144 
145 #endif /* _ASM_RISCV_HWCAP_H */
146