Skip to content

Commit 3f0cbfb

Browse files
wpcwzyPaul Walmsley
authored andcommitted
riscv: add ISA extension parsing for Zilsd and Zclsd
Add parsing for Zilsd and Zclsd ISA extensions which were ratified in commit f88abf1 ("Integrating load/store pair for RV32 with the main manual") of the riscv-isa-manual. Signed-off-by: Pincheng Wang <pincheng.plct@isrc.iscas.ac.cn> Reviewed-by: Nutty Liu <nutty.liu@hotmail.com> Link: https://patch.msgid.link/20250826162939.1494021-3-pincheng.plct@isrc.iscas.ac.cn [pjw@kernel.org: cleaned up checkpatch issues, whitespace; updated to apply] Signed-off-by: Paul Walmsley <pjw@kernel.org>
1 parent 4115155 commit 3f0cbfb

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

arch/riscv/include/asm/hwcap.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@
108108
#define RISCV_ISA_EXT_ZICBOP 99
109109
#define RISCV_ISA_EXT_SVRSW60T59B 100
110110
#define RISCV_ISA_EXT_ZALASR 101
111+
#define RISCV_ISA_EXT_ZILSD 102
112+
#define RISCV_ISA_EXT_ZCLSD 103
111113

112114
#define RISCV_ISA_EXT_XLINUXENVCFG 127
113115

arch/riscv/kernel/cpufeature.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,28 @@ static int riscv_ext_zcf_validate(const struct riscv_isa_ext_data *data,
242242
return -EPROBE_DEFER;
243243
}
244244

245+
static int riscv_ext_zilsd_validate(const struct riscv_isa_ext_data *data,
246+
const unsigned long *isa_bitmap)
247+
{
248+
if (IS_ENABLED(CONFIG_64BIT))
249+
return -EINVAL;
250+
251+
return 0;
252+
}
253+
254+
static int riscv_ext_zclsd_validate(const struct riscv_isa_ext_data *data,
255+
const unsigned long *isa_bitmap)
256+
{
257+
if (IS_ENABLED(CONFIG_64BIT))
258+
return -EINVAL;
259+
260+
if (__riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_ZILSD) &&
261+
__riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_ZCA))
262+
return 0;
263+
264+
return -EPROBE_DEFER;
265+
}
266+
245267
static int riscv_vector_f_validate(const struct riscv_isa_ext_data *data,
246268
const unsigned long *isa_bitmap)
247269
{
@@ -484,6 +506,8 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = {
484506
__RISCV_ISA_EXT_DATA_VALIDATE(zcd, RISCV_ISA_EXT_ZCD, riscv_ext_zcd_validate),
485507
__RISCV_ISA_EXT_DATA_VALIDATE(zcf, RISCV_ISA_EXT_ZCF, riscv_ext_zcf_validate),
486508
__RISCV_ISA_EXT_DATA_VALIDATE(zcmop, RISCV_ISA_EXT_ZCMOP, riscv_ext_zca_depends),
509+
__RISCV_ISA_EXT_DATA_VALIDATE(zclsd, RISCV_ISA_EXT_ZCLSD, riscv_ext_zclsd_validate),
510+
__RISCV_ISA_EXT_DATA_VALIDATE(zilsd, RISCV_ISA_EXT_ZILSD, riscv_ext_zilsd_validate),
487511
__RISCV_ISA_EXT_DATA(zba, RISCV_ISA_EXT_ZBA),
488512
__RISCV_ISA_EXT_DATA(zbb, RISCV_ISA_EXT_ZBB),
489513
__RISCV_ISA_EXT_DATA(zbc, RISCV_ISA_EXT_ZBC),

0 commit comments

Comments
 (0)