KVM: arm64: Stop save/restoring host tpidr_el1 on VHE
authorJames Morse <james.morse@arm.com>
Fri, 20 Jul 2018 09:52:55 +0000 (10:52 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 22 Jul 2018 12:28:50 +0000 (14:28 +0200)
commit286950e0831b9bf7180c09b2dd06ec88922fcc12
tree72f2ea515056a9cf4acfa14acbd7a762d69cfe60
parent0dac9f10d9525f9617eaf383e1629ae976e2f170
KVM: arm64: Stop save/restoring host tpidr_el1 on VHE

Commit 1f742679c33bc083722cb0b442a95d458c491b56 upstream.

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>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/kvm/hyp-init.S
arch/arm64/kvm/hyp/s2-setup.c
arch/arm64/kvm/hyp/sysreg-sr.c