Message ID | 20220501030956.786012-1-starzhangzsd@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [v3] MIPS: adding a safety check for cpu_has_fpu | expand |
On Sun, 1 May 2022, Stephen Zhang wrote: > diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h > index de8cb2ccb781..57ff0f8a507c 100644 > --- a/arch/mips/include/asm/cpu-features.h > +++ b/arch/mips/include/asm/cpu-features.h > @@ -134,6 +134,11 @@ > # endif > #else > # define raw_cpu_has_fpu cpu_has_fpu > +# ifndef CONFIG_MIPS_FP_SUPPORT > +# if cpu_has_fpu > +# error "Forcing `cpu_has_fpu' to non-zero is not supported" > +# endif > +# endif > #endif For this to work for `nofpu' the check has to be outside the conditional, possibly right below the comment we've been discussing. Maciej
diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h index de8cb2ccb781..57ff0f8a507c 100644 --- a/arch/mips/include/asm/cpu-features.h +++ b/arch/mips/include/asm/cpu-features.h @@ -134,6 +134,11 @@ # endif #else # define raw_cpu_has_fpu cpu_has_fpu +# ifndef CONFIG_MIPS_FP_SUPPORT +# if cpu_has_fpu +# error "Forcing `cpu_has_fpu' to non-zero is not supported" +# endif +# endif #endif #ifndef cpu_has_32fpr #define cpu_has_32fpr __isa_ge_or_opt(1, MIPS_CPU_32FPR)