Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp593956pxa; Fri, 31 Jul 2020 23:12:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyn/VOJC46fFU2T+Lr9giExCh8Fed8QXZ/1o0A1dbktwK84xO6iAuQQsuhDj8XiOEYdyyVN X-Received: by 2002:a05:6402:22bc:: with SMTP id cx28mr147854edb.171.1596262367861; Fri, 31 Jul 2020 23:12:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596262367; cv=none; d=google.com; s=arc-20160816; b=pBWin7Xf0RKdyvlGLyh4a8v3uuKmQi15ewEk2PaPBnoXbMub0GceM6jd2dnh2ew3lz rqMoobMCVNLeJjbBe4yAEworS4nKzAH4HbClhLk1zf4FpTphSr2GoJgG78Du9aY9Q3vE +Vf6yj/CbrMDPDCDrU5em/m8Ag3aHyDtWediyN4APeNjRVMYh21K9FwthN66MfgZgwTM YkCFOaLwT/NyrZiJXw8CfJqiE2OWrBkRBjPrmFJQsfkHBuhoDrXot4x+tOXgGIRYUbCE IukLOtnayObxL0NEeZP2FvXifA6fKeItjIiaPVWGyKrh8u4qeDjfaN887yz6Ce6htGkk Nneg== 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=qPUwmTGpOD2m0qxCv16To9RlJEw49L9WEZ1Jd+8dVZ0=; b=ljfsdoNftNIjB4jtd3lhJNSLzQn+nLaNKYrOV6zUdcVkWh4tMC2TBWfNX6zkyhjL5A LaI60Z6chcDehSv8UMBMCWF/vKXQZZmP81VGjCfkWiYFwwl/Oz/2jtlZsUywP0btg3YF y+q0mnGqPqL0AZ72RBqfdVKOriaR8yogfG5Nc6WXxj8u21bCVJ4U0f+yCUurUpUpp8bF cb5hhf1rBDkJ+5Z0aUGky+jZnCW6rVudE8/+ue3yfoWG7iR1FOmtBxjPzTesB0+Svqp2 7X+bwpedSX6qdGSQXBmY/ppFGwUZMTGwr4Pq+OGvsYJ+VK4ts1qbHE9AOHosV0sAcbRl yF1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@flygoat.com header.s=vultr header.b=fzK9SH7c; 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 r14si6619632ejy.577.2020.07.31.23.12.13; Fri, 31 Jul 2020 23:12:47 -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=fzK9SH7c; 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 S1726456AbgHAGMA (ORCPT + 99 others); Sat, 1 Aug 2020 02:12:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725275AbgHAGMA (ORCPT ); Sat, 1 Aug 2020 02:12:00 -0400 Received: from vultr.net.flygoat.com (vultr.net.flygoat.com [IPv6:2001:19f0:6001:3633:5400:2ff:fe8c:553]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E35AC06174A; Fri, 31 Jul 2020 23:12:00 -0700 (PDT) Received: from localhost.localdomain (unknown [IPv6:2001:da8:20f:4430:250:56ff:fe9a:7470]) by vultr.net.flygoat.com (Postfix) with ESMTPSA id DF58A1F404; Sat, 1 Aug 2020 06:11:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=flygoat.com; s=vultr; t=1596262319; bh=d78HnpdokE7y3GpAwWH4pwZ1zgRImI58SarwkmVYDWM=; h=From:To:Cc:Subject:Date:From; b=fzK9SH7cTg6oULXyMul1G89s3GotfnnxSPgHDyp6pR9IeyJLs0iH2nCdSfggGZPBC gPDeU2vC4q3KJ0gfoykImCDbAiIOuyfkhqU2F6svGqFaOMHjQVgZwZPfYu4D/tlWFW +6CnUrWZMRJrjedOWx44rHqKJLIAyG89RFtmZdV8ixVBtITLMnwZsPpDJ5V0CngHHl eUAWHNYx6+CcxmiGldVyz+V42KIjd44ULM3u+J5dlCd6/iV/KafZtIOEa50u8Fjzqh ypwKipmAmMoJs3zvam7VSPOrEYZANdaW8ZpdvAaRjllsFTi1218RrRd707cHNQRb9S SrP8rGN30/SgQ== From: Jiaxun Yang To: linux-mips@vger.kernel.org Cc: Jiaxun Yang , WANG Xuerui , Serge Semin , Huacai Chen , Thomas Bogendoerfer , Paul Burton , 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 v2] MIPS: Provide Kconfig option for default IEEE 754 conformance mode Date: Sat, 1 Aug 2020 14:11:46 +0800 Message-Id: <20200801061147.1412187-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 IEEE 754 conformance mode allows them to set their mode to relaxed by default. Signed-off-by: Jiaxun Yang Reviewed-by: WANG Xuerui Reviewed-by: Serge Semin Reviewed-by: Huacai Chen -- 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