Re: [PATCH -fixes 2/2] riscv: Save/restore envcfg CSR during CPU suspend

From: Conor Dooley
Date: Mon Feb 12 2024 - 03:03:26 EST


On Sun, Feb 11, 2024 at 06:26:15PM -0800, Samuel Holland wrote:
> The value of the [ms]envcfg CSR is lost when entering a nonretentive
> idle state, so the CSR must be rewritten when resuming the CPU.
>
> Because the [ms]envcfg CSR is part of the base RISC-V privileged ISA
> specification, it cannot be detected from the ISA string. However, most
> existing hardware is too old to implement this CSR. As a result, it must
> be probed at runtime.
>
> Extend the logic for the Zicsr ISA extension to probe for the presence
> of specific CSRs. Since the CSR number is encoded as an immediate value
> within the csrr instruction, a switch case is necessary for any CSR that
> must be probed this way. Use the exception table to handle the illegal
> instruction exception raised when the CSR is not implemented.
>
> Cc: stable@xxxxxxxxxx
> Fixes: 43c16d51a19b ("RISC-V: Enable cbo.zero in usermode")
> Signed-off-by: Samuel Holland <samuel.holland@xxxxxxxxxx>

On nommu:

/build/tmp.RcQwFfgWA4/arch/riscv/kernel/cpufeature.c:967:21: error: expected ':' or ')' before '_ASM_EXTABLE'
/build/tmp.RcQwFfgWA4/arch/riscv/kernel/cpufeature.c:967:34: error: invalid suffix "b" on integer constant
/build/tmp.RcQwFfgWA4/arch/riscv/kernel/cpufeature.c:967:38: error: invalid suffix "b" on integer constant

https://patchwork.kernel.org/project/linux-riscv/patch/20240212022642.1968739-2-samuel.holland@xxxxxxxxxx/

Cheers,
Conor.

Attachment: signature.asc
Description: PGP signature