summaryrefslogtreecommitdiffstats
path: root/arch/arm64/kvm/hyp-init.S
diff options
context:
space:
mode:
authorJames Morse <james.morse@arm.com>2018-01-08 15:38:07 +0000
committerCatalin Marinas <catalin.marinas@arm.com>2018-01-13 10:44:40 +0000
commit1f742679c33bc083722cb0b442a95d458c491b56 (patch)
tree1b74923a27d7239a010fd16aadf30ed3014f6f1a /arch/arm64/kvm/hyp-init.S
parent6d99b68933fbcf51f84fcbba49246ce1209ec193 (diff)
downloadlinux-1f742679c33bc083722cb0b442a95d458c491b56.tar.bz2
KVM: arm64: Stop save/restoring host tpidr_el1 on VHE
Now that a VHE host uses tpidr_el2 for the cpu offset we no longer need KVM to save/restore tpidr_el1. Move this from the 'common' code into the non-vhe code. While we're at it, on VHE we don't need to save the ELR or SPSR as kernel_entry in entry.S will have pushed these onto the kernel stack, and will restore them from there. Move these to the non-vhe code as we need them to get back to the host. Finally remove the always-copy-tpidr we hid in the stage2 setup code, cpufeature's enable callback will do this for VHE, we only need KVM to do it for non-vhe. Add the copy into kvm-init instead. Signed-off-by: James Morse <james.morse@arm.com> Reviewed-by: Christoffer Dall <cdall@linaro.org> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/kvm/hyp-init.S')
-rw-r--r--arch/arm64/kvm/hyp-init.S4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/arm64/kvm/hyp-init.S b/arch/arm64/kvm/hyp-init.S
index 33c40b3eea01..8a00de187e56 100644
--- a/arch/arm64/kvm/hyp-init.S
+++ b/arch/arm64/kvm/hyp-init.S
@@ -120,6 +120,10 @@ CPU_BE( orr x4, x4, #SCTLR_ELx_EE)
kern_hyp_va x2
msr vbar_el2, x2
+ /* copy tpidr_el1 into tpidr_el2 for use by HYP */
+ mrs x1, tpidr_el1
+ msr tpidr_el2, x1
+
/* Hello, World! */
eret
ENDPROC(__kvm_hyp_init)