From patchwork Mon Jul 2 11:04:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 140741 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3858745ljj; Mon, 2 Jul 2018 04:08:58 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcJq9uQITra4QuLDWopPCYvtIaMLBnebFZY6FtD+u+m2UXafxmGkOOl1+aYcFAEtm2VeqCS X-Received: by 2002:a17:902:da4:: with SMTP id 33-v6mr16800673plv.193.1530529737996; Mon, 02 Jul 2018 04:08:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530529737; cv=none; d=google.com; s=arc-20160816; b=qdGYj43ilYU6l5MCwXhOivMFSJ8EDwVLfe08daym939oEHjwVXVE3GMLTWylhIHJbj nP02KdaVW2tBVV9JjlAp0xpYMiXJlia398Ae6WgLOFayo5D74JwdgvdW6F6jHkO33jaC KyrXirG3+sb0o7jFHwVpiYMRHqFX3/fBJu6lwRR5g1DuvJzme3xhzmoFryfzooa4x3cu /KwWbPTJSK993AsAhOGdF633IX3aBi7gyDFCmw5zsRyPmdBflMMv56pvLjVWmhiw0JYR 7xpEGjMHfhre2AExrTPbs6DrAQ3NmSOSA0h1oykOWMFnzhwgfgIP225CzCbXyVy6o2Ec xrQQ== 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=nbK+er5HgoQSGfo6/Z1b6j32U5iuKiIZThXipRAjitI=; b=VaqMpkzZi822f7P6QmRtS8CKziYUPB59lvkoOtm32VAj819qyysNhy2UIiKCrFjNCy 5MsQKA1LTNpn877WrTIiu1qLvab1OZatYlFlvhmZa3IMbXYYP8unaw0i40rH1e6YcfOj fjqoHV1ihZZJa5Y4zzwBk2CytccFPZCTsQy8CUpYWC0P2pH75Tsh2g73gOz3+LieuwiK F96yX3AZYDH1abVhT06xW7WcoUL68eI9HaApGjnE3IouzmNsgzS3rqPmvP1I+kszbmoV /17tsPqGE7wVUiJNM6IdWkYnpWQQdEw74oopu6+v8PJiMh7QbZ8DIb5NW7EUYnUzaxIA tknA== 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 i184-v6si4375613pfg.250.2018.07.02.04.08.57; Mon, 02 Jul 2018 04:08:57 -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 S1754359AbeGBLIz (ORCPT + 31 others); Mon, 2 Jul 2018 07:08:55 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57480 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934215AbeGBLEd (ORCPT ); Mon, 2 Jul 2018 07:04:33 -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 290B51682; Mon, 2 Jul 2018 04:04:33 -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 1888E3F5BA; Mon, 2 Jul 2018 04:04:30 -0700 (PDT) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org, will.deacon@arm.com Cc: linux-kernel@vger.kernel.org, catalin.marinas@arm.com, dave.martin@arm.com, hch@infradead.org, 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 Subject: [PATCHv4 04/19] arm64: kill change_cpacr() Date: Mon, 2 Jul 2018 12:04:00 +0100 Message-Id: <20180702110415.10465-5-mark.rutland@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180702110415.10465-1-mark.rutland@arm.com> References: <20180702110415.10465-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 Reviewed-by: Dave Martin Acked-by: Catalin Marinas Cc: James Morse Cc: Will Deacon --- arch/arm64/kernel/fpsimd.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) -- 2.11.0 diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index 84c68b14f1b2..a98a7f96aff1 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c @@ -159,23 +159,14 @@ static void sve_free(struct task_struct *task) __sve_free(task); } -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); } /*