Commit 5e5c8768 authored by Marc Zyngier's avatar Marc Zyngier Committed by Ben Hutchings

arm64: KVM: Allow unaligned accesses at EL2

commit 78fd6dcf 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: default avatarAlexander Graf <agraf@suse.de>
Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
Signed-off-by: default avatarChristoffer Dall <cdall@linaro.org>
[bwh: Backported to 3.16: s/ELx/EL2/]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 79e1a7e3
...@@ -86,9 +86,10 @@ __do_hyp_init: ...@@ -86,9 +86,10 @@ __do_hyp_init:
/* /*
* Preserve all the RES1 bits while setting the default flags, * 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) CPU_BE( orr x4, x4, #SCTLR_EL2_EE)
msr sctlr_el2, x4 msr sctlr_el2, x4
isb isb
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment