Received: by 10.223.185.116 with SMTP id b49csp6361771wrg; Wed, 28 Feb 2018 08:10:32 -0800 (PST) X-Google-Smtp-Source: AG47ELtJca/bt6OXST9GdxZb34DTNMHxzBc4zsy/DLzr2VzNVjrjOZN7ZLVYMansH4EOAEG6SL/x X-Received: by 2002:a17:902:1a2:: with SMTP id b31-v6mr10258962plb.203.1519834232467; Wed, 28 Feb 2018 08:10:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519834232; cv=none; d=google.com; s=arc-20160816; b=lZWdY1wcWbMvOtr5NJAQcxxq36QtMf4ui7V5X3I25r95CBvxUHmEQfYCn94C0kcoto 4rRk+FAkvew37Gb/F2wy0K8Mq4nZzKAQRTG+7GDpHeGe92nInQFziUDhosen/hN5ZZTQ mVGPzMz7HClA1BH6qPGCt4Y/Li2RQFRBDwo0hwYR7ixQjUFIvbVPF6kby1toeqlQzyQq Ag9cnJmYlNW5SgMasjJkTeqHwaXUAjfkV0vhyZQxAWpoONTDXEvNwnnwXtYTWb1/JWu1 h88Mdu7E9uFkOD2mxjTGfuEB1clmtaVtifLRO5eLvpb2coC0/afxzdtOaL7hrd1vHxvT rqEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=GHwI+yRMBcfsFAZDbaFDF0fYc9PniaGYaQ8nw+SL0xA=; b=A7zHDCcQgOXYHAa5FuV197YPnGW2oW73vunZMcFON8VVYNl51pWHfy3d+Re5ym5KfP f5eip3AlaBPty6R6sE8akTSmDQGHSjOaAFZL0AQus80sHg1dF4g4NmeOOZEqj6q3lMbD b1QkI7cROYLYMhBV1pcr/ljpsS+72e+Psq5qtFDNaFNRPwADRInGT5qsiPlOxPRb3dm6 5VjbkZe/r/3WDOhe9N6jgNF6wwBskwLWxqwuoZUb5uUSn5pgEdyw/YlwgUNXJYvQ0zJS vrGzvisko+CZuF5k0/hhgoO7vBxtraNNfsBTEE4jEt123vBom0xkJJzHa1XR9Y3JjcBx PT4A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d30-v6si1487004pld.452.2018.02.28.08.10.17; Wed, 28 Feb 2018 08:10:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934585AbeB1QI0 (ORCPT + 99 others); Wed, 28 Feb 2018 11:08:26 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:34941 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934474AbeB1QIY (ORCPT ); Wed, 28 Feb 2018 11:08:24 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Yt-0006XR-56; Wed, 28 Feb 2018 15:22:31 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yg-0008WP-9P; Wed, 28 Feb 2018 15:22:18 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Maciej W. Rozycki" , linux-mips@linux-mips.org, "Ralf Baechle" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 099/254] MIPS: math-emu: Define IEEE 754-2008 feature control bits In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: "Maciej W. Rozycki" commit f1f3b7ebac08161761c352fd070cfa07b7b94c54 upstream. Define IEEE 754-2008 feature control bits: FIR.HAS2008, FCSR.ABS2008 and FCSR.NAN2008, and update the `_ieee754_csr' structure accordingly. For completeness define FIR.UFRP too. Signed-off-by: Maciej W. Rozycki Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/9709/ Signed-off-by: Ralf Baechle [bwh: Backported to 3.16: In cop1Emulate(), keep converting the rounding mode] Signed-off-by: Ben Hutchings --- --- a/arch/mips/include/asm/mipsregs.h +++ b/arch/mips/include/asm/mipsregs.h @@ -136,10 +136,13 @@ #define FPU_CSR_COND7 0x80000000 /* $fcc7 */ /* - * Bits 18 - 20 of the FPU Status Register will be read as 0, + * Bits 22:20 of the FPU Status Register will be read as 0, * and should be written as zero. */ -#define FPU_CSR_RSVD 0x001c0000 +#define FPU_CSR_RSVD (_ULCAST_(7) << 20) + +#define FPU_CSR_ABS2008 (_ULCAST_(1) << 19) +#define FPU_CSR_NAN2008 (_ULCAST_(1) << 18) /* * X the exception cause indicator @@ -687,6 +690,8 @@ #define MIPS_FPIR_W (_ULCAST_(1) << 20) #define MIPS_FPIR_L (_ULCAST_(1) << 21) #define MIPS_FPIR_F64 (_ULCAST_(1) << 22) +#define MIPS_FPIR_HAS2008 (_ULCAST_(1) << 23) +#define MIPS_FPIR_UFRP (_ULCAST_(1) << 28) /* * Bits in the MIPS32 Memory Segmentation registers. --- a/arch/mips/math-emu/cp1emu.c +++ b/arch/mips/math-emu/cp1emu.c @@ -929,10 +929,12 @@ emul: MIPSInst_RT(ir), value); /* - * Don't write reserved bits, + * Don't write unsupported bits, * and convert to ieee library modes */ - ctx->fcr31 = (value & ~(FPU_CSR_RSVD | FPU_CSR_RM)) | + ctx->fcr31 = (value & + ~(FPU_CSR_RSVD | FPU_CSR_ABS2008 | + FPU_CSR_NAN2008 | FPU_CSR_RM)) | modeindex(value); } if ((ctx->fcr31 >> 5) & ctx->fcr31 & FPU_CSR_ALL_E) { --- a/arch/mips/math-emu/ieee754.h +++ b/arch/mips/math-emu/ieee754.h @@ -195,15 +195,17 @@ static inline int ieee754dp_ge(union iee * The control status register */ struct _ieee754_csr { - __BITFIELD_FIELD(unsigned pad0:7, - __BITFIELD_FIELD(unsigned nod:1, /* set 1 for no denormalised numbers */ - __BITFIELD_FIELD(unsigned c:1, /* condition */ - __BITFIELD_FIELD(unsigned pad1:5, + __BITFIELD_FIELD(unsigned fcc:7, /* condition[7:1] */ + __BITFIELD_FIELD(unsigned nod:1, /* set 1 for no denormals */ + __BITFIELD_FIELD(unsigned c:1, /* condition[0] */ + __BITFIELD_FIELD(unsigned pad0:3, + __BITFIELD_FIELD(unsigned abs2008:1, /* IEEE 754-2008 ABS/NEG.fmt */ + __BITFIELD_FIELD(unsigned nan2008:1, /* IEEE 754-2008 NaN mode */ __BITFIELD_FIELD(unsigned cx:6, /* exceptions this operation */ __BITFIELD_FIELD(unsigned mx:5, /* exception enable mask */ __BITFIELD_FIELD(unsigned sx:5, /* exceptions total */ __BITFIELD_FIELD(unsigned rm:2, /* current rounding mode */ - ;)))))))) + ;)))))))))) }; #define ieee754_csr (*(struct _ieee754_csr *)(¤t->thread.fpu.fcr31))