Skip to content

Commit dac8bf1

Browse files
jones-drewpalmer-dabbelt
authored andcommitted
riscv: hwcap: Don't alphabetize ISA extension IDs
While the comment above the ISA extension ID definitions says "Entries are sorted alphabetically.", this stopped being good advice with commit d8a3d8a ("riscv: hwcap: make ISA extension ids can be used in asm"), as we now use macros instead of enums. Reshuffling defines is error-prone, so, since they don't need to be in any particular order, change the advice to just adding new extensions at the bottom. Also, take the opportunity to change spaces to tabs, merge three comments into one, and move the base and max defines into more logical locations wrt the ID definitions. Signed-off-by: Andrew Jones <[email protected]> Reviewed-by: Conor Dooley <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: [email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 1eac282 commit dac8bf1

File tree

1 file changed

+20
-22
lines changed

1 file changed

+20
-22
lines changed

arch/riscv/include/asm/hwcap.h

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,27 @@
2424
#define RISCV_ISA_EXT_u ('u' - 'a')
2525

2626
/*
27-
* Increse this to higher value as kernel support more ISA extensions.
28-
*/
29-
#define RISCV_ISA_EXT_MAX 64
30-
#define RISCV_ISA_EXT_NAME_LEN_MAX 32
31-
32-
/* The base ID for multi-letter ISA extensions */
33-
#define RISCV_ISA_EXT_BASE 26
34-
35-
/*
36-
* These macros represent the logical ID for each multi-letter RISC-V ISA extension.
37-
* The logical ID should start from RISCV_ISA_EXT_BASE and must not exceed
38-
* RISCV_ISA_EXT_MAX. 0-25 range is reserved for single letter
39-
* extensions while all the multi-letter extensions should define the next
40-
* available logical extension id.
41-
* Entries are sorted alphabetically.
27+
* These macros represent the logical IDs of each multi-letter RISC-V ISA
28+
* extension and are used in the ISA bitmap. The logical IDs start from
29+
* RISCV_ISA_EXT_BASE, which allows the 0-25 range to be reserved for single
30+
* letter extensions. The maximum, RISCV_ISA_EXT_MAX, is defined in order
31+
* to allocate the bitmap and may be increased when necessary.
32+
*
33+
* New extensions should just be added to the bottom, rather than added
34+
* alphabetically, in order to avoid unnecessary shuffling.
4235
*/
43-
#define RISCV_ISA_EXT_SSCOFPMF 26
44-
#define RISCV_ISA_EXT_SSTC 27
45-
#define RISCV_ISA_EXT_SVINVAL 28
46-
#define RISCV_ISA_EXT_SVPBMT 29
47-
#define RISCV_ISA_EXT_ZBB 30
48-
#define RISCV_ISA_EXT_ZICBOM 31
49-
#define RISCV_ISA_EXT_ZIHINTPAUSE 32
36+
#define RISCV_ISA_EXT_BASE 26
37+
38+
#define RISCV_ISA_EXT_SSCOFPMF 26
39+
#define RISCV_ISA_EXT_SSTC 27
40+
#define RISCV_ISA_EXT_SVINVAL 28
41+
#define RISCV_ISA_EXT_SVPBMT 29
42+
#define RISCV_ISA_EXT_ZBB 30
43+
#define RISCV_ISA_EXT_ZICBOM 31
44+
#define RISCV_ISA_EXT_ZIHINTPAUSE 32
45+
46+
#define RISCV_ISA_EXT_MAX 64
47+
#define RISCV_ISA_EXT_NAME_LEN_MAX 32
5048

5149
#ifndef __ASSEMBLY__
5250

0 commit comments

Comments
 (0)