]> asedeno.scripts.mit.edu Git - linux.git/commit
arm64: KVM: Cleanup tpidr_el2 init on non-VHE
authorMarc Zyngier <marc.zyngier@arm.com>
Tue, 10 Jul 2018 12:20:47 +0000 (13:20 +0100)
committerMarc Zyngier <marc.zyngier@arm.com>
Sat, 21 Jul 2018 15:02:17 +0000 (16:02 +0100)
commit9bc03f1df31a3228289d5046780071ab8e91aa1a
treee5f245c1a5842ffee1e285aa618b04bc55a0939b
parente294cb3a6d1a8967a83b5f083d4f463e2dc28b61
arm64: KVM: Cleanup tpidr_el2 init on non-VHE

When running on a non-VHE system, we initialize tpidr_el2 to
contain the per-CPU offset required to reach per-cpu variables.

Actually, we initialize it twice: the first time as part of the
EL2 initialization, by copying tpidr_el1 into its el2 counterpart,
and another time by calling into __kvm_set_tpidr_el2.

It turns out that the first part is wrong, as it includes the
distance between the kernel mapping and the linear mapping, while
EL2 only cares about the linear mapping. This was the last vestige
of the first per-cpu use of tpidr_el2 that came in with SDEI.
The only caller then was hyp_panic(), and its now using the
pc-relative get_host_ctxt() stuff, instead of kimage addresses
from the literal pool.

It is not a big deal, as we override it straight away, but it is
slightly confusing. In order to clear said confusion, let's
set this directly as part of the hyp-init code, and drop the
ad-hoc HYP helper.

Reviewed-by: James Morse <james.morse@arm.com>
Acked-by: Christoffer Dall <christoffer.dall@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
arch/arm64/include/asm/kvm_host.h
arch/arm64/kvm/hyp-init.S
arch/arm64/kvm/hyp/sysreg-sr.c