From patchwork Wed Mar 11 18:04:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 11432449 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4DC53913 for ; Wed, 11 Mar 2020 18:04:39 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D5B6320691 for ; Wed, 11 Mar 2020 18:04:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ilW9mEbp"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="L1G2+Nx2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D5B6320691 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Q6UGxU9WXGPmF/z2rDz1fnB3M2yTySotfVc5q9nbwVo=; b=ilW9mEbpQypELN 2M1z91nxvu2SVeUUgWeWzrvO37Bu/KaJioE3PBEccvpuAxbz4CHIv3E+l0SFq53MWR0w73vWnw+5m mOdtQEkWw2klnWjUP94YYQsrZq0aTkpL7n27QK4lLyXfWUdYnPd+cA4j8jqTQCXCAsZPSX3bwDoEK UTkiYYjGO2jtyHSbmkA+wib95oghOyUs4kLSZHfOEBhk/Uda2V4T9fVRYTYUgNwQxbusb82n1yWHg h0lt6zlVZayyscxZ1/sflDltM1d5AjaVONeTJ9C0N2A2Slmo7U+dtp4+MsfSc/prflCQhDHjbKpCN u8+IGcG8Fy2RJL31RekA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jC5ic-0002jT-R3; Wed, 11 Mar 2020 18:04:34 +0000 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jC5iN-0002Wa-UE for linux-arm-kernel@lists.infradead.org; Wed, 11 Mar 2020 18:04:21 +0000 Received: by mail-pj1-x1044.google.com with SMTP id np16so1345831pjb.4 for ; Wed, 11 Mar 2020 11:04:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=SClQ7RtJL8F3jBPIZG3Gn5B3ixRvlcw00FEz6HzQc64=; b=L1G2+Nx202ixQD5QeSXqhNHOV3lJjFXIgCI0SmX+xpubyONlUjhe+j3cqOiCV7NP7z qZZ18iH+gIP1wcStALWVraZAiPiQifn5ogaf/5mQMsVvy5iDex739Um3/NwmcCFvNNCU cBCQqPOmgsoEHCSrWr3VK5XptZw6csheM8lf4xP6KcH1NDcPVX/z3jglX9YziTksDArb KqBunZ1u0dxxa7UMIATQuTHw5ueh6j4FwFHe8aBocYGKR/q7D6gYBf4aQfhN0n89Qzt9 8FbTBV3Z7R3Y3+vCY/aQ1rFWiPPKWo86TDI6slZgHgwPkGJ3atKVra8oIDeVc6rt49Cp TsKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SClQ7RtJL8F3jBPIZG3Gn5B3ixRvlcw00FEz6HzQc64=; b=iO/YiUGEJ7P2AcG9F0dmMr65b+tOo29bnj2mLCtw2TMUjaRzpWGUk372h5FmLLgbvn b0Un5jiets/WMKDn2gSAcjUe02IEfvNZou8LqreHzvmXZgnq3TMmEKvbueJ1lf1YUNBY vXcvV6HM5UELrHyqZd9M9b4ZQtg6oAKuRI7WHsHlAtlB3d60bI0RGI4Iv2zUlD51qZT/ pCF9JDNuev18tBCBVGQbugrnCK2hlppS3/9iz8UjFOB9Mf1B4rpFADDwWIn6kDO7aVpd nKOIS3Pp72A4Tz0rK0BgAZ70OaNl9HT80JbwbMNHzMbaKhUfutakmwRefUPEP4t9Dzfp 3Pwg== X-Gm-Message-State: ANhLgQ2m9XMQQVDLfWYvpaA2XQlOQVIBy2hURqKjxA+5B9u7Sy3l8fru Snnz4uk9Jgb6Z37iqUNEWO6Yl5SLVaI= X-Google-Smtp-Source: ADFU+vuofJSXLF5AfCGNXdKM3gy7aHHEKa66XF7hK4wV1opcIWIvPDGB8RB1i3gZf5QBq3sLYMpB4A== X-Received: by 2002:a17:90a:9dc3:: with SMTP id x3mr4577263pjv.116.1583949858951; Wed, 11 Mar 2020 11:04:18 -0700 (PDT) Received: from localhost.localdomain (97-126-123-70.tukw.qwest.net. [97.126.123.70]) by smtp.gmail.com with ESMTPSA id k9sm6079383pjo.19.2020.03.11.11.04.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 11:04:18 -0700 (PDT) From: Richard Henderson To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/6] arm64: Add asm/ccset.h header Date: Wed, 11 Mar 2020 11:04:11 -0700 Message-Id: <20200311180416.6509-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200311180416.6509-1-richard.henderson@linaro.org> References: <20200311180416.6509-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200311_110419_972345_7CBABDB5 X-CRM114-Status: GOOD ( 10.02 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1044 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org With gcc 10, arm64 includes support for flag outputs, much like x86 has done for years. Mirror the macros that x86 places in asm/asm.h, with the necessary addition of CC_CLOBBER. Signed-off-by: Richard Henderson --- arch/arm64/include/asm/ccset.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 arch/arm64/include/asm/ccset.h diff --git a/arch/arm64/include/asm/ccset.h b/arch/arm64/include/asm/ccset.h new file mode 100644 index 000000000000..e733d383f515 --- /dev/null +++ b/arch/arm64/include/asm/ccset.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_CCSET_H +#define __ASM_CCSET_H + +/* + * Macros to generate condition code outputs from inline assembly. + * The output operand must be integral but type "bool" preferred. + */ +#ifdef __GCC_ASM_FLAG_OUTPUTS__ +# define CC_SET(c) "\n\t/* output condition code " #c "*/\n" +# define CC_OUT(c) "=@cc" #c +# define CC_CLOBBER +#else +# define CC_SET(c) "\n\tcset %[_cc_" #c "], " #c "\n" +# define CC_OUT(c) [_cc_ ## c] "=r" +# define CC_CLOBBER "cc" +#endif + +#endif /* __ASM_CCSET_H */ From patchwork Wed Mar 11 18:04:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 11432453 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AFA6892A for ; Wed, 11 Mar 2020 18:05:26 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3034B20691 for ; Wed, 11 Mar 2020 18:05:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="lNp0JLCS"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="GimgdM8M" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3034B20691 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=W6bUShZNbu3URK/byfYKx6wHkenROpl1q2J99aSnE70=; b=lNp0JLCSSkh/hA y5kfsLZ1sYKftLnlUGbBPXT0rZjDOfOsWTDsgawpNj3WbL4fFTXC7Rq8TwXPHsMVvZXSa5TPhiEJK zc51XvomRrdZgQkyCKeCtPTcmlBunTIJXbw//RiiItQYFVUGu5sghSwM04/Ejk0P7x7nGKX9OAO60 euFpd2Z1rinamslHASl79UmROu9cbpaNMwI5c+ee2FgebrU+W2WafulBTxOQmchPN6uTzsSdYPRkC V953Ng05AX0/ulpuhq+u7IFJsoaBFWcaIsfGJJfRYHB6VKmTREWk5CE8OYJU24qMwMKmCc4twi0ma 7fIHzzA1Ki+5OZFpPLWQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jC5jN-0004dw-6h; Wed, 11 Mar 2020 18:05:21 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jC5iQ-0002XE-Ju for linux-arm-kernel@lists.infradead.org; Wed, 11 Mar 2020 18:04:24 +0000 Received: by mail-pl1-x641.google.com with SMTP id w3so1453504plz.5 for ; Wed, 11 Mar 2020 11:04:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=NllkvBANvvltyJ4Ta7Fee1TStyDJumULjkiKc3SXuVc=; b=GimgdM8MhhPoTUcN7tVX2kKiWZ1wLhhvOZY8QQmK2PZpDFqJE5Bys3HdI5KzKMB1tv 7ATZ5ARJKNbXKiQ37NA+rxju3C+2tOLkP60IVWjXDjNURqBdG++vQspEa9Do/2pRCQ+c drAnTBEVTfT7a1R704gkI3MEvg16ZkJqUbNMfvn85/tb41SmsdM6jYd4f37sips6EMDy CRtjuUGItWsbP98LgpVJjZUlStR8U8gQyEVYzdq2mkExNuQbEX9BqNEfnzFUhzYPu9QG 4w3FI2FPk47nygQjA1vUF9dqtRF6HW8eUEYVdk5hLNafwyjpRWiqOLO1OoKmgNxeFOSR QukA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NllkvBANvvltyJ4Ta7Fee1TStyDJumULjkiKc3SXuVc=; b=rRc/1JcHhFIrZ5zJtOd5jfeyTCTMixNlSyCV91jY4Pz7ijYGXeNjYPDa9Q3PNlIPF4 BZBNMBeA3ApdDGNwXvynPpEKP90hhpQUt9VTL39APLFp0TIcazTkOQU6g/TKO9sRgkge SDI9T8njGyuXT7fBHIV7/z+vODSvlyqlyMel7RdeB7cMEXRIReTZM+i77XFr1IIKCkcF eRwVn0Z8SEa+tNejPVUxFsDZq2oK1fvTHC5L/dqgjeSms/GmmVXgU76COX8nXocGoQbL UyNmoyhBH06rUrbBf2RvvMLTWqi9TtB+OdgSqpbfdrNEWmQ+aXILC+QY/jFSIh7yB2sh vfQw== X-Gm-Message-State: ANhLgQ0fxwLRdphs66BtWWTuOpwXwj28O+zu1M1VrRFhhlH9ambIv/hD zoZt1c8V5X+N5mvJaAmrzxKqSMUfOjg= X-Google-Smtp-Source: ADFU+vvM+tnPy6lf0GAE6Kl68AWImasFWCKCk4f7wuZcQKypTnXWby2WMkocIsPXwJrwcRz3OvOUvg== X-Received: by 2002:a17:902:7282:: with SMTP id d2mr4157079pll.263.1583949860147; Wed, 11 Mar 2020 11:04:20 -0700 (PDT) Received: from localhost.localdomain (97-126-123-70.tukw.qwest.net. [97.126.123.70]) by smtp.gmail.com with ESMTPSA id k9sm6079383pjo.19.2020.03.11.11.04.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 11:04:19 -0700 (PDT) From: Richard Henderson To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/6] arm64: uaccess: Use named asm operands for __in_range Date: Wed, 11 Mar 2020 11:04:12 -0700 Message-Id: <20200311180416.6509-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200311180416.6509-1-richard.henderson@linaro.org> References: <20200311180416.6509-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200311_110422_695587_B7EADFA9 X-CRM114-Status: GOOD ( 10.29 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:641 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org With zero change of behavior, use %[] syntax for the asm operands instead of numbered operands. Signed-off-by: Richard Henderson --- arch/arm64/include/asm/uaccess.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h index 32fc8061aa76..ceb1d79eab09 100644 --- a/arch/arm64/include/asm/uaccess.h +++ b/arch/arm64/include/asm/uaccess.h @@ -75,19 +75,21 @@ static inline unsigned long __range_ok(const void __user *addr, unsigned long si asm volatile( // A + B <= C + 1 for all A,B,C, in four easy steps: // 1: X = A + B; X' = X % 2^64 - " adds %0, %3, %2\n" + " adds %[addr], %[addr], %[size]\n" // 2: Set C = 0 if X > 2^64, to guarantee X' > C in step 4 - " csel %1, xzr, %1, hi\n" + " csel %[limit], xzr, %[limit], hi\n" // 3: Set X' = ~0 if X >= 2^64. For X == 2^64, this decrements X' // to compensate for the carry flag being set in step 4. For // X > 2^64, X' merely has to remain nonzero, which it does. - " csinv %0, %0, xzr, cc\n" + " csinv %[addr], %[addr], xzr, cc\n" // 4: For X < 2^64, this gives us X' - C - 1 <= 0, where the -1 // comes from the carry in being clear. Otherwise, we are // testing X' - C == 0, subject to the previous adjustments. - " sbcs xzr, %0, %1\n" - " cset %0, ls\n" - : "=&r" (ret), "+r" (limit) : "Ir" (size), "0" (addr) : "cc"); + " sbcs xzr, %[addr], %[limit]\n" + " cset %[addr], ls\n" + : [addr] "=&r" (ret), [limit] "+r" (limit) + : [size] "Ir" (size), "0" (addr) + : "cc"); return ret; } From patchwork Wed Mar 11 18:04:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 11432451 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2C97C913 for ; Wed, 11 Mar 2020 18:04:59 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B517420735 for ; Wed, 11 Mar 2020 18:04:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="FRsZ+JaW"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="xRP23aSJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B517420735 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4cLHBa3/Ro/CEmui08muqWql5XNHP/eBlvz5z42fix4=; b=FRsZ+JaWOXZ7Sj Y/wMDKw8ezRY3oxSaYNO710WWpmXa/ojs59V+lTYGsrRRKveVUX1dMl7HQnIFlc9Z/FH0GMMr958+ gdWrcltQh1wpgaS93/zEKOQ66li/c02Oxvo7VHbNCWHR1M0ay4DB0vvwlUriaRj0p/I5GkU4TRvhM KdVnT4HGYW3YuAnXUgtmwE13FzdGx4E5RMUT0XYzDr4lMJBEouJk4wmr8e2iLCTEMzDGkqqgaRDsV YnSfQpo8P+1k3IpemLUY1VB65AJdNflIZ+oaEKrnWPCLwF8Gna9Q6Lu4OlSUzrtvrudgTyu+wmjNZ FHsvcTV+ZO3E0O/NoGUA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jC5ix-00032j-9Y; Wed, 11 Mar 2020 18:04:55 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jC5iQ-0002XK-As for linux-arm-kernel@lists.infradead.org; Wed, 11 Mar 2020 18:04:23 +0000 Received: by mail-pg1-x542.google.com with SMTP id a32so761430pga.4 for ; Wed, 11 Mar 2020 11:04:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=91DmWgN0e9M6/kkkNvykvlY0ufggKJnkN2ZSNGdrCLE=; b=xRP23aSJRK6a95T5oQi4zXdTc6/CrNnkCOz0ScXdS0PEnJvXwILkd1HK6Fhv96/9mw DiZG0Y64RovAI0qPZ2XPYMFcuQBUL2LfT6+CxIqYcgywGOBWkuOAM+aiK6CyyvpeAvHv iQZQv/P9Bjagz8SfAANbp0muQR1hi/HWpQRmcC+xXeOfiZ+AmNJe0nd99/jGXHF8bVC4 b8vC3y27tL46gWDjgRnoZwrVL4agviK2en5yG28Tx+Cy4R0myo7pTlABWi91kDlIRGiG zE5W9XKHmrtgc4ELsg6uVcOTOvt64fPgL5YZNBAbyZxlKh4kYrqjPHL7FFLcOfzkx+W+ u3Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=91DmWgN0e9M6/kkkNvykvlY0ufggKJnkN2ZSNGdrCLE=; b=dG4JG4WL+/Fit5Z+ADaXKo00JhyzvMmVigReM/gJJEhaOgJntrev8JR0AEScHbBFhK NGoSoeZa2VCYttAjeYxgeYXWflbgfKmHoyPJrXmqETV5cWQO8hQoDWBb3y1un57dcAKF blqytgvZppOqFs1rSYjIffc2nkUljGXkm63uXH6uj/pZ8x/BtFgDoWeGzhMOjRB0Hj7t SHOEv+ZNlPmyxRp+IZb6vD0NUdnW7XYCwXtCmQo+Mn+6Sdh25TrbHbT2ztrOOiOE8Y8b dtyyPNkLJpDD5Kqguv7ebw2lQvoTxFGRhZQTTqdbMUeq6q5mTGuB2ijg+MW+Z9kxQg5V dypg== X-Gm-Message-State: ANhLgQ13t609A1W6yUUJNd7nsE/4mocvUvK6gyZdGD0VkbXRzdW28gGk NmaCHgxfw3z7ODM4Xa1+XNkeqel8LSc= X-Google-Smtp-Source: ADFU+vtq+72ZEajtisRq2tNaw8OJJhbGI3GQjneHYLOvSHf0xp5gQDadY3unNBXWVNHosnT5ti8wTw== X-Received: by 2002:a62:5296:: with SMTP id g144mr4072146pfb.29.1583949861383; Wed, 11 Mar 2020 11:04:21 -0700 (PDT) Received: from localhost.localdomain (97-126-123-70.tukw.qwest.net. [97.126.123.70]) by smtp.gmail.com with ESMTPSA id k9sm6079383pjo.19.2020.03.11.11.04.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 11:04:20 -0700 (PDT) From: Richard Henderson To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/6] arm64: uaccess: Untie the input address in __range_ok Date: Wed, 11 Mar 2020 11:04:13 -0700 Message-Id: <20200311180416.6509-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200311180416.6509-1-richard.henderson@linaro.org> References: <20200311180416.6509-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200311_110422_393325_912C8AD8 X-CRM114-Status: GOOD ( 11.37 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:542 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org There's no reason for the input address to match the output register. Give the register allocator a bit more freedom. Signed-off-by: Richard Henderson --- arch/arm64/include/asm/uaccess.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h index ceb1d79eab09..fe3dd70e901e 100644 --- a/arch/arm64/include/asm/uaccess.h +++ b/arch/arm64/include/asm/uaccess.h @@ -75,7 +75,7 @@ static inline unsigned long __range_ok(const void __user *addr, unsigned long si asm volatile( // A + B <= C + 1 for all A,B,C, in four easy steps: // 1: X = A + B; X' = X % 2^64 - " adds %[addr], %[addr], %[size]\n" + " adds %[addr], %[addr_in], %[size]\n" // 2: Set C = 0 if X > 2^64, to guarantee X' > C in step 4 " csel %[limit], xzr, %[limit], hi\n" // 3: Set X' = ~0 if X >= 2^64. For X == 2^64, this decrements X' @@ -88,7 +88,7 @@ static inline unsigned long __range_ok(const void __user *addr, unsigned long si " sbcs xzr, %[addr], %[limit]\n" " cset %[addr], ls\n" : [addr] "=&r" (ret), [limit] "+r" (limit) - : [size] "Ir" (size), "0" (addr) + : [size] "Ir" (size), [addr_in] "r" (addr) : "cc"); return ret; From patchwork Wed Mar 11 18:04:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 11432457 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2997D913 for ; Wed, 11 Mar 2020 18:05:44 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B20BC206E9 for ; Wed, 11 Mar 2020 18:05:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ujz9//NP"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="NOn7OFtf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B20BC206E9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mWnjR3EExZCIvUA5inOOZGKWyrhr9Gwwj+0Y3J4nitA=; b=ujz9//NP/Ehnxo ZBZwVSveaiR+q7Len9JJQ2zydTEUDb9oP22VBhRmZHnZ+ZWRHqa4NpJ56lnm83VZOxfYNpf9Uc3QO jAkZpvACWGb+olrsmMK0Wjugabgb8Vj19L8beCbGz4jjjVdqCIsSuxC45+2jLX20lMnMDL1WKqXt+ 9ZQ1gLokN/vpdGIH4UxGRrRWHUEEnXG5Ebw4/LWzcZO0ptjMkJBfeN2EQdLnq5osMo1kS2tKf1Rsy Ve7iNR3TnoZGwIs3LmQ6JmHyjaNzp7LThKW46gAELOSf9BoAV/CyL/wgXlVxWHhtA9tBPzcA9Jgd6 xihpbbLDZ2fwST6iF9TQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jC5jg-0004wq-9e; Wed, 11 Mar 2020 18:05:40 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jC5iR-0002Yq-Im for linux-arm-kernel@lists.infradead.org; Wed, 11 Mar 2020 18:04:25 +0000 Received: by mail-pl1-x641.google.com with SMTP id g12so1458672plo.3 for ; Wed, 11 Mar 2020 11:04:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=rRlA/iukqeG70j0phoHwOcUE8Ba0KMBf/TBqK8AS108=; b=NOn7OFtfPM6Oo+/Jdq2nycgnWs6OYPGTaSyyan/J/kQV8mIifuZLXbXV1DNPi/4q7T xkdCavwV7CvKUQkNE4ywkLN+9AAvrRHEMMenUXzUKO+mEW132b2XOjIVGe5OdZyG1JKl 2uaDAGrzOi4PH6CxgAxoVzcnySW+cLkvh8p3wWmdt6+/Cxp4QOoR0fsTYIeSg9WYKfr2 F5nSEurAYgVRs2uQYBhlr0h5KciqSU9ZhQKHwN+18HuaA8xsHPSxPgUTCEiy8jpGea4p wEL7eK97PH5o8Y7FxU+IwW3vqoR26vNamv4rsnsIq9MM7v51BBZzWmheIBM25VmWzsCv EwTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rRlA/iukqeG70j0phoHwOcUE8Ba0KMBf/TBqK8AS108=; b=FXBxO4v2YSqFIMmT4SRddSQ/hPWioaddOvMC4AQC2FGpOEuH7Y43gGsR8p34Nulo40 6W6/nyHg31B3xsApmAAqAOZYbwhJ3zE324V5oKqRE4T0ZprVyJKx6Ih0w3LiDm4ogYTf weUI4n1ayloZU6jhDUkvbRFVt+Lt7V4QSxCemhWY/YW3sibibwnqHe7SSvc+CtWjJlMK 4Iu/A+eg5yaVhUR6plq5OH/clMJbTe7Z0qkoAM53ZTjxB7hIzZRfb5TtkF1TWEsrQI9u odjvKp+4B+lf7G5zvHqcQY6ClBseN0kfCaZzMPF2UKy1872MGYhVIoe7a9XsuRN93BqX KaQQ== X-Gm-Message-State: ANhLgQ0eyOhp+2opheShwk9r5o2j7+izS6OzFr0fJ8CZL3u+d6gq5tqb qTys9ajFbdoQ7zTxcuq+QUn0+iRS8PI= X-Google-Smtp-Source: ADFU+vsg7cjdYkTjf0yRL1KMyasGSTxaZ0yb0otbM4iNRplBhrB/buQQppKO/HyLYan18jdVpQKuNQ== X-Received: by 2002:a17:902:aa88:: with SMTP id d8mr4072384plr.201.1583949862608; Wed, 11 Mar 2020 11:04:22 -0700 (PDT) Received: from localhost.localdomain (97-126-123-70.tukw.qwest.net. [97.126.123.70]) by smtp.gmail.com with ESMTPSA id k9sm6079383pjo.19.2020.03.11.11.04.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 11:04:21 -0700 (PDT) From: Richard Henderson To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 4/6] arm64: uaccess: Use asm/ccset.h macros in __range_ok Date: Wed, 11 Mar 2020 11:04:14 -0700 Message-Id: <20200311180416.6509-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200311180416.6509-1-richard.henderson@linaro.org> References: <20200311180416.6509-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200311_110423_666994_6A3E8B3D X-CRM114-Status: GOOD ( 10.99 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:641 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Uses of __range_ok almost always feed a branch. This allows the compiler to use flags directly. Signed-off-by: Richard Henderson --- arch/arm64/include/asm/uaccess.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h index fe3dd70e901e..ca1acd7b95c3 100644 --- a/arch/arm64/include/asm/uaccess.h +++ b/arch/arm64/include/asm/uaccess.h @@ -22,6 +22,7 @@ #include #include #include +#include #define get_fs() (current_thread_info()->addr_limit) @@ -86,10 +87,10 @@ static inline unsigned long __range_ok(const void __user *addr, unsigned long si // comes from the carry in being clear. Otherwise, we are // testing X' - C == 0, subject to the previous adjustments. " sbcs xzr, %[addr], %[limit]\n" - " cset %[addr], ls\n" - : [addr] "=&r" (ret), [limit] "+r" (limit) + CC_SET(ls) + : [addr] "=&r" (addr), [limit] "+r" (limit), CC_OUT(ls) (ret) : [size] "Ir" (size), [addr_in] "r" (addr) - : "cc"); + : CC_CLOBBER); return ret; } From patchwork Wed Mar 11 18:04:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 11432459 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7029C92A for ; Wed, 11 Mar 2020 18:06:01 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0491920735 for ; Wed, 11 Mar 2020 18:06:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ZAbV+frY"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="NuyZoITg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0491920735 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bC6Aa3tqYhsqQwzy21wEB3e6dDO5mER4Q48fCcuRCcc=; b=ZAbV+frYqQTFGE gf6tPMGlFg9Y9njRfDwbxQErHTw8P6viIRAMrWcGzKTSJrwqO/ghUnK89Tt0/DGNpMKDaZOKiDMGU z7ysKSY40yvcQmgrnchzQYaR7xSlnq7GInEq7JS/8Z8cCyexyjbmkX1vSpRiyettSPVAyzgSMv5BZ XjulpcYOZshNHnCOh0ZiJuCodNeBHJAkvjL9sQs+QRWe7admd9F3pM+I9z9q9goU5XmNY/EJ1B1Li ri35aKGJdDvdEbaDuUWikRnZcLtipEqZwpMCaQsIAK7SB8ian6XpQ7ZVLKN7BZFwk3pdU1Zs2xgun KY10PTcGpmhR+1msaV4A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jC5jv-0005DL-N7; Wed, 11 Mar 2020 18:05:55 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jC5iT-0002aX-5p for linux-arm-kernel@lists.infradead.org; Wed, 11 Mar 2020 18:04:26 +0000 Received: by mail-pf1-x442.google.com with SMTP id c19so1753663pfo.13 for ; Wed, 11 Mar 2020 11:04:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=fKXZLI6n3/AnumpioC86wuiyj2J9DLc+W/VvwUAj/TY=; b=NuyZoITgQq1QkCFuTDBFYHPoJ5E3mEM60W24VhWOeFt5uXWIL4eIFRMO0HNuugHwuS NIGzAvsPuFFe/nsLsQAv7ptVEZFnWNHwN8nduAPoxidMahtNC9MNTD+kY8pTn6AJl6Ed sGxY6FbXIr9SWrdF1cBxx/l6mkmrpqmdoeNEyDtp5is8ewTqRYxdPgF8ziPTMRj/otKn MJ3svc6WJLl16X2MsudRoy+kM0kdCw6YI3pfBqUZLXxhgAkJh4mi2FzzW18N2Q3FmlVP SOU1zE42Z6Zz1eg20qzrlrlh1may7GM6/GGuE+J77vSSo3Y1Jzs8MRTk+GYk7Xmim44g Gskw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fKXZLI6n3/AnumpioC86wuiyj2J9DLc+W/VvwUAj/TY=; b=LGk7vWnhdCLEnHS/8jLnHEAvE5JksE01v3llDdiyJNnQAqTvQgkHLslImUsV7FsxDi VkFN238ZG8WgHWiRShEeLH7his7T7DZLnU3qCqmazIU1aBVJGg2eAcbcID1SPpWaBIHt 90eesa1nDtUYk1sMMglVQ8oPOMNP61AI2sJ39qrp0ksJza7++zhnWAa65UFqe5L4nqH1 YBlznyWHbrdwNQZzkTGhCi8CI8TxthaB0/i+m/Q98qNw0eaaPs3ixL6oA96SGbfSEcTD 32Fb0Rx0WaWDp/yQDPKWrwNbDZLWfQQOSZrx2Aj0ny2mGuP5frET3gzZlTf+OC0umGzi 6MxA== X-Gm-Message-State: ANhLgQ11F10EVZ41csi9mqTZO0rzcZ9/zqtnocwekRXjC9ElKS7NNHGL Wc22OkWtCbH2c6Y89PUyKV59JiwVerU= X-Google-Smtp-Source: ADFU+vt4j3Xt2PzLd1LAdj3UyX6Biq+53MGD4NP9QVvfuiFLcxIQtHe+Ly2n4kvFUNJiEtbHA1JvHg== X-Received: by 2002:a63:8148:: with SMTP id t69mr3892026pgd.187.1583949864103; Wed, 11 Mar 2020 11:04:24 -0700 (PDT) Received: from localhost.localdomain (97-126-123-70.tukw.qwest.net. [97.126.123.70]) by smtp.gmail.com with ESMTPSA id k9sm6079383pjo.19.2020.03.11.11.04.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 11:04:23 -0700 (PDT) From: Richard Henderson To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 5/6] arm64: archrandom: Use asm/ccset.h macros in __arm64_rndr Date: Wed, 11 Mar 2020 11:04:15 -0700 Message-Id: <20200311180416.6509-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200311180416.6509-1-richard.henderson@linaro.org> References: <20200311180416.6509-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200311_110425_256328_7438D03F X-CRM114-Status: GOOD ( 10.25 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:442 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Uses of __arm64_rndr always (indirectly) feed a branch. This allows the compiler to use flags directly. Signed-off-by: Richard Henderson --- arch/arm64/include/asm/archrandom.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/arm64/include/asm/archrandom.h b/arch/arm64/include/asm/archrandom.h index 3fe02da70004..f65df47283a6 100644 --- a/arch/arm64/include/asm/archrandom.h +++ b/arch/arm64/include/asm/archrandom.h @@ -6,6 +6,7 @@ #include #include +#include static inline bool __arm64_rndr(unsigned long *v) { @@ -17,10 +18,10 @@ static inline bool __arm64_rndr(unsigned long *v) */ asm volatile( __mrs_s("%0", SYS_RNDR_EL0) "\n" - " cset %w1, ne\n" - : "=r" (*v), "=r" (ok) + CC_SET(ne) + : "=r" (*v), CC_OUT(ne) (ok) : - : "cc"); + : CC_CLOBBER); return ok; } From patchwork Wed Mar 11 18:04:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 11432461 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B2E1F92A for ; Wed, 11 Mar 2020 18:06:16 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E51B5206E9 for ; Wed, 11 Mar 2020 18:06:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="R0eXf4G0"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="SMMeLc6A" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E51B5206E9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zsKzqClCMWaMRsPNaBkCH9BqQAqjamD3g/M+2SE8GJU=; b=R0eXf4G02OCVVD CQUPEL+0sTbcivVk4VNB9+cyxsZLG5Rl/eT9kixrC+3MuJF9AqD677eYUMmKzqaJx3qPuVOEyjDLL fMM508DDEBMnpmv2YAyvMcC6y5TtT3tvdSOs/jK8mDH46V4QEtPl+XCGz5rPPWiof2qpotCj12MYe rGAk8/AqWtD7OXomPCx7dzxUdRgk3QoYiwXaeE2plBDPwM4V8Ns0lCdOxnKqqCQC7T+XrGgbAC34h FLRBPeCdr5JvzSAArFgrUOPJ/992q5frBx6ZQ2XEn3nsuZLteDKIvAhnO7lbNrleOmvU9hfaXMTf8 TkU2UKmnx4pvWnBs0IKg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jC5kC-0005VX-5V; Wed, 11 Mar 2020 18:06:12 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jC5iU-0002c7-QU for linux-arm-kernel@lists.infradead.org; Wed, 11 Mar 2020 18:04:28 +0000 Received: by mail-pg1-x542.google.com with SMTP id c7so1623193pgw.3 for ; Wed, 11 Mar 2020 11:04:26 -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 :mime-version:content-transfer-encoding; bh=n2RB1acsyVrC96k4Nlhe94YQe83/BgfB1d2c7IOitdM=; b=SMMeLc6ANqk7GgDpftln4a/j9mrB+eEv+CrHdyUxCMWbHiwsNM4Vu+Hv2Z81JSW1Rg em0QwbcF9c3YPeaKC/frgcKaHLZZYNThqhBkYzEvl2mBJFZHmnpf9d4TLlpKl/zCawyO 6O3A53muhGGWt7u1v7HkzyRVz+URX4Prc1e99nOdOWCOSDoyc+q8epZ/iGgdqzVn0VjA rr5ytZQdieTJi44IEN7arqP3QT9YRuJ0FnfBjrTaMGNVwFnUZr6fwB8edh9CjVUFE7XL qXG95gJGUfHuJ0NTAhIpH/E+tzwDRaqKvz76dvGOy9qXwKf9RmvTYpaCnlJV8yjR+9cm kB+Q== 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:mime-version:content-transfer-encoding; bh=n2RB1acsyVrC96k4Nlhe94YQe83/BgfB1d2c7IOitdM=; b=bdKyMHVRWTkXkr692ivHkvGGOc98UoKeoCzQ8eXCO5+BfI5O2BAtZ0mVXao5cooAB0 y0jxhBsSPWpg5/tc1k5c7kKcWDAT/sFH7oShv3PrqWfhCtXsa/5zMexOF6NDdMEi4/2y N07LBkULI6rNK+JjYqfjO2FeMdoHRkG2vbgEjfq/4+oX/cQh141YklzKpINoJkBWKCA8 5pkSjqHPVHRi/RjE2890Hfv3vcPEgFf5JX/yjV4J8hSKQpwM+mgJxszAixBl9tVKhDCl LQweocuCN1lNfq/m2fPho4oeitZMDtHlUZY8ya7ncQaX71Siu7HmqH8X3zhbISf3giuC +vBw== X-Gm-Message-State: ANhLgQ2Ij4bNwywbjDUdGYyPRkalYsCwi6jRCSJptclJc/fJLrRZVNK1 CweLSKm5cWKc6OnppBi3V14jxdPYaEU= X-Google-Smtp-Source: ADFU+vvOVuCXbzRqSVX9Y2YV9cGm0eGBymYiJ5EccXW7SSrleivtZMVvNI2byIpgu9oI3a4SkJNaag== X-Received: by 2002:a62:a515:: with SMTP id v21mr4033151pfm.128.1583949865335; Wed, 11 Mar 2020 11:04:25 -0700 (PDT) Received: from localhost.localdomain (97-126-123-70.tukw.qwest.net. [97.126.123.70]) by smtp.gmail.com with ESMTPSA id k9sm6079383pjo.19.2020.03.11.11.04.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 11:04:24 -0700 (PDT) From: Richard Henderson To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 6/6] arm64: Hoist CONFIG option out of ALTERNATIVE in uaccess.h Date: Wed, 11 Mar 2020 11:04:16 -0700 Message-Id: <20200311180416.6509-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200311180416.6509-1-richard.henderson@linaro.org> References: <20200311180416.6509-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200311_110426_935696_AE4D48F1 X-CRM114-Status: GOOD ( 12.48 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:542 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Richard Henderson The placement of the CONFIG check, within the asm, is less than ideal within uaccess.h. When we have if (cond) asm("something") and "something" turns out to be empty, the if cannot be removed by the compiler. Signed-off-by: Richard Henderson Acked-by: Mark Rutland --- arch/arm64/include/asm/uaccess.h | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h index ca1acd7b95c3..90be003101f4 100644 --- a/arch/arm64/include/asm/uaccess.h +++ b/arch/arm64/include/asm/uaccess.h @@ -43,11 +43,14 @@ static inline void set_fs(mm_segment_t fs) * Enable/disable UAO so that copy_to_user() etc can access * kernel memory with the unprivileged instructions. */ - if (IS_ENABLED(CONFIG_ARM64_UAO) && fs == KERNEL_DS) - asm(ALTERNATIVE("nop", SET_PSTATE_UAO(1), ARM64_HAS_UAO)); - else - asm(ALTERNATIVE("nop", SET_PSTATE_UAO(0), ARM64_HAS_UAO, - CONFIG_ARM64_UAO)); + if (IS_ENABLED(CONFIG_ARM64_UAO)) { + if (fs == KERNEL_DS) + asm(ALTERNATIVE("nop", SET_PSTATE_UAO(1), + ARM64_HAS_UAO)); + else + asm(ALTERNATIVE("nop", SET_PSTATE_UAO(0), + ARM64_HAS_UAO)); + } } #define segment_eq(a, b) ((a) == (b)) @@ -178,28 +181,26 @@ static inline bool uaccess_ttbr0_enable(void) static inline void __uaccess_disable_hw_pan(void) { - asm(ALTERNATIVE("nop", SET_PSTATE_PAN(0), ARM64_HAS_PAN, - CONFIG_ARM64_PAN)); + if (IS_ENABLED(CONFIG_ARM64_PAN)) + asm(ALTERNATIVE("nop", SET_PSTATE_PAN(0), ARM64_HAS_PAN)); } static inline void __uaccess_enable_hw_pan(void) { - asm(ALTERNATIVE("nop", SET_PSTATE_PAN(1), ARM64_HAS_PAN, - CONFIG_ARM64_PAN)); + if (IS_ENABLED(CONFIG_ARM64_PAN)) + asm(ALTERNATIVE("nop", SET_PSTATE_PAN(1), ARM64_HAS_PAN)); } #define __uaccess_disable(alt) \ do { \ - if (!uaccess_ttbr0_disable()) \ - asm(ALTERNATIVE("nop", SET_PSTATE_PAN(1), alt, \ - CONFIG_ARM64_PAN)); \ + if (IS_ENABLED(CONFIG_ARM64_PAN) && !uaccess_ttbr0_disable()) \ + asm(ALTERNATIVE("nop", SET_PSTATE_PAN(1), alt)); \ } while (0) #define __uaccess_enable(alt) \ do { \ - if (!uaccess_ttbr0_enable()) \ - asm(ALTERNATIVE("nop", SET_PSTATE_PAN(0), alt, \ - CONFIG_ARM64_PAN)); \ + if (IS_ENABLED(CONFIG_ARM64_PAN) && !uaccess_ttbr0_enable()) \ + asm(ALTERNATIVE("nop", SET_PSTATE_PAN(0), alt)); \ } while (0) static inline void uaccess_disable(void)