From patchwork Fri Jun 1 11:24:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 137509 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp805193lji; Fri, 1 Jun 2018 04:25:05 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL3pWD5vwBGJF+3UMdD4CL0fBOSDE8Sgn8el1sWZCNJ+DbHtpv1qK8dMrFPFcvQodgLCZ0c X-Received: by 2002:a63:3c4c:: with SMTP id i12-v6mr8605864pgn.309.1527852305641; Fri, 01 Jun 2018 04:25:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527852305; cv=none; d=google.com; s=arc-20160816; b=mkf1V7H7i/a8fUr/IkH6LtvZPo3sDsWvgEe7JXWuh9nw3iX7P1z+948ELFpJDSyrKQ Srkku9ykq2z+ewUgj8j3Fy3XNzCIqZi7GqMnIAgtRZ6wBkPdui/pF5shSf4jLd1QN5Je hbPfpZH+9n/WYF8pLAsNhx+NCfK4IC+Z21ZIQdYuZsRTq+bFeQBmssBONPrdsLfyiKBN 0k6HyIXfxz6jP14hJPNjiRSXbIFx/OYQG+uN8muCCKW2MkGSPE09oPfQmeaKqH84xPXJ vx12Y6IbKngJM4fbNgU/q5sAQsOXHy2TvyXZBX3T8cadLszD6J9pSRQdfBy8D6urIGa9 8MVg== 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=CmW6WQdAI+cU9pjjgCxtIvQJv3vmDp4YbZlBVkPx55g=; b=qvp4iOBtcbYVFVdBVzU7Qdw4Xz2keVx3HIU3oJNUl9SPZ3rMynX94v+vZn/kdqPLCh 6RK4AW1wdcMjHrkg4nCUdM6SkL2gJaUwRrNsk1ZOEZkhczwpZLy0RuAQlA3ZX0HEd2KC m3SfSLkOZeKqUzgahvnkJD4Sm10LiTDEU3Xu5+zSQ183XpTXHMePZFcXpGkrcfBR9yLh j2G3xTfNRjiN7I+wG4Sq37piYJkiZD0gjVflvoVtKNjm1xI2/4KUjmmX7wJgUoR8HK8v wycnXiz3I4HtG3b+as56xgv6qeJyAO5AZAtfVjl8t5D0Ne7WOUQ92wKKtmFEa1x75GTb EAlw== 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.05; Fri, 01 Jun 2018 04:25:05 -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 S1751923AbeFALZD (ORCPT + 30 others); Fri, 1 Jun 2018 07:25:03 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:50288 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751599AbeFALY6 (ORCPT ); Fri, 1 Jun 2018 07:24:58 -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 367BD1650; Fri, 1 Jun 2018 04:24:58 -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 05A7D3F25D; Fri, 1 Jun 2018 04:24:56 -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 04/19] arm64: kill config_sctlr_el1() Date: Fri, 1 Jun 2018 12:24:26 +0100 Message-Id: <20180601112441.37810-5-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 consistently use this instead of config_sctlr_el1(). Signed-off-by: Mark Rutland Reviewed-by: Dave Martin Cc: Catalin Marinas Cc: James Morse Cc: Will Deacon --- arch/arm64/include/asm/sysreg.h | 10 ---------- arch/arm64/kernel/armv8_deprecated.c | 8 ++++---- arch/arm64/kernel/cpu_errata.c | 3 +-- arch/arm64/kernel/traps.c | 2 +- arch/arm64/mm/fault.c | 2 +- 5 files changed, 7 insertions(+), 18 deletions(-) -- 2.11.0 diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h index b52762769329..3493c7048994 100644 --- a/arch/arm64/include/asm/sysreg.h +++ b/arch/arm64/include/asm/sysreg.h @@ -740,16 +740,6 @@ asm( write_sysreg(__scs_new, sysreg); \ } while (0) -static inline void config_sctlr_el1(u32 clear, u32 set) -{ - u32 val; - - val = read_sysreg(sctlr_el1); - val &= ~clear; - val |= set; - write_sysreg(val, sctlr_el1); -} - #endif #endif /* __ASM_SYSREG_H */ diff --git a/arch/arm64/kernel/armv8_deprecated.c b/arch/arm64/kernel/armv8_deprecated.c index 97d45d5151d4..c15847521394 100644 --- a/arch/arm64/kernel/armv8_deprecated.c +++ b/arch/arm64/kernel/armv8_deprecated.c @@ -511,9 +511,9 @@ static int cp15barrier_handler(struct pt_regs *regs, u32 instr) static int cp15_barrier_set_hw_mode(bool enable) { if (enable) - config_sctlr_el1(0, SCTLR_EL1_CP15BEN); + sysreg_clear_set(sctlr_el1, 0, SCTLR_EL1_CP15BEN); else - config_sctlr_el1(SCTLR_EL1_CP15BEN, 0); + sysreg_clear_set(sctlr_el1, SCTLR_EL1_CP15BEN, 0); return 0; } @@ -548,9 +548,9 @@ static int setend_set_hw_mode(bool enable) return -EINVAL; if (enable) - config_sctlr_el1(SCTLR_EL1_SED, 0); + sysreg_clear_set(sctlr_el1, SCTLR_EL1_SED, 0); else - config_sctlr_el1(0, SCTLR_EL1_SED); + sysreg_clear_set(sctlr_el1, 0, SCTLR_EL1_SED); return 0; } diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c index cf37ca6fa5f2..b99e492c44b5 100644 --- a/arch/arm64/kernel/cpu_errata.c +++ b/arch/arm64/kernel/cpu_errata.c @@ -74,8 +74,7 @@ has_mismatched_cache_line_size(const struct arm64_cpu_capabilities *entry, static void cpu_enable_trap_ctr_access(const struct arm64_cpu_capabilities *__unused) { - /* Clear SCTLR_EL1.UCT */ - config_sctlr_el1(SCTLR_EL1_UCT, 0); + sysreg_clear_set(sctlr_el1, SCTLR_EL1_UCT, 0); } atomic_t arm64_el2_vector_last_slot = ATOMIC_INIT(-1); diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index 8bbdc17e49df..b8d3e0d8c616 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -411,7 +411,7 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs) void cpu_enable_cache_maint_trap(const struct arm64_cpu_capabilities *__unused) { - config_sctlr_el1(SCTLR_EL1_UCI, 0); + sysreg_clear_set(sctlr_el1, SCTLR_EL1_UCI, 0); } #define __user_cache_maint(insn, address, res) \ diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index 27cbe0b38960..07926ee00053 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c @@ -822,7 +822,7 @@ void cpu_enable_pan(const struct arm64_cpu_capabilities *__unused) */ WARN_ON_ONCE(in_interrupt()); - config_sctlr_el1(SCTLR_EL1_SPAN, 0); + sysreg_clear_set(sctlr_el1, SCTLR_EL1_SPAN, 0); asm(SET_PSTATE_PAN(1)); } #endif /* CONFIG_ARM64_PAN */