arch/riscv/kernel/cpufeature.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)
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>
---
arch/riscv/kernel/cpufeature.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c
index b057362f8fb5f92d9a608b223666831d769a805c..f5855af0453d5ce206f8c8201ad108dfe4d300fb 100644
--- a/arch/riscv/kernel/cpufeature.c
+++ b/arch/riscv/kernel/cpufeature.c
@@ -279,23 +279,22 @@ static const unsigned int riscv_a_exts[] = {
RISCV_ISA_EXT_ZALRSC,
};
+#define RISCV_ISA_EXT_ZKN \
+ RISCV_ISA_EXT_ZBKB, \
+ RISCV_ISA_EXT_ZBKC, \
+ RISCV_ISA_EXT_ZBKX, \
+ RISCV_ISA_EXT_ZKND, \
+ RISCV_ISA_EXT_ZKNE, \
+ RISCV_ISA_EXT_ZKNH
+
static const unsigned int riscv_zk_bundled_exts[] = {
- RISCV_ISA_EXT_ZBKB,
- RISCV_ISA_EXT_ZBKC,
- RISCV_ISA_EXT_ZBKX,
- RISCV_ISA_EXT_ZKND,
- RISCV_ISA_EXT_ZKNE,
+ RISCV_ISA_EXT_ZKN,
RISCV_ISA_EXT_ZKR,
- RISCV_ISA_EXT_ZKT,
+ RISCV_ISA_EXT_ZKT
};
static const unsigned int riscv_zkn_bundled_exts[] = {
- RISCV_ISA_EXT_ZBKB,
- RISCV_ISA_EXT_ZBKC,
- RISCV_ISA_EXT_ZBKX,
- RISCV_ISA_EXT_ZKND,
- RISCV_ISA_EXT_ZKNE,
- RISCV_ISA_EXT_ZKNH,
+ RISCV_ISA_EXT_ZKN
};
static const unsigned int riscv_zks_bundled_exts[] = {
---
base-commit: 9448598b22c50c8a5bb77a9103e2d49f134c9578
change-id: 20251223-zk-missing-zknh-262ffed774d2
Best regards,
--
Guodong Xu <guodong@riscstar.com>
On Tue, 23 Dec 2025, Guodong Xu wrote:
> 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>
Thanks, queued for v6.19-rc.
- Paul
On Tue, Dec 23, 2025 at 3:44 AM Guodong Xu <guodong@riscstar.com> wrote:
>
> 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>
> ---
> arch/riscv/kernel/cpufeature.c | 23 +++++++++++------------
> 1 file changed, 11 insertions(+), 12 deletions(-)
>
> diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c
> index b057362f8fb5f92d9a608b223666831d769a805c..f5855af0453d5ce206f8c8201ad108dfe4d300fb 100644
> --- a/arch/riscv/kernel/cpufeature.c
> +++ b/arch/riscv/kernel/cpufeature.c
> @@ -279,23 +279,22 @@ static const unsigned int riscv_a_exts[] = {
> RISCV_ISA_EXT_ZALRSC,
> };
>
> +#define RISCV_ISA_EXT_ZKN \
> + RISCV_ISA_EXT_ZBKB, \
> + RISCV_ISA_EXT_ZBKC, \
> + RISCV_ISA_EXT_ZBKX, \
> + RISCV_ISA_EXT_ZKND, \
> + RISCV_ISA_EXT_ZKNE, \
> + RISCV_ISA_EXT_ZKNH
> +
> static const unsigned int riscv_zk_bundled_exts[] = {
> - RISCV_ISA_EXT_ZBKB,
> - RISCV_ISA_EXT_ZBKC,
> - RISCV_ISA_EXT_ZBKX,
> - RISCV_ISA_EXT_ZKND,
> - RISCV_ISA_EXT_ZKNE,
> + RISCV_ISA_EXT_ZKN,
> RISCV_ISA_EXT_ZKR,
> - RISCV_ISA_EXT_ZKT,
> + RISCV_ISA_EXT_ZKT
> };
>
> static const unsigned int riscv_zkn_bundled_exts[] = {
> - RISCV_ISA_EXT_ZBKB,
> - RISCV_ISA_EXT_ZBKC,
> - RISCV_ISA_EXT_ZBKX,
> - RISCV_ISA_EXT_ZKND,
> - RISCV_ISA_EXT_ZKNE,
> - RISCV_ISA_EXT_ZKNH,
> + RISCV_ISA_EXT_ZKN
> };
>
> static const unsigned int riscv_zks_bundled_exts[] = {
>
> ---
> base-commit: 9448598b22c50c8a5bb77a9103e2d49f134c9578
> change-id: 20251223-zk-missing-zknh-262ffed774d2
>
> Best regards,
> --
> Guodong Xu <guodong@riscstar.com>
>
Hi Guodong,
Nice catch, looks good to me:
Reviewed-by: Clément Léger <cleger@rivosinc.com>
Thanks,
© 2016 - 2026 Red Hat, Inc.