[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220501030956.786012-1-starzhangzsd@gmail.com>
Date: Sun, 1 May 2022 11:09:56 +0800
From: Stephen Zhang <starzhangzsd@...il.com>
To: macro@...am.me.uk, tsbogend@...ha.franken.de,
liam.howlett@...cle.com, geert@...ux-m68k.org,
ebiederm@...ssion.com, dbueso@...e.de, alobakin@...me,
f.fainelli@...il.com, paul@...pouillou.net, linux@...ck-us.net,
anemo@....ocn.ne.jp
Cc: zhangshida@...inos.cn, starzhangzsd@...il.com,
linux-kernel@...r.kernel.org, linux-mips@...r.kernel.org
Subject: [PATCH v3] MIPS: adding a safety check for cpu_has_fpu
From: Shida Zhang <zhangshida@...inos.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@...am.me.uk>
Signed-off-by: Shida Zhang <zhangshida@...inos.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.
arch/mips/include/asm/cpu-features.h | 5 +++++
1 file changed, 5 insertions(+)
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)
--
2.30.2
Powered by blists - more mailing lists