Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp2417042ybg; Thu, 30 Jul 2020 21:15:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzv/1S3uR51W1THU7y22qn5oQNoH2Z+u/QSb28Iq2bVF7yTvbedlsYJl+K4Coe1ZjoeyMdw X-Received: by 2002:a17:906:3a0d:: with SMTP id z13mr2170127eje.109.1596168912372; Thu, 30 Jul 2020 21:15:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596168912; cv=none; d=google.com; s=arc-20160816; b=yii0UEt+hWdhh5SkjzVrLAfgyBCgtMJwCSgN393E26Ks6oCyDIsYXU1cxjmmm0zUUQ u7AWCUPNBmXTnhVh1gHl48i1AzJQ8DBMj3UvnbzNT+WXyRnWXykFBxPQhjpn83eD0lN/ 8caOZzjvznk2ZsXnGGfxgrh56xnYQ7bb3UjXb+a3+DHHcb4GGZfGR04g/ey1lNxY+HuQ 5EhGmqKCr5EHugnmqUjwkYX9ZtZXpplqfpLTzFRccMd6T3MbofrDPKG/GXXzW1WPVynG 1IQ9CjCd/7iCKVt/IEJcUezZ8R1orer09rgJXqIV8ZmTsyoCC3TA2BwXlEVEzeKat4mx TOfw== 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=tHn9hwSewkNFbHc3+mui02PvmsJ8tZMbVQNJg0s6sq371gkJNyMgtZmshIkb8oVLTP T+Vwcyp/3S8OqTPevhuuPhcjcDmWg9Jyhr2FsjU8oOOH9OA2Y8W6I1gIXiAYVeW2mVAn bgP1rJZYmyNs9ANT6/63mYB8P6G6O4jsdr+7kV8YfQ3WtdPCvEGbBRCHdX8iWm0X7T7W 6JHeEBTowEf6+7PoLm5EQNM18ujbfCJqrRJvK+mwFItBOXIiDUdt4kjesPFbHgtsh3GR T5q/p+wJ0jPOFO28lk/luU2nQs95+tMsBbLgIMfyuZdBZCYiuwVCu8OMHUNREIJlxT27 KnKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@flygoat.com header.s=vultr header.b=kOh9Sok6; 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 ca18si4536198edb.414.2020.07.30.21.14.47; Thu, 30 Jul 2020 21:15:12 -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=kOh9Sok6; 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 S1727830AbgGaEMB (ORCPT + 99 others); Fri, 31 Jul 2020 00:12:01 -0400 Received: from vultr.net.flygoat.com ([149.28.68.211]:42414 "EHLO vultr.net.flygoat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726318AbgGaEMA (ORCPT ); Fri, 31 Jul 2020 00:12:00 -0400 Received: from localhost.localdomain (unknown [IPv6:2001:da8:20f:4430:250:56ff:fe9a:7470]) by vultr.net.flygoat.com (Postfix) with ESMTPSA id E43091FEB5; Fri, 31 Jul 2020 04:11:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=flygoat.com; s=vultr; t=1596168719; bh=XbAuVWGJ53uaGf3mqTQrfRt8OpiJ6Pji6xLj0mTAQKQ=; h=From:To:Cc:Subject:Date:From; b=kOh9Sok6QKXxhL1spvB05M+RDY9CIXO2tecYEVK+HjrddvpOWJh02pUSnEtSFCy6/ jOWPzrRkLnC/bRpg65lYp3ANWnSFHLatMac1GR5NnalTzlHwPl1+AFnUI8cMwjVqbk b4qzgasgZ/0k0xQqywDsbUrXJxABhsLazMfIarDMQXvwf64d7imG4l9ISfY+c0A+y6 wprGjxZbCPoYFFBaeuCSngNVss1MIB8OkVl80hvgyYcz024iwRqW860bmlU47FV0LB LCmF3aATD/yWO8YqgSAseGjjBlgquKUrNqHFp0XlHeREdiByPeaWyVOK/C/75xEYb9 voVtq7zwpHMLA== From: Jiaxun Yang To: linux-mips@vger.kernel.org Cc: Jiaxun Yang , Thomas Bogendoerfer , Paul Burton , Huacai Chen , Zhou Yanjie , Serge Semin , =?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:11:50 +0800 Message-Id: <20200731041152.1382077-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