[PATCH V2 3/5] raid6: riscv: Add a compiler error

Alexandre Ghiti alex at ghiti.fr
Wed Jul 16 06:43:55 PDT 2025


First, the patch title should be something like:

"raid6: riscv: Prevent compiler with vector support to build already 
vectorized code"

Or something similar.

On 7/11/25 12:09, Chunyan Zhang wrote:
> The code like "u8 **dptr = (u8 **)ptrs" just won't work when built with


Why wouldn't this code ^ work?

I guess preventing the compiler to vectorize the code is to avoid the 
inline assembly code to break what the compiler could have vectorized no?


> a compiler that can use vector instructions. So add an error for that.
>
> Signed-off-by: Chunyan Zhang <zhangchunyan at iscas.ac.cn>
> ---
>   lib/raid6/rvv.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/lib/raid6/rvv.c b/lib/raid6/rvv.c
> index 89da5fc247aa..015f3ee4da25 100644
> --- a/lib/raid6/rvv.c
> +++ b/lib/raid6/rvv.c
> @@ -20,6 +20,10 @@ static int rvv_has_vector(void)
>   	return has_vector();
>   }
>   
> +#ifdef __riscv_vector
> +#error "This code must be built without compiler support for vector"
> +#endif
> +
>   static void raid6_rvv1_gen_syndrome_real(int disks, unsigned long bytes, void **ptrs)
>   {
>   	u8 **dptr = (u8 **)ptrs;



More information about the linux-riscv mailing list