[PATCH 1/4] RISC-V: use bit-values instead of numbers to identify patched cpu-features

Conor Dooley conor at kernel.org
Sat Jan 14 09:54:27 PST 2023


On Fri, Jan 13, 2023 at 10:23:48PM +0100, Heiko Stuebner wrote:
> From: Heiko Stuebner <heiko.stuebner at vrull.eu>
> 
> RISC-V cpufeatures are often based on available extensions and maybe even
> some combination of them. Using a bitfield for the errata-id gives us a
> simple way to also require a combination of extensions for a specific
> alternative patch.
> 
> Signed-off-by: Heiko Stuebner <heiko.stuebner at vrull.eu>
> ---

> diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c
> index 7bfc6eb9a5cf..8c83bd9d0e22 100644
> --- a/arch/riscv/kernel/cpufeature.c
> +++ b/arch/riscv/kernel/cpufeature.c
> @@ -350,13 +350,13 @@ static u32 __init_or_module cpufeature_probe(unsigned int stage)
>  	u32 cpu_req_feature = 0;
>  
>  	if (cpufeature_probe_svpbmt(stage))
> -		cpu_req_feature |= BIT(CPUFEATURE_SVPBMT);
> +		cpu_req_feature |= CPUFEATURE_SVPBMT;
>  
>  	if (cpufeature_probe_zicbom(stage))
> -		cpu_req_feature |= BIT(CPUFEATURE_ZICBOM);
> +		cpu_req_feature |= CPUFEATURE_ZICBOM;

I know the behaviour isn't changing here, but using a bit per feature
seems like scarily few, especially if people come along with variants
they want for all the various dinky extensions that exit.
Probably gonna need an iteration on this stuff in the not-too-distant
future...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-riscv/attachments/20230114/3e979d3f/attachment.sig>


More information about the linux-riscv mailing list