Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp2416189ybg; Thu, 30 Jul 2020 21:12:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuUicu/FbCwVC+pCIto+460TlmP5Z4xlQfqSIzZsgDREmWetnEAh44W7WOmyQdHilo2l10 X-Received: by 2002:a17:906:8595:: with SMTP id v21mr2283452ejx.333.1596168751416; Thu, 30 Jul 2020 21:12:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596168751; cv=none; d=google.com; s=arc-20160816; b=wqwLTQKBMuVl3iZTUxg6oe6XhPsjxllPSnyWS4ojPEkGzYjMwiA1vg2By/CKlxImmD Dd3iPR1nxxWl1HPCDua0nVPvB1otfhNchfD+xVhkO762qx6rQVM0+XlxWxTe5PhprUpo PA/vRY12SYlQMDqxrH8lxPzEQ53si1dw6x9EPeiZRP/y7fwshWwcoY385T1MAf1rXzDs 0+xDDk+7qniONhSDad4OARU7km9bAigtvLff9LDGvTUIlxnOvmKaRPm9lVGdzWF875DF saMRJCEZIDhLhzhBPwAu0ENHkYuT5AyLcSh66iMXz8lEeog4XzNPpoDzRhOAmvE7UFY4 xcEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=sSXPCw67HfVwFw8uuIOiUrdlyFiztoHoyAu1hrWJ38Y=; b=0SOIk/wKOWlXFyaIEqfRK16vigmoBRfBNl6wawNtKsQUPc28jTKhzpmvkX8vQmGKH1 MsNEuvZBWDX3SEmIFGACq+W2xOdrjlJCKNoaJqPge3xcT9VxQ13ndAF193v0C+aV69uG 60hSfSoMcbFI4FUiZz2UmlYLf3lX681UYFDixYLH7d01kz6HDTWjHAxPwmUhYw0Nf/dt PE/MbCEqH9Oq5e6GihunV4gxBl4F0qAnqX7ctU+jNzgKqQwV2t2jR3DQ2UxxaYC6wkFk YQuDtZuFjrCaw8NNGpym9zNOA3fXfmVDhz/MzNAN4p9WSlddxRy2w4bwzMZLvUHEXaYX Ebag== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@flygoat.com header.s=vultr header.b="JS/ZtJWO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o6si4339383eja.332.2020.07.30.21.12.05; Thu, 30 Jul 2020 21:12:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@flygoat.com header.s=vultr header.b="JS/ZtJWO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726721AbgGaELB (ORCPT + 99 others); Fri, 31 Jul 2020 00:11:01 -0400 Received: from vultr.net.flygoat.com ([149.28.68.211]:42394 "EHLO vultr.net.flygoat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725800AbgGaELB (ORCPT ); Fri, 31 Jul 2020 00:11:01 -0400 Received: from localhost.localdomain (unknown [IPv6:2001:da8:20f:4430:250:56ff:fe9a:7470]) by vultr.net.flygoat.com (Postfix) with ESMTPSA id F22691FEB4; Fri, 31 Jul 2020 04:10:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=flygoat.com; s=vultr; t=1596168655; bh=XbAuVWGJ53uaGf3mqTQrfRt8OpiJ6Pji6xLj0mTAQKQ=; h=From:To:Cc:Subject:Date:From; b=JS/ZtJWOyGRjQyE4ZXePwxCzqx8Epx/xyJ0PRPPpbZkicmyOfLk74z+eIQcYEcYEC TJxynuOKYcJs1iTozWXCdPZ5/7PAN5wquGxy7PBrYuwdPsNkJKq1Veb6gFx13vk1t1 hf09WK2A0TIDUs14nYQzDCpCX6XXf98hFhVVEQmzmXZOoX5A9miqdktA3kKPSnHUcc OL+1w1aETSZPvOS5gnZscGRlmKvwS++WuNjhGfQF8HrwFKaCaFKm36sP6LHhDXkFGO L2yYHCNFdy//ksm1zd8j2/KlRUY7ddmmVJ2VINkHS4Fr1rQgQNYsmQRQ5/VJm9FHwO Di0z74zcLUUVw== From: Jiaxun Yang To: linux-mips@vger.kernel.org Cc: Jiaxun Yang , Thomas Bogendoerfer , Paul Burton , Huacai Chen , Serge Semin , Zhou Yanjie , =?UTF-8?q?=E5=91=A8=E7=90=B0=E6=9D=B0=20=28Zhou=20Yanjie=29?= , Liangliang Huang , linux-kernel@vger.kernel.org Subject: [PATCH] MIPS: Provide Kconfig option for default IEEE754 conformance mode Date: Fri, 31 Jul 2020 12:10:16 +0800 Message-Id: <20200731041018.1381642-1-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.28.0.rc1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Requested by downstream distros, a Kconfig option for default IEEE754 conformance mode allows them to set their mode to relaxed by default. Signed-off-by: Jiaxun Yang --- arch/mips/Kconfig | 21 +++++++++++++++++++++ arch/mips/kernel/cpu-probe.c | 12 +++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index f6bb446d30f0..ef5b2a177b1b 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -2877,6 +2877,27 @@ 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 Std 754 conformance mode" + default IEEE754_DEFAULT_STRICT + help + Default IEEE Std 754 conformance mode, see ieee754= kernel parameter + for detail. + + 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 d9e8d39a7289..03adeed58efb 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