From patchwork Mon May 14 09:46:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 135719 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1535893lji; Mon, 14 May 2018 02:52:03 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpQ+MHfzM3gCuEETt//p5/EUU0R7bCRN2ccVBdsUgYHBAV72L1hQH6kelmmX3P5m4NzGw0x X-Received: by 2002:a62:d717:: with SMTP id b23-v6mr9668601pfh.5.1526291522992; Mon, 14 May 2018 02:52:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526291522; cv=none; d=google.com; s=arc-20160816; b=c0+Qd+TP67JQ8AyyQ5RtXRmXNZgzTOSKHH3Lu6iCIsdOrPGLAeLNzoyMixn+ZmokJf LTw4ThKKjEK9t9XOAwQvCPIRh74qVQY9gJkWIiT/vGHKXBf4JPiDPZ3rOWTT8vFmsaEE 66rIXaC3BXgU6JUXF8Rvo+CSrWcJVXkQPNSoDrIIlAEVBOxSKsLzV3Ko/KYrOYJcE2RC c2DjtGbO/I3WK4SuOzrowaRMKkJwRzVQHfgTRWJb/EPj+ne0ktuk1FkJLYEvDkWWzoi/ t1VXwQQoyTTgL6DyRrsc5R2BS4ySv8GUc2J2r0/7Jx0Q8qOU2JWCxzDIPI71H0dsamZr zVPw== 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:arc-authentication-results; bh=RUreloWr4aBLuOGap5agex0r819D384koFElTjTf+vU=; b=h+87+Gbi8DZcZE9FtK0vqKrcajj8JOCZ/IYwGdx3HEWlq9c/b4+HFmiKE7bkFPLXsv ciAOP9MWXLXHCkuWtH3I8Ajo8R7FAqNLL0VXwf3UkvNW2KRvXYbSijyS5BgFT5XMxKZU x2OYdgClGK93Vw8vCMoYrY0ilBKPkyeaiV7Wi+kuU/VJNtqpkYcmG/tTHVe+HsHC4aWb k+l4+HEXuAKRKLnzWQ8QTDxml4c3Q01HYqZP3VdA2isEyCmAl9oZDZXJTdJ4w/0+bfFp cxf9PQ6rOM2prvGoLkl4N7bJ4vJz+Niul5Os/4aBgv1QDWcZQnOf+76Qabcsoq6Em5ro uALw== 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 34-v6si9076344plp.409.2018.05.14.02.52.02; Mon, 14 May 2018 02:52:02 -0700 (PDT) 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 S1752728AbeENJwA (ORCPT + 29 others); Mon, 14 May 2018 05:52:00 -0400 Received: from foss.arm.com ([217.140.101.70]:38240 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752411AbeENJrf (ORCPT ); Mon, 14 May 2018 05:47:35 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1201F15AB; Mon, 14 May 2018 02:47:35 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 251703F25D; Mon, 14 May 2018 02:47:33 -0700 (PDT) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, catalin.marinas@arm.com, dave.martin@arm.com, james.morse@arm.com, linux@dominikbrodowski.net, linux-fsdevel@vger.kernel.org, marc.zyngier@arm.com, mark.rutland@arm.com, viro@zeniv.linux.org.uk, will.deacon@arm.com Subject: [PATCH 05/18] arm64: kill change_cpacr() Date: Mon, 14 May 2018 10:46:27 +0100 Message-Id: <20180514094640.27569-6-mark.rutland@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180514094640.27569-1-mark.rutland@arm.com> References: <20180514094640.27569-1-mark.rutland@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that we have sysreg_clear_set(), we can use this instead of change_cpacr(). Note that the order of the set and clear arguments differs between change_cpacr() and sysreg_clear_set(), so these are flipped as part of the conversion. Also, sve_user_enable() redundantly clears CPACR_EL1_ZEN_EL0EN before setting it; this is removed for clarity. Signed-off-by: Mark Rutland Cc: Catalin Marinas Cc: Dave Martin Cc: James Morse Cc: Will Deacon --- arch/arm64/kernel/fpsimd.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) -- 2.11.0 Reviewed-by: Dave Martin diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index 87a35364e750..088940387a4d 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c @@ -172,23 +172,14 @@ static void *sve_pffr(struct task_struct *task) sve_ffr_offset(task->thread.sve_vl); } -static void change_cpacr(u64 val, u64 mask) -{ - u64 cpacr = read_sysreg(CPACR_EL1); - u64 new = (cpacr & ~mask) | val; - - if (new != cpacr) - write_sysreg(new, CPACR_EL1); -} - static void sve_user_disable(void) { - change_cpacr(0, CPACR_EL1_ZEN_EL0EN); + sysreg_clear_set(cpacr_el1, CPACR_EL1_ZEN_EL0EN, 0); } static void sve_user_enable(void) { - change_cpacr(CPACR_EL1_ZEN_EL0EN, CPACR_EL1_ZEN_EL0EN); + sysreg_clear_set(cpacr_el1, 0, CPACR_EL1_ZEN_EL0EN); } /*