Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 0d8295ed975b ("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>

authored by

Guodong Xu and committed by
Paul Walmsley
8632180d 641ecc89

+11 -12
+11 -12
arch/riscv/kernel/cpufeature.c
··· 301 301 RISCV_ISA_EXT_ZALRSC, 302 302 }; 303 303 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 + 304 312 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, 310 314 RISCV_ISA_EXT_ZKR, 311 - RISCV_ISA_EXT_ZKT, 315 + RISCV_ISA_EXT_ZKT 312 316 }; 313 317 314 318 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 321 320 }; 322 321 323 322 static const unsigned int riscv_zks_bundled_exts[] = {