From: geoff@infradead.org (Geoff Levand)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v16 02/20] arm64: Cleanup SCTLR flags
Date: Thu, 14 Apr 2016 21:21:36 +0000 [thread overview]
Message-ID: <be7f33adbbe78dc3bcfc821eb395a6af9a7dda34.1460668521.git.geoff@infradead.org> (raw)
In-Reply-To: <cover.1460668521.git.geoff@infradead.org>
We currently have macros defining flags for the arm64 sctlr registers in
both kvm_arm.h and sysreg.h. To clean things up and simplify move the
definitions of the SCTLR_EL2 flags from kvm_arm.h to sysreg.h, rename any
SCTLR_EL1 or SCTLR_EL2 flags that are common to both registers to be
SCTLR_ELx, with 'x' indicating a common flag, and fixup all files to
include the proper header or to use the new macro names.
Signed-off-by: Geoff Levand <geoff@infradead.org>
[Restored pgtable-hwdef.h include]
Signed-off-by: James Morse <james.morse@arm.com>
---
arch/arm64/include/asm/kvm_arm.h | 11 -----------
arch/arm64/include/asm/sysreg.h | 19 +++++++++++++++----
arch/arm64/kvm/hyp-init.S | 5 +++--
3 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h
index 4150fd8..763762e 100644
--- a/arch/arm64/include/asm/kvm_arm.h
+++ b/arch/arm64/include/asm/kvm_arm.h
@@ -84,17 +84,6 @@
#define HCR_INT_OVERRIDE (HCR_FMO | HCR_IMO)
#define HCR_HOST_VHE_FLAGS (HCR_RW | HCR_TGE | HCR_E2H)
-/* Hyp System Control Register (SCTLR_EL2) bits */
-#define SCTLR_EL2_EE (1 << 25)
-#define SCTLR_EL2_WXN (1 << 19)
-#define SCTLR_EL2_I (1 << 12)
-#define SCTLR_EL2_SA (1 << 3)
-#define SCTLR_EL2_C (1 << 2)
-#define SCTLR_EL2_A (1 << 1)
-#define SCTLR_EL2_M 1
-#define SCTLR_EL2_FLAGS (SCTLR_EL2_M | SCTLR_EL2_A | SCTLR_EL2_C | \
- SCTLR_EL2_SA | SCTLR_EL2_I)
-
/* TCR_EL2 Registers bits */
#define TCR_EL2_RES1 ((1 << 31) | (1 << 23))
#define TCR_EL2_TBI (1 << 20)
diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h
index 1287416..b3ee6f1 100644
--- a/arch/arm64/include/asm/sysreg.h
+++ b/arch/arm64/include/asm/sysreg.h
@@ -86,10 +86,21 @@
#define SET_PSTATE_UAO(x) __inst_arm(0xd5000000 | REG_PSTATE_UAO_IMM |\
(!!x)<<8 | 0x1f)
-/* SCTLR_EL1 */
-#define SCTLR_EL1_CP15BEN (0x1 << 5)
-#define SCTLR_EL1_SED (0x1 << 8)
-#define SCTLR_EL1_SPAN (0x1 << 23)
+/* Common SCTLR_ELx flags. */
+#define SCTLR_ELx_EE (1 << 25)
+#define SCTLR_ELx_I (1 << 12)
+#define SCTLR_ELx_SA (1 << 3)
+#define SCTLR_ELx_C (1 << 2)
+#define SCTLR_ELx_A (1 << 1)
+#define SCTLR_ELx_M 1
+
+#define SCTLR_ELx_FLAGS (SCTLR_ELx_M | SCTLR_ELx_A | SCTLR_ELx_C | \
+ SCTLR_ELx_SA | SCTLR_ELx_I)
+
+/* SCTLR_EL1 specific flags. */
+#define SCTLR_EL1_SPAN (1 << 23)
+#define SCTLR_EL1_SED (1 << 8)
+#define SCTLR_EL1_CP15BEN (1 << 5)
/* id_aa64isar0 */
diff --git a/arch/arm64/kvm/hyp-init.S b/arch/arm64/kvm/hyp-init.S
index 7d8747c..5ce1b47 100644
--- a/arch/arm64/kvm/hyp-init.S
+++ b/arch/arm64/kvm/hyp-init.S
@@ -21,6 +21,7 @@
#include <asm/kvm_arm.h>
#include <asm/kvm_mmu.h>
#include <asm/pgtable-hwdef.h>
+#include <asm/sysreg.h>
.text
.pushsection .hyp.idmap.text, "ax"
@@ -103,8 +104,8 @@ __do_hyp_init:
dsb sy
mrs x4, sctlr_el2
- and x4, x4, #SCTLR_EL2_EE // preserve endianness of EL2
- ldr x5, =SCTLR_EL2_FLAGS
+ and x4, x4, #SCTLR_ELx_EE // preserve endianness of EL2
+ ldr x5, =SCTLR_ELx_FLAGS
orr x4, x4, x5
msr sctlr_el2, x4
isb
--
2.5.0
next prev parent reply other threads:[~2016-04-14 21:21 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-14 21:21 [PATCH v16 00/20] arm64 kexec kernel patches v16 Geoff Levand
2016-04-14 21:21 ` [PATCH v16 05/20] arm64: hyp/kvm: Extend hyp-stub API to allow function calls at EL2 Geoff Levand
2016-04-14 21:21 ` [PATCH v16 03/20] arm64: kvm: Move the do_el2_call macro to a header file Geoff Levand
2016-04-14 21:21 ` [PATCH v16 01/20] arm64: Fold proc-macros.S into assembler.h Geoff Levand
2016-04-14 21:21 ` Geoff Levand [this message]
2016-04-14 21:21 ` [PATCH v16 04/20] arm64: kvm: Move lr save/restore from do_el2_call into EL1 Geoff Levand
2016-04-14 21:21 ` [PATCH v16 06/20] arm64: kvm: allows kvm cpu hotplug Geoff Levand
2016-04-14 21:21 ` [PATCH v16 17/20] arm64: kdump: implement machine_crash_shutdown() Geoff Levand
2016-04-14 21:21 ` [PATCH v16 13/20] arm64/kexec: Enable kexec in the arm64 defconfig Geoff Levand
2016-04-14 21:21 ` [PATCH v16 07/20] arm64: kernel: Include _AC definition in page.h Geoff Levand
2016-04-14 21:21 ` [PATCH v16 18/20] arm64: kdump: add kdump support Geoff Levand
2016-04-14 21:21 ` [PATCH v16 15/20] arm64: kdump: reserve memory for crash dump kernel Geoff Levand
2016-04-14 21:21 ` [PATCH v16 10/20] arm64: head.S: el2_setup() to accept sctlr_el1 as an argument Geoff Levand
2016-04-14 21:21 ` [PATCH v16 08/20] arm64: Promote KERNEL_START/KERNEL_END definitions to a header file Geoff Levand
2016-04-14 21:21 ` [PATCH v16 14/20] arm64/kexec: Add pr_debug output Geoff Levand
2016-04-14 21:21 ` [PATCH v16 16/20] arm64: limit memory regions based on DT property, usable-memory Geoff Levand
2016-04-14 21:21 ` [PATCH v16 12/20] arm64/kexec: Add core kexec support Geoff Levand
2016-04-14 21:21 ` [PATCH v16 11/20] arm64: Add back cpu_reset routines Geoff Levand
2016-04-14 21:21 ` [PATCH v16 09/20] arm64: Add new asm macro copy_page Geoff Levand
2016-04-14 21:21 ` [PATCH v16 20/20] arm64: kdump: update a kernel doc Geoff Levand
2016-04-14 21:21 ` [PATCH v16 19/20] arm64: kdump: enable kdump in the arm64 defconfig Geoff Levand
2016-05-12 18:24 ` [PATCH v16 00/20] arm64 kexec kernel patches v16 Julien Grall
2016-05-13 4:55 ` AKASHI Takahiro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=be7f33adbbe78dc3bcfc821eb395a6af9a7dda34.1460668521.git.geoff@infradead.org \
--to=geoff@infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).