Linux-MIPS Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2] MIPS: Provide Kconfig option for default IEEE 754 conformance mode
@ 2020-08-01  6:11 Jiaxun Yang
  2020-08-05 13:59 ` Jiaxun Yang
  2020-08-07 15:59 ` Zhou Yanjie
  0 siblings, 2 replies; 6+ messages in thread
From: Jiaxun Yang @ 2020-08-01  6:11 UTC (permalink / raw)
  To: linux-mips
  Cc: Jiaxun Yang, WANG Xuerui, Serge Semin, Huacai Chen,
	Thomas Bogendoerfer, Paul Burton, Serge Semin, Zhou Yanjie,
	周琰杰 (Zhou Yanjie),
	Liangliang Huang, linux-kernel

Requested by downstream distros, a Kconfig option for default
IEEE 754 conformance mode allows them to set their mode to
relaxed by default.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
Reviewed-by: Huacai Chen <chenhc@lemote.com>

--
v2: Reword according to Xuerui's suggestion.
---
 arch/mips/Kconfig            | 22 ++++++++++++++++++++++
 arch/mips/kernel/cpu-probe.c | 12 +++++++++++-
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index eaf7519e3033..ac35df2b9133 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2899,6 +2899,28 @@ config MIPS_NR_CPU_NR_MAP
 	default 1024 if MIPS_NR_CPU_NR_MAP_1024
 	default NR_CPUS if !MIPS_NR_CPU_NR_MAP_1024
 
+choice
+	prompt "Default IEEE 754 conformance mode"
+	default IEEE754_DEFAULT_STRICT
+	help
+	  Sets the default IEEE 754 conformance mode, same as overriding the
+	  default value for the ieee754= kernel parameter. See the kernel
+	  parameter for details.
+
+	config IEEE754_DEFAULT_STRICT
+		bool "Strict"
+
+	config IEEE754_DEFAULT_LEGACY
+		bool "Legacy"
+
+	config IEEE754_DEFAULT_STD2008
+		bool "2008"
+
+	config IEEE754_DEFAULT_RELAXED
+		bool "Relaxed"
+
+endchoice
+
 #
 # Timer Interrupt Frequency Configuration
 #
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index c231c1b67889..a5b8fe019afc 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -157,7 +157,17 @@ static void cpu_set_fpu_2008(struct cpuinfo_mips *c)
  * IEEE 754 conformance mode to use.  Affects the NaN encoding and the
  * ABS.fmt/NEG.fmt execution mode.
  */
-static enum { STRICT, LEGACY, STD2008, RELAXED } ieee754 = STRICT;
+enum ieee754_mode { STRICT, LEGACY, STD2008, RELAXED };
+
+#if defined(CONFIG_IEEE754_DEFAULT_STRICT)
+static enum ieee754_mode ieee754 = STRICT;
+#elif defined(CONFIG_IEEE754_DEFAULT_LEGACY)
+static enum ieee754_mode ieee754 = LEGACY;
+#elif defined(CONFIG_IEEE754_DEFAULT_STD2008)
+static enum ieee754_mode ieee754 = STD2008;
+#elif defined(CONFIG_IEEE754_DEFAULT_RELAXED)
+static enum ieee754_mode ieee754 = RELAXED;
+#endif
 
 /*
  * Set the IEEE 754 NaN encodings and the ABS.fmt/NEG.fmt execution modes
-- 
2.28.0.rc1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] MIPS: Provide Kconfig option for default IEEE 754 conformance mode
  2020-08-01  6:11 [PATCH v2] MIPS: Provide Kconfig option for default IEEE 754 conformance mode Jiaxun Yang
@ 2020-08-05 13:59 ` Jiaxun Yang
  2020-08-06  8:16   ` Thomas Bogendoerfer
  2020-08-06 10:26   ` WANG Xuerui
  2020-08-07 15:59 ` Zhou Yanjie
  1 sibling, 2 replies; 6+ messages in thread
From: Jiaxun Yang @ 2020-08-05 13:59 UTC (permalink / raw)
  To: Thomas Bogendoerfer
  Cc: WANG Xuerui, Serge Semin, Huacai Chen, Zhou Yanjie,
	Liangliang Huang, linux-kernel, linux-mips



在 2020/8/1 14:11, Jiaxun Yang 写道:
> Requested by downstream distros, a Kconfig option for default
> IEEE 754 conformance mode allows them to set their mode to
> relaxed by default.
>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> Reviewed-by: WANG Xuerui <git@xen0n.name>
> Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
> Reviewed-by: Huacai Chen <chenhc@lemote.com>
>
> --
> v2: Reword according to Xuerui's suggestion.
> ---
Hi Thomas,

Is it possible to get this patch into 5.9 merge window?
I think it have got enough review tag, and the config option was requested
by a Debian developer. The next Debian release will take 5.9 lts kernel and
they don't want to ship a non-bootable kernel in a major release.

Thanks.

- Jiaxun

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] MIPS: Provide Kconfig option for default IEEE 754 conformance mode
  2020-08-05 13:59 ` Jiaxun Yang
@ 2020-08-06  8:16   ` Thomas Bogendoerfer
  2020-08-06 10:26   ` WANG Xuerui
  1 sibling, 0 replies; 6+ messages in thread
From: Thomas Bogendoerfer @ 2020-08-06  8:16 UTC (permalink / raw)
  To: Jiaxun Yang
  Cc: WANG Xuerui, Serge Semin, Huacai Chen, Zhou Yanjie,
	Liangliang Huang, linux-kernel, linux-mips

On Wed, Aug 05, 2020 at 09:59:15PM +0800, Jiaxun Yang wrote:
> 
> 
> 在 2020/8/1 14:11, Jiaxun Yang 写道:
> >Requested by downstream distros, a Kconfig option for default
> >IEEE 754 conformance mode allows them to set their mode to
> >relaxed by default.
> >
> >Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> >Reviewed-by: WANG Xuerui <git@xen0n.name>
> >Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
> >Reviewed-by: Huacai Chen <chenhc@lemote.com>
> >
> >--
> >v2: Reword according to Xuerui's suggestion.
> >---
> Hi Thomas,
> 
> Is it possible to get this patch into 5.9 merge window?
> I think it have got enough review tag, and the config option was requested
> by a Debian developer. The next Debian release will take 5.9 lts kernel and
> they don't want to ship a non-bootable kernel in a major release.

no I won't include it into 5.9, I need to first go through links pointed
to by Maciej and fully understand what a proper solution could be.

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] 6+ messages in thread

* Re: [PATCH v2] MIPS: Provide Kconfig option for default IEEE 754 conformance mode
  2020-08-05 13:59 ` Jiaxun Yang
  2020-08-06  8:16   ` Thomas Bogendoerfer
@ 2020-08-06 10:26   ` WANG Xuerui
  2020-08-07  2:07     ` Huacai Chen
  1 sibling, 1 reply; 6+ messages in thread
From: WANG Xuerui @ 2020-08-06 10:26 UTC (permalink / raw)
  To: Jiaxun Yang, Thomas Bogendoerfer
  Cc: WANG Xuerui, Serge Semin, Huacai Chen, Zhou Yanjie,
	Liangliang Huang, linux-kernel, linux-mips

Hi Jiaxun,


On 2020/8/5 21:59, Jiaxun Yang wrote:
>
>
> 在 2020/8/1 14:11, Jiaxun Yang 写道:
>> Requested by downstream distros, a Kconfig option for default
>> IEEE 754 conformance mode allows them to set their mode to
>> relaxed by default.
>>
>> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
>> Reviewed-by: WANG Xuerui <git@xen0n.name>
>> Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
>> Reviewed-by: Huacai Chen <chenhc@lemote.com>
>>
>> -- 
>> v2: Reword according to Xuerui's suggestion.
>> ---
> Hi Thomas,
>
> Is it possible to get this patch into 5.9 merge window?
> I think it have got enough review tag, and the config option was
> requested
> by a Debian developer. The next Debian release will take 5.9 lts
> kernel and
> they don't want to ship a non-bootable kernel in a major release.

I have an idea. Can the downstream packagers make use of the builtin
command line config options, to inject the "ieee754=relaxed" or whatever
option necessary? If it is acceptable this patch should not be necessary
in the short term.

>
> Thanks.
>
> - Jiaxun

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] MIPS: Provide Kconfig option for default IEEE 754 conformance mode
  2020-08-06 10:26   ` WANG Xuerui
@ 2020-08-07  2:07     ` Huacai Chen
  0 siblings, 0 replies; 6+ messages in thread
From: Huacai Chen @ 2020-08-07  2:07 UTC (permalink / raw)
  To: WANG Xuerui
  Cc: Jiaxun Yang, Thomas Bogendoerfer, WANG Xuerui, Serge Semin,
	Zhou Yanjie, Liangliang Huang, LKML, open list:MIPS

Hi, Xuerui,

On Thu, Aug 6, 2020 at 6:54 PM WANG Xuerui <kernel@xen0n.name> wrote:
>
> Hi Jiaxun,
>
>
> On 2020/8/5 21:59, Jiaxun Yang wrote:
> >
> >
> > 在 2020/8/1 14:11, Jiaxun Yang 写道:
> >> Requested by downstream distros, a Kconfig option for default
> >> IEEE 754 conformance mode allows them to set their mode to
> >> relaxed by default.
> >>
> >> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> >> Reviewed-by: WANG Xuerui <git@xen0n.name>
> >> Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
> >> Reviewed-by: Huacai Chen <chenhc@lemote.com>
> >>
> >> --
> >> v2: Reword according to Xuerui's suggestion.
> >> ---
> > Hi Thomas,
> >
> > Is it possible to get this patch into 5.9 merge window?
> > I think it have got enough review tag, and the config option was
> > requested
> > by a Debian developer. The next Debian release will take 5.9 lts
> > kernel and
> > they don't want to ship a non-bootable kernel in a major release.
>
> I have an idea. Can the downstream packagers make use of the builtin
> command line config options, to inject the "ieee754=relaxed" or whatever
> option necessary? If it is acceptable this patch should not be necessary
> in the short term.
Built-in "ieee754=relaxed" is already in upstream for Loongson-3.

Huacai
>
> >
> > Thanks.
> >
> > - Jiaxun

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] MIPS: Provide Kconfig option for default IEEE 754 conformance mode
  2020-08-01  6:11 [PATCH v2] MIPS: Provide Kconfig option for default IEEE 754 conformance mode Jiaxun Yang
  2020-08-05 13:59 ` Jiaxun Yang
@ 2020-08-07 15:59 ` Zhou Yanjie
  1 sibling, 0 replies; 6+ messages in thread
From: Zhou Yanjie @ 2020-08-07 15:59 UTC (permalink / raw)
  To: Jiaxun Yang, linux-mips
  Cc: WANG Xuerui, Serge Semin, Huacai Chen, Thomas Bogendoerfer,
	Paul Burton, Serge Semin, Zhou Yanjie, Liangliang Huang,
	linux-kernel

Hello Jiaxun,

Reviewed-by: 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>

在 2020/8/1 下午2:11, Jiaxun Yang 写道:
> Requested by downstream distros, a Kconfig option for default
> IEEE 754 conformance mode allows them to set their mode to
> relaxed by default.
>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> Reviewed-by: WANG Xuerui <git@xen0n.name>
> Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
> Reviewed-by: Huacai Chen <chenhc@lemote.com>
>
> --
> v2: Reword according to Xuerui's suggestion.
> ---
>   arch/mips/Kconfig            | 22 ++++++++++++++++++++++
>   arch/mips/kernel/cpu-probe.c | 12 +++++++++++-
>   2 files changed, 33 insertions(+), 1 deletion(-)
>
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index eaf7519e3033..ac35df2b9133 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -2899,6 +2899,28 @@ config MIPS_NR_CPU_NR_MAP
>   	default 1024 if MIPS_NR_CPU_NR_MAP_1024
>   	default NR_CPUS if !MIPS_NR_CPU_NR_MAP_1024
>   
> +choice
> +	prompt "Default IEEE 754 conformance mode"
> +	default IEEE754_DEFAULT_STRICT
> +	help
> +	  Sets the default IEEE 754 conformance mode, same as overriding the
> +	  default value for the ieee754= kernel parameter. See the kernel
> +	  parameter for details.
> +
> +	config IEEE754_DEFAULT_STRICT
> +		bool "Strict"
> +
> +	config IEEE754_DEFAULT_LEGACY
> +		bool "Legacy"
> +
> +	config IEEE754_DEFAULT_STD2008
> +		bool "2008"
> +
> +	config IEEE754_DEFAULT_RELAXED
> +		bool "Relaxed"
> +
> +endchoice
> +
>   #
>   # Timer Interrupt Frequency Configuration
>   #
> diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
> index c231c1b67889..a5b8fe019afc 100644
> --- a/arch/mips/kernel/cpu-probe.c
> +++ b/arch/mips/kernel/cpu-probe.c
> @@ -157,7 +157,17 @@ static void cpu_set_fpu_2008(struct cpuinfo_mips *c)
>    * IEEE 754 conformance mode to use.  Affects the NaN encoding and the
>    * ABS.fmt/NEG.fmt execution mode.
>    */
> -static enum { STRICT, LEGACY, STD2008, RELAXED } ieee754 = STRICT;
> +enum ieee754_mode { STRICT, LEGACY, STD2008, RELAXED };
> +
> +#if defined(CONFIG_IEEE754_DEFAULT_STRICT)
> +static enum ieee754_mode ieee754 = STRICT;
> +#elif defined(CONFIG_IEEE754_DEFAULT_LEGACY)
> +static enum ieee754_mode ieee754 = LEGACY;
> +#elif defined(CONFIG_IEEE754_DEFAULT_STD2008)
> +static enum ieee754_mode ieee754 = STD2008;
> +#elif defined(CONFIG_IEEE754_DEFAULT_RELAXED)
> +static enum ieee754_mode ieee754 = RELAXED;
> +#endif
>   
>   /*
>    * Set the IEEE 754 NaN encodings and the ABS.fmt/NEG.fmt execution modes

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-01  6:11 [PATCH v2] MIPS: Provide Kconfig option for default IEEE 754 conformance mode Jiaxun Yang
2020-08-05 13:59 ` Jiaxun Yang
2020-08-06  8:16   ` Thomas Bogendoerfer
2020-08-06 10:26   ` WANG Xuerui
2020-08-07  2:07     ` Huacai Chen
2020-08-07 15:59 ` Zhou Yanjie

Linux-MIPS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mips/0 linux-mips/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mips linux-mips/ https://lore.kernel.org/linux-mips \
		linux-mips@vger.kernel.org
	public-inbox-index linux-mips

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-mips


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git