summaryrefslogtreecommitdiffstats
path: root/arch/arm/kvm
diff options
context:
space:
mode:
authorMarc Zyngier <marc.zyngier@arm.com>2016-06-30 18:40:48 +0100
committerChristoffer Dall <christoffer.dall@linaro.org>2016-07-03 23:41:27 +0200
commite537ecd7efacaa7512e87ecb07c0c0335a902558 (patch)
tree8bec094f4c81926ae092bad1214beff82f086fc8 /arch/arm/kvm
parentcd602a37e80c791adf2a256d2aedec60b898cd51 (diff)
downloadlinux-e537ecd7efacaa7512e87ecb07c0c0335a902558.tar.bz2
arm: KVM: Allow hyp teardown
So far, KVM was getting in the way of kexec on 32bit (and the arm64 kexec hackers couldn't be bothered to fix it on 32bit...). With simpler page tables, tearing KVM down becomes very easy, so let's just do it. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Diffstat (limited to 'arch/arm/kvm')
-rw-r--r--arch/arm/kvm/arm.c3
-rw-r--r--arch/arm/kvm/init.S15
2 files changed, 17 insertions, 1 deletions
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index 9b8c53798f50..7cf266c502d6 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -1074,7 +1074,8 @@ static void cpu_hyp_reinit(void)
static void cpu_hyp_reset(void)
{
if (!is_kernel_in_hyp_mode())
- __cpu_reset_hyp_mode(kvm_get_idmap_start());
+ __cpu_reset_hyp_mode(hyp_default_vectors,
+ kvm_get_idmap_start());
}
static void _kvm_arch_hardware_enable(void *discard)
diff --git a/arch/arm/kvm/init.S b/arch/arm/kvm/init.S
index b82a99dcfb61..bf89c919efc1 100644
--- a/arch/arm/kvm/init.S
+++ b/arch/arm/kvm/init.S
@@ -112,6 +112,21 @@ __do_hyp_init:
eret
+ @ r0 : stub vectors address
+ENTRY(__kvm_hyp_reset)
+ /* We're now in idmap, disable MMU */
+ mrc p15, 4, r1, c1, c0, 0 @ HSCTLR
+ ldr r2, =(HSCTLR_M | HSCTLR_A | HSCTLR_C | HSCTLR_I)
+ bic r1, r1, r2
+ mcr p15, 4, r1, c1, c0, 0 @ HSCTLR
+
+ /* Install stub vectors */
+ mcr p15, 4, r0, c12, c0, 0 @ HVBAR
+ isb
+
+ eret
+ENDPROC(__kvm_hyp_reset)
+
.ltorg
.globl __kvm_hyp_init_end