2019-06-03 13:44:50 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2017-07-11 09:03:49 +08:00
|
|
|
/*
|
|
|
|
* Copied from arch/arm64/include/asm/hwcap.h
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 ARM Ltd.
|
|
|
|
* Copyright (C) 2017 SiFive
|
|
|
|
*/
|
2019-10-28 15:42:47 +08:00
|
|
|
#ifndef _ASM_RISCV_HWCAP_H
|
|
|
|
#define _ASM_RISCV_HWCAP_H
|
2017-07-11 09:03:49 +08:00
|
|
|
|
|
|
|
#include <uapi/asm/hwcap.h>
|
|
|
|
|
2020-04-24 12:59:27 +08:00
|
|
|
#define RISCV_ISA_EXT_a ('a' - 'a')
|
|
|
|
#define RISCV_ISA_EXT_c ('c' - 'a')
|
|
|
|
#define RISCV_ISA_EXT_d ('d' - 'a')
|
|
|
|
#define RISCV_ISA_EXT_f ('f' - 'a')
|
|
|
|
#define RISCV_ISA_EXT_h ('h' - 'a')
|
|
|
|
#define RISCV_ISA_EXT_i ('i' - 'a')
|
|
|
|
#define RISCV_ISA_EXT_m ('m' - 'a')
|
2023-07-13 20:11:04 +08:00
|
|
|
#define RISCV_ISA_EXT_q ('q' - 'a')
|
2023-06-05 19:06:59 +08:00
|
|
|
#define RISCV_ISA_EXT_v ('v' - 'a')
|
2020-04-24 12:59:27 +08:00
|
|
|
|
2022-03-15 04:38:43 +08:00
|
|
|
/*
|
2023-02-09 20:36:36 +08:00
|
|
|
* These macros represent the logical IDs of each multi-letter RISC-V ISA
|
|
|
|
* extension and are used in the ISA bitmap. The logical IDs start from
|
|
|
|
* RISCV_ISA_EXT_BASE, which allows the 0-25 range to be reserved for single
|
|
|
|
* letter extensions. The maximum, RISCV_ISA_EXT_MAX, is defined in order
|
|
|
|
* to allocate the bitmap and may be increased when necessary.
|
|
|
|
*
|
|
|
|
* New extensions should just be added to the bottom, rather than added
|
|
|
|
* alphabetically, in order to avoid unnecessary shuffling.
|
2022-03-15 04:38:43 +08:00
|
|
|
*/
|
2023-02-09 20:36:36 +08:00
|
|
|
#define RISCV_ISA_EXT_BASE 26
|
2022-03-15 04:38:43 +08:00
|
|
|
|
2023-02-09 20:36:36 +08:00
|
|
|
#define RISCV_ISA_EXT_SSCOFPMF 26
|
|
|
|
#define RISCV_ISA_EXT_SSTC 27
|
|
|
|
#define RISCV_ISA_EXT_SVINVAL 28
|
|
|
|
#define RISCV_ISA_EXT_SVPBMT 29
|
|
|
|
#define RISCV_ISA_EXT_ZBB 30
|
|
|
|
#define RISCV_ISA_EXT_ZICBOM 31
|
|
|
|
#define RISCV_ISA_EXT_ZIHINTPAUSE 32
|
2023-03-10 07:46:40 +08:00
|
|
|
#define RISCV_ISA_EXT_SVNAPOT 33
|
2023-03-15 22:11:08 +08:00
|
|
|
#define RISCV_ISA_EXT_ZICBOZ 34
|
2023-05-05 18:11:48 +08:00
|
|
|
#define RISCV_ISA_EXT_SMAIA 35
|
|
|
|
#define RISCV_ISA_EXT_SSAIA 36
|
2023-05-10 02:25:01 +08:00
|
|
|
#define RISCV_ISA_EXT_ZBA 37
|
|
|
|
#define RISCV_ISA_EXT_ZBS 38
|
2023-06-21 22:49:09 +08:00
|
|
|
#define RISCV_ISA_EXT_ZICNTR 39
|
|
|
|
#define RISCV_ISA_EXT_ZICSR 40
|
|
|
|
#define RISCV_ISA_EXT_ZIFENCEI 41
|
|
|
|
#define RISCV_ISA_EXT_ZIHPM 42
|
2023-09-14 00:38:59 +08:00
|
|
|
#define RISCV_ISA_EXT_SMSTATEEN 43
|
2023-09-15 16:39:44 +08:00
|
|
|
#define RISCV_ISA_EXT_ZICOND 44
|
2023-11-14 22:12:37 +08:00
|
|
|
#define RISCV_ISA_EXT_ZBC 45
|
riscv: add ISA extension parsing for scalar crypto
The Scalar Crypto specification defines Zk as a shorthand for the
Zkn, Zkr and Zkt extensions. The same follows for both Zkn, Zks and Zbk,
which are all shorthands for various other extensions. The detailed
breakdown can be found in their dt-binding entries.
Since Zkn also implies the Zbkb, Zbkc and Zbkx extensions, simply passing
"zk" through a DT should enable all of Zbkb, Zbkc, Zbkx, Zkn, Zkr and Zkt.
For example, setting the "riscv,isa" DT property to "rv64imafdc_zk"
should generate the following cpuinfo output:
"rv64imafdc_zicntr_zicsr_zifencei_zihpm_zbkb_zbkc_zbkx_zknd_zkne_zknh_zkr_zkt"
riscv_isa_ext_data grows a pair of new members, to permit setting the
relevant bits for "bundled" extensions, both while parsing the ISA string
and the new dedicated extension properties.
Co-developed-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Evan Green <evan@rivosinc.com>
Signed-off-by: Clément Léger <cleger@rivosinc.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20231114141256.126749-4-cleger@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2023-11-14 22:12:39 +08:00
|
|
|
#define RISCV_ISA_EXT_ZBKB 46
|
|
|
|
#define RISCV_ISA_EXT_ZBKC 47
|
|
|
|
#define RISCV_ISA_EXT_ZBKX 48
|
|
|
|
#define RISCV_ISA_EXT_ZKND 49
|
|
|
|
#define RISCV_ISA_EXT_ZKNE 50
|
|
|
|
#define RISCV_ISA_EXT_ZKNH 51
|
|
|
|
#define RISCV_ISA_EXT_ZKR 52
|
|
|
|
#define RISCV_ISA_EXT_ZKSED 53
|
|
|
|
#define RISCV_ISA_EXT_ZKSH 54
|
|
|
|
#define RISCV_ISA_EXT_ZKT 55
|
2023-11-14 22:12:42 +08:00
|
|
|
#define RISCV_ISA_EXT_ZVBB 56
|
|
|
|
#define RISCV_ISA_EXT_ZVBC 57
|
|
|
|
#define RISCV_ISA_EXT_ZVKB 58
|
|
|
|
#define RISCV_ISA_EXT_ZVKG 59
|
|
|
|
#define RISCV_ISA_EXT_ZVKNED 60
|
|
|
|
#define RISCV_ISA_EXT_ZVKNHA 61
|
|
|
|
#define RISCV_ISA_EXT_ZVKNHB 62
|
|
|
|
#define RISCV_ISA_EXT_ZVKSED 63
|
|
|
|
#define RISCV_ISA_EXT_ZVKSH 64
|
|
|
|
#define RISCV_ISA_EXT_ZVKT 65
|
2023-11-14 22:12:45 +08:00
|
|
|
#define RISCV_ISA_EXT_ZFH 66
|
|
|
|
#define RISCV_ISA_EXT_ZFHMIN 67
|
2023-11-14 22:12:48 +08:00
|
|
|
#define RISCV_ISA_EXT_ZIHINTNTL 68
|
2023-11-14 22:12:51 +08:00
|
|
|
#define RISCV_ISA_EXT_ZVFH 69
|
|
|
|
#define RISCV_ISA_EXT_ZVFHMIN 70
|
2023-11-14 22:12:54 +08:00
|
|
|
#define RISCV_ISA_EXT_ZFA 71
|
2023-12-20 23:57:17 +08:00
|
|
|
#define RISCV_ISA_EXT_ZTSO 72
|
2023-12-20 23:57:20 +08:00
|
|
|
#define RISCV_ISA_EXT_ZACAS 73
|
2024-07-20 00:15:18 +08:00
|
|
|
#define RISCV_ISA_EXT_ZVE32X 74
|
|
|
|
#define RISCV_ISA_EXT_ZVE32F 75
|
|
|
|
#define RISCV_ISA_EXT_ZVE64X 76
|
|
|
|
#define RISCV_ISA_EXT_ZVE64F 77
|
|
|
|
#define RISCV_ISA_EXT_ZVE64D 78
|
|
|
|
#define RISCV_ISA_EXT_ZIMOP 79
|
|
|
|
#define RISCV_ISA_EXT_ZCA 80
|
|
|
|
#define RISCV_ISA_EXT_ZCB 81
|
|
|
|
#define RISCV_ISA_EXT_ZCD 82
|
|
|
|
#define RISCV_ISA_EXT_ZCF 83
|
|
|
|
#define RISCV_ISA_EXT_ZCMOP 84
|
|
|
|
#define RISCV_ISA_EXT_ZAWRS 85
|
2024-09-16 11:16:12 +08:00
|
|
|
#define RISCV_ISA_EXT_SVVPTC 86
|
2022-03-15 04:38:43 +08:00
|
|
|
|
2024-02-28 14:55:34 +08:00
|
|
|
#define RISCV_ISA_EXT_XLINUXENVCFG 127
|
|
|
|
|
2023-11-14 22:12:42 +08:00
|
|
|
#define RISCV_ISA_EXT_MAX 128
|
riscv: add ISA extension parsing for scalar crypto
The Scalar Crypto specification defines Zk as a shorthand for the
Zkn, Zkr and Zkt extensions. The same follows for both Zkn, Zks and Zbk,
which are all shorthands for various other extensions. The detailed
breakdown can be found in their dt-binding entries.
Since Zkn also implies the Zbkb, Zbkc and Zbkx extensions, simply passing
"zk" through a DT should enable all of Zbkb, Zbkc, Zbkx, Zkn, Zkr and Zkt.
For example, setting the "riscv,isa" DT property to "rv64imafdc_zk"
should generate the following cpuinfo output:
"rv64imafdc_zicntr_zicsr_zifencei_zihpm_zbkb_zbkc_zbkx_zknd_zkne_zknh_zkr_zkt"
riscv_isa_ext_data grows a pair of new members, to permit setting the
relevant bits for "bundled" extensions, both while parsing the ISA string
and the new dedicated extension properties.
Co-developed-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Evan Green <evan@rivosinc.com>
Signed-off-by: Clément Léger <cleger@rivosinc.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20231114141256.126749-4-cleger@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2023-11-14 22:12:39 +08:00
|
|
|
#define RISCV_ISA_EXT_INVALID U32_MAX
|
2020-04-24 12:59:27 +08:00
|
|
|
|
2023-01-10 19:14:25 +08:00
|
|
|
#ifdef CONFIG_RISCV_M_MODE
|
|
|
|
#define RISCV_ISA_EXT_SxAIA RISCV_ISA_EXT_SMAIA
|
|
|
|
#else
|
|
|
|
#define RISCV_ISA_EXT_SxAIA RISCV_ISA_EXT_SSAIA
|
|
|
|
#endif
|
|
|
|
|
2019-10-28 15:42:47 +08:00
|
|
|
#endif /* _ASM_RISCV_HWCAP_H */
|