summaryrefslogtreecommitdiffstats
path: root/arch/riscv/include/asm/hwcap.h
diff options
context:
space:
mode:
authorAtish Patra <atishp@rivosinc.com>2022-03-14 13:38:43 -0700
committerPalmer Dabbelt <palmer@rivosinc.com>2022-03-17 12:18:00 -0700
commit02d52fbd940af7d7fe0a523e99938113b2addd35 (patch)
treeb31a40200efc8cc7468c87d119cca05e389a6661 /arch/riscv/include/asm/hwcap.h
parent40a4d0dfbcf00c8534ab8724041705b3db6c5ce2 (diff)
downloadlinux-02d52fbd940af7d7fe0a523e99938113b2addd35.tar.bz2
RISC-V: Implement multi-letter ISA extension probing framework
Multi-letter extensions can be probed using exising riscv_isa_extension_available API now. It doesn't support versioning right now as there is no use case for it. Individual extension specific implementation will be added during each extension support. Tested-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Atish Patra <atishp@rivosinc.com> Reviewed-by: Anup Patel <anup@brainfault.org> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Diffstat (limited to 'arch/riscv/include/asm/hwcap.h')
-rw-r--r--arch/riscv/include/asm/hwcap.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h
index 5ce50468aff1..170bd80da520 100644
--- a/arch/riscv/include/asm/hwcap.h
+++ b/arch/riscv/include/asm/hwcap.h
@@ -34,7 +34,25 @@ extern unsigned long elf_hwcap;
#define RISCV_ISA_EXT_s ('s' - 'a')
#define RISCV_ISA_EXT_u ('u' - 'a')
+/*
+ * Increse this to higher value as kernel support more ISA extensions.
+ */
#define RISCV_ISA_EXT_MAX 64
+#define RISCV_ISA_EXT_NAME_LEN_MAX 32
+
+/* The base ID for multi-letter ISA extensions */
+#define RISCV_ISA_EXT_BASE 26
+
+/*
+ * This enum represent the logical ID for each multi-letter RISC-V ISA extension.
+ * The logical ID should start from RISCV_ISA_EXT_BASE and must not exceed
+ * RISCV_ISA_EXT_MAX. 0-25 range is reserved for single letter
+ * extensions while all the multi-letter extensions should define the next
+ * available logical extension id.
+ */
+enum riscv_isa_ext_id {
+ RISCV_ISA_EXT_ID_MAX = RISCV_ISA_EXT_MAX,
+};
unsigned long riscv_isa_extension_base(const unsigned long *isa_bitmap);