From patchwork Fri Jun 1 11:24: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: 137510 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp805225lji; Fri, 1 Jun 2018 04:25:08 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK0e5zG+pYtUB6Pg9slhpS3JsqR+BwGYFFyf+KDX7OAwToZtbL3iU1Vc5CopbBHTHb8lGZt X-Received: by 2002:a62:968f:: with SMTP id s15-v6mr2531892pfk.191.1527852307858; Fri, 01 Jun 2018 04:25:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527852307; cv=none; d=google.com; s=arc-20160816; b=xVhrz6UhFF3OP5IcJTRXEz7mu7rIsAwqJL8pk1toj3D7pT4th1HU9aN1b2j9u+uYdZ wY1T2qm3nCEEsY6BWlO4Wk2FXJ2cGpmHWVsZftWxqJGztvsh47wHpEWtHcYnwDytlOx6 lJs0+APeLmHZbLjs6rGtEZAAla4Y/p0tgHhSq4k8n5qbTnA2LLCVy9WXJl4BrUJ8FgE7 b+RaU8O71mW5d6yZV2OIfJQND8Zzycg4QCGaPO547+GeVwmcBofax8w1SGbzncGxft9m g6UdJhixGUhTZ4JjsHSNHOUUuOrCrx45ix1ORBLJnDjjcXh8XlN4HQF/yjesJtMpLmBi Ms9w== 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=vXe67gi0/Xn5bgoHOQowhB59VCeWEhCCYHNAfoMPk0A=; b=nnVWoYcc8VwJ7VBuoI4d43pyKVLNk+nBz/lMW7UrdrUW2s3zejXWDSCk0A9w33qNcR 92J9YytYYJfglu5D7WrPXgeT4Mbyi31uhTCM+lr2G5OXKth6Zkmw8eWpIscd3FsWkI+o eMYvuC30nIpe2C3MxskM+DLXGvmjjNOLSCZP0xPcUxflrpzU+IwyZLeYPwKKuKwbkQmH RENemzRNtdwscX6y3GWHh7tfX0pfCYzCYKzFMGpCdn+WUPeFfyfRR+Fn2FKDrVCASMnF 2pSD31XmPqJINvfLdEotGvj+LDR8Mgkzle3X0JucKLMipFNYbK2GEP1GMk1f53fHQMDR kgIQ== 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 d16-v6si18499554pll.197.2018.06.01.04.25.07; Fri, 01 Jun 2018 04:25:07 -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 S1751948AbeFALZG (ORCPT + 30 others); Fri, 1 Jun 2018 07:25:06 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:50294 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751890AbeFALZA (ORCPT ); Fri, 1 Jun 2018 07:25:00 -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 16F4D15AB; Fri, 1 Jun 2018 04:25:00 -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 DA86F3F25D; Fri, 1 Jun 2018 04:24:58 -0700 (PDT) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, will.deacon@arm.com, catalin.marinas@arm.com Cc: Mark Rutland , James Morse Subject: [PATCHv2 05/19] arm64: kill change_cpacr() Date: Fri, 1 Jun 2018 12:24:27 +0100 Message-Id: <20180601112441.37810-6-mark.rutland@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180601112441.37810-1-mark.rutland@arm.com> References: <20180601112441.37810-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 Cc: 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 3db8ed530e56..c135cff8f882 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c @@ -171,23 +171,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); } /*