[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CADGDLFiMAJzvySC0FjY1=aAn_XgGAQnhrLd0SWKaSAYcgYFc-Q@mail.gmail.com>
Date: Sun, 28 Dec 2025 15:08:50 +0100
From: Clément Léger <cleger@...osinc.com>
To: Guodong Xu <guodong@...cstar.com>
Cc: Paul Walmsley <pjw@...nel.org>, Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>, Alexandre Ghiti <alex@...ti.fr>,
Conor Dooley <conor.dooley@...rochip.com>, Evan Green <evan@...osinc.com>,
Palmer Dabbelt <palmer@...osinc.com>, linux-riscv@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] riscv: cpufeature: Fix Zk bundled extension missing Zknh
On Tue, Dec 23, 2025 at 3:44 AM Guodong Xu <guodong@...cstar.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@...cstar.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@...cstar.com>
>
Hi Guodong,
Nice catch, looks good to me:
Reviewed-by: Clément Léger <cleger@...osinc.com>
Thanks,
Powered by blists - more mailing lists