Skip to content

Commit 8632180

Browse files
docularxuPaul Walmsley
authored andcommitted
riscv: cpufeature: Fix Zk bundled extension missing Zknh
The Zk extension is a bundle consisting of Zkn, Zkr, and Zkt. The Zkn extension itself is a bundle consisting of Zbkb, Zbkc, Zbkx, Zknd, Zkne, and Zknh. The current implementation of riscv_zk_bundled_exts manually listed the dependencies but missed RISCV_ISA_EXT_ZKNH. Fix this by introducing a RISCV_ISA_EXT_ZKN macro that lists the Zkn components and using it in both riscv_zk_bundled_exts and riscv_zkn_bundled_exts. This adds the missing Zknh extension to Zk and reduces code duplication. Fixes: 0d8295e ("riscv: add ISA extension parsing for scalar crypto") Link: https://patch.msgid.link/20231114141256.126749-4-cleger@rivosinc.com/ Signed-off-by: Guodong Xu <guodong@riscstar.com> Reviewed-by: Clément Léger <cleger@rivosinc.com> Link: https://patch.msgid.link/20251223-zk-missing-zknh-v1-1-b627c990ee1a@riscstar.com Signed-off-by: Paul Walmsley <pjw@kernel.org>
1 parent 641ecc8 commit 8632180

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

arch/riscv/kernel/cpufeature.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -301,23 +301,22 @@ static const unsigned int riscv_a_exts[] = {
301301
RISCV_ISA_EXT_ZALRSC,
302302
};
303303

304+
#define RISCV_ISA_EXT_ZKN \
305+
RISCV_ISA_EXT_ZBKB, \
306+
RISCV_ISA_EXT_ZBKC, \
307+
RISCV_ISA_EXT_ZBKX, \
308+
RISCV_ISA_EXT_ZKND, \
309+
RISCV_ISA_EXT_ZKNE, \
310+
RISCV_ISA_EXT_ZKNH
311+
304312
static const unsigned int riscv_zk_bundled_exts[] = {
305-
RISCV_ISA_EXT_ZBKB,
306-
RISCV_ISA_EXT_ZBKC,
307-
RISCV_ISA_EXT_ZBKX,
308-
RISCV_ISA_EXT_ZKND,
309-
RISCV_ISA_EXT_ZKNE,
313+
RISCV_ISA_EXT_ZKN,
310314
RISCV_ISA_EXT_ZKR,
311-
RISCV_ISA_EXT_ZKT,
315+
RISCV_ISA_EXT_ZKT
312316
};
313317

314318
static const unsigned int riscv_zkn_bundled_exts[] = {
315-
RISCV_ISA_EXT_ZBKB,
316-
RISCV_ISA_EXT_ZBKC,
317-
RISCV_ISA_EXT_ZBKX,
318-
RISCV_ISA_EXT_ZKND,
319-
RISCV_ISA_EXT_ZKNE,
320-
RISCV_ISA_EXT_ZKNH,
319+
RISCV_ISA_EXT_ZKN
321320
};
322321

323322
static const unsigned int riscv_zks_bundled_exts[] = {

0 commit comments

Comments
 (0)