From patchwork Tue Jul 4 11:44:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 106948 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp897874qge; Tue, 4 Jul 2017 04:44:50 -0700 (PDT) X-Received: by 10.98.27.73 with SMTP id b70mr14690133pfb.42.1499168690654; Tue, 04 Jul 2017 04:44:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499168690; cv=none; d=google.com; s=arc-20160816; b=ffpc/nIqKXgo3PNiYsa6QapmwmCeSix1jD8w13GK85mwXJquggS3hYUUMegtHevvM1 TXReR7hfetEo92kpkjCUbFIRbhnZzo8+3lUKuRMpukQbukMNQTNLNx2A5GZm05z25ROn qvC0MpPvlw95rpzEPjcUOf2tvCLiMCdcDbGLuVkXBZqJ+/KScaYUhcSFYsApsJwCXtEO 8ZzYbXM6K4lDY7ytD9AjpELmfqK36gdhXLvtynWceTOzjErdwliKEVqok3Rqvs7FegFV Dw1S2EUMkqFECirP2gVXNKsLbAD6muCC1ygiTa6ZS+aWvHww0A8xVDKYZJKV982DPk5C 2HDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=zLeAV6js01dIatCeo30cAABzLRqFOHAVuaeh8GxhRB0=; b=My9xjYaAWFS9U0Kok4iYAjW0Mn8kuPA5pNyRhnKL9eP3Kmjj3q9b6KsPNAFBlYwiPD dfYk7AL+3U9YW+Cxr8eImOM6l99YD+u2Srinu8MOfw1t/GLNiqWiMyGhi6uDqGweVUep a1/Wcor2UzfvUaaFe8eWrKmVhdyWpS7hJISJA/nwciJrmOpVIH3VUnSfI8+3a7CMhoJH 8rPObNPyc6zYHyu6o5v6qf2yqiZVFEEj4kIeYgqe32gi+/mplqVbJG4/D8iXub9wDlQf NrglCqCDsjqoUSYJNzik8KDDs19b/Pv7pkyhPFsNJtKXfD0HKUf4SXWDD819ieVyHTow 5HEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=Wl5w/BSi; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x10si14416295pfi.192.2017.07.04.04.44.50; Tue, 04 Jul 2017 04:44:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=Wl5w/BSi; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752108AbdGDLot (ORCPT + 6 others); Tue, 4 Jul 2017 07:44:49 -0400 Received: from mail-pf0-f170.google.com ([209.85.192.170]:33374 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752040AbdGDLot (ORCPT ); Tue, 4 Jul 2017 07:44:49 -0400 Received: by mail-pf0-f170.google.com with SMTP id e7so114460988pfk.0 for ; Tue, 04 Jul 2017 04:44:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zLeAV6js01dIatCeo30cAABzLRqFOHAVuaeh8GxhRB0=; b=Wl5w/BSiDXEKW1lPPTQT5CIAiBFNp+brC/1nKc0JdglCmOfSL2iIdkQc/6RUUblsxp lOTOETYtYrHgbh0aCqhyBeYB1RogtW5pUrF0sB+vLXfu79gDf2m6jnevR5uAiyKuy37k e9ki3jELEtN2m/yctVrXd597zZ1yH6Hk6LkNQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zLeAV6js01dIatCeo30cAABzLRqFOHAVuaeh8GxhRB0=; b=ZW7z7MB15ZyvMT3ntg+zBP502rIUdFg/DSdFIjFmCCAu1vHIiHgdD8Nsiq3RsBqoeX IzyRDSwUq8tH3oDLfoaXdKgR2m8w7eV7c3I3t08mmy/0c2bv7BdGEM+X7M23AoIGyEEp CYyHl0gK55VSJ/zBnq3Jg2Xlin1htOcw4/nQi8acIT+h315vKuKlS+52wzVQmOYGXdkl vs+qGSw06h8CnlIGHSpvbyI5RUBwJKv5buRkX3enu9xz5gFXFWgCP0VgsLbSoLzy3OTM iVonelAIGLD0e8+pcHBUUTHqUbMwNm6gAsQLiJvGGSI/zWh9y9MHneOlanhI18cLs1Sx tqRQ== X-Gm-Message-State: AIVw113+ZLOWRpHH/NpmqieBPHf4dDGBsuNSNtvybEGGYc+ASSSJJZqM IJHHUYM3gHSjbYuM X-Received: by 10.98.113.65 with SMTP id m62mr14830617pfc.150.1499168688577; Tue, 04 Jul 2017 04:44:48 -0700 (PDT) Received: from localhost.localdomain ([106.51.234.165]) by smtp.gmail.com with ESMTPSA id t83sm39782750pfg.91.2017.07.04.04.44.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Jul 2017 04:44:47 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , Yousong Zhou , "Maciej W . Rozycki" , linux-mips@linux-mips.org, Ralf Baechle Subject: [PATCH for-3.18 4/5] MIPS: UAPI: Ignore __arch_swab{16, 32, 64} when using MIPS16 Date: Tue, 4 Jul 2017 17:14:23 +0530 Message-Id: <1499168664-25980-5-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499168664-25980-1-git-send-email-amit.pundir@linaro.org> References: <1499168664-25980-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Yousong Zhou commit 71a0a72456b48de972d7ed613b06a22a3aa9057f upstream. Some GCC versions (e.g. 4.8.3) can incorrectly inline a function with MIPS32 instructions into another function with MIPS16 code [1], causing the assembler to genereate incorrect binary code or fail right away complaining about unrecognized opcode. In the case of __arch_swab{16,32}, when inlined by the compiler with flags `-mips32r2 -mips16 -Os', the assembler can fail with the following error. {standard input}:79: Error: unrecognized opcode `wsbh $2,$2' For performance concerns and to workaround the issue already existing in older compilers, just ignore these 2 functions when compiling with mips16 enabled. [1] Inlining nomips16 function into mips16 function can result in undefined builtins, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55777 Signed-off-by: Yousong Zhou Cc: Maciej W. Rozycki Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/11241/ Signed-off-by: Ralf Baechle Signed-off-by: Amit Pundir --- arch/mips/include/uapi/asm/swab.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/arch/mips/include/uapi/asm/swab.h b/arch/mips/include/uapi/asm/swab.h index 8f2d184dbe9f..23cd9b118c9e 100644 --- a/arch/mips/include/uapi/asm/swab.h +++ b/arch/mips/include/uapi/asm/swab.h @@ -13,8 +13,9 @@ #define __SWAB_64_THRU_32__ -#if (defined(__mips_isa_rev) && (__mips_isa_rev >= 2)) || \ - defined(_MIPS_ARCH_LOONGSON3A) +#if !defined(__mips16) && \ + ((defined(__mips_isa_rev) && (__mips_isa_rev >= 2)) || \ + defined(_MIPS_ARCH_LOONGSON3A)) static inline __attribute_const__ __u16 __arch_swab16(__u16 x) { @@ -65,5 +66,5 @@ static inline __attribute_const__ __u64 __arch_swab64(__u64 x) } #define __arch_swab64 __arch_swab64 #endif /* __mips64 */ -#endif /* MIPS R2 or newer or Loongson 3A */ +#endif /* (not __mips16) and (MIPS R2 or newer or Loongson 3A) */ #endif /* _ASM_SWAB_H */