summaryrefslogtreecommitdiffstats
path: root/arch/arm64
diff options
context:
space:
mode:
authorMarc Zyngier <marc.zyngier@arm.com>2017-06-06 19:08:34 +0100
committerBen Hutchings <ben@decadent.org.uk>2017-09-15 18:30:04 +0100
commit5e5c8768a5d2bce30d263e8844dfd2a69be33f41 (patch)
tree9ab5347d1df97a17c3517d637eb40cadba2db47d /arch/arm64
parent79e1a7e336277c2e47b6844a8b7a9a38cc4f9e9b (diff)
downloadlinux-stable-5e5c8768a5d2bce30d263e8844dfd2a69be33f41.tar.gz
linux-stable-5e5c8768a5d2bce30d263e8844dfd2a69be33f41.tar.bz2
linux-stable-5e5c8768a5d2bce30d263e8844dfd2a69be33f41.zip
arm64: KVM: Allow unaligned accesses at EL2
commit 78fd6dcf11468a5a131b8365580d0c613bcc02cb upstream. We currently have the SCTLR_EL2.A bit set, trapping unaligned accesses at EL2, but we're not really prepared to deal with it. So far, this has been unnoticed, until GCC 7 started emitting those (in particular 64bit writes on a 32bit boundary). Since the rest of the kernel is pretty happy about that, let's follow its example and set SCTLR_EL2.A to zero. Modern CPUs don't really care. Reported-by: Alexander Graf <agraf@suse.de> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Christoffer Dall <cdall@linaro.org> [bwh: Backported to 3.16: s/ELx/EL2/] Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'arch/arm64')
-rw-r--r--arch/arm64/kvm/hyp-init.S5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/arm64/kvm/hyp-init.S b/arch/arm64/kvm/hyp-init.S
index a409482fc19b..29c47f7d6ecf 100644
--- a/arch/arm64/kvm/hyp-init.S
+++ b/arch/arm64/kvm/hyp-init.S
@@ -86,9 +86,10 @@ __do_hyp_init:
/*
* Preserve all the RES1 bits while setting the default flags,
- * as well as the EE bit on BE.
+ * as well as the EE bit on BE. Drop the A flag since the compiler
+ * is allowed to generate unaligned accesses.
*/
- ldr x4, =(SCTLR_EL2_RES1 | SCTLR_EL2_FLAGS)
+ ldr x4, =(SCTLR_EL2_RES1 | (SCTLR_EL2_FLAGS & ~SCTLR_EL2_A))
CPU_BE( orr x4, x4, #SCTLR_EL2_EE)
msr sctlr_el2, x4
isb