* [PATCH v4] MIPS: adding a safety check for cpu_has_fpu
@ 2022-05-02 3:20 Stephen Zhang
2022-05-04 20:28 ` Thomas Bogendoerfer
0 siblings, 1 reply; 2+ messages in thread
From: Stephen Zhang @ 2022-05-02 3:20 UTC (permalink / raw)
To: macro, tsbogend, liam.howlett, geert, ebiederm, dbueso, alobakin,
f.fainelli, paul, linux, anemo
Cc: zhangshida, starzhangzsd, linux-kernel, linux-mips
From: Shida Zhang <zhangshida@kylinos.cn>
There is a chance 'cpu_has_fpu' would still be overridden when the
CONFIG_MIPS_FP_SUPPORT configuration option has been disabled. So
add a safety check for 'cpu_has_fpu'.
Suggested-by: Maciej W. Rozycki <macro@orcam.me.uk>
Signed-off-by: Shida Zhang <zhangshida@kylinos.cn>
---
Changelog in v1 -> v2:
- Choose to redefine cpu_has_fpu to solve the problem silently.
Changelog in v2 -> v3:
- Choose to point out the error instead.
Changelog in v3 -> v4:
- Make the check work for 'nofpu' option.
arch/mips/include/asm/cpu-features.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h
index de8cb2ccb781..c0983130a44c 100644
--- a/arch/mips/include/asm/cpu-features.h
+++ b/arch/mips/include/asm/cpu-features.h
@@ -133,6 +133,9 @@
# define raw_cpu_has_fpu 0
# endif
#else
+# if cpu_has_fpu
+# error "Forcing `cpu_has_fpu' to non-zero is not supported"
+# endif
# define raw_cpu_has_fpu cpu_has_fpu
#endif
#ifndef cpu_has_32fpr
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v4] MIPS: adding a safety check for cpu_has_fpu
2022-05-02 3:20 [PATCH v4] MIPS: adding a safety check for cpu_has_fpu Stephen Zhang
@ 2022-05-04 20:28 ` Thomas Bogendoerfer
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Bogendoerfer @ 2022-05-04 20:28 UTC (permalink / raw)
To: Stephen Zhang
Cc: macro, liam.howlett, geert, ebiederm, dbueso, alobakin,
f.fainelli, paul, linux, anemo, zhangshida, linux-kernel,
linux-mips
On Mon, May 02, 2022 at 11:20:02AM +0800, Stephen Zhang wrote:
> From: Shida Zhang <zhangshida@kylinos.cn>
>
> There is a chance 'cpu_has_fpu' would still be overridden when the
> CONFIG_MIPS_FP_SUPPORT configuration option has been disabled. So
> add a safety check for 'cpu_has_fpu'.
>
> Suggested-by: Maciej W. Rozycki <macro@orcam.me.uk>
> Signed-off-by: Shida Zhang <zhangshida@kylinos.cn>
> ---
> Changelog in v1 -> v2:
> - Choose to redefine cpu_has_fpu to solve the problem silently.
>
> Changelog in v2 -> v3:
> - Choose to point out the error instead.
>
> Changelog in v3 -> v4:
> - Make the check work for 'nofpu' option.
>
> arch/mips/include/asm/cpu-features.h | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h
> index de8cb2ccb781..c0983130a44c 100644
> --- a/arch/mips/include/asm/cpu-features.h
> +++ b/arch/mips/include/asm/cpu-features.h
> @@ -133,6 +133,9 @@
> # define raw_cpu_has_fpu 0
> # endif
> #else
> +# if cpu_has_fpu
> +# error "Forcing `cpu_has_fpu' to non-zero is not supported"
> +# endif
> # define raw_cpu_has_fpu cpu_has_fpu
> #endif
> #ifndef cpu_has_32fpr
> --
> 2.30.2
applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-05-04 20:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-02 3:20 [PATCH v4] MIPS: adding a safety check for cpu_has_fpu Stephen Zhang
2022-05-04 20:28 ` Thomas Bogendoerfer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).