summaryrefslogtreecommitdiff
path: root/arch/arm64/kvm/va_layout.c
diff options
context:
space:
mode:
authorMarc Zyngier <maz@kernel.org>2021-03-22 12:09:51 +0000
committerMarc Zyngier <maz@kernel.org>2021-03-25 11:00:33 +0000
commit755db23420a1ce4b740186543432983e9bbe713e (patch)
treeae61e46ebac9d8b0857e4a91aca47128b99076f5 /arch/arm64/kvm/va_layout.c
parent90134ac9cabb69972d0a509bf08e108a73442184 (diff)
KVM: arm64: Generate final CTR_EL0 value when running in Protected mode
In protected mode, late CPUs are not allowed to boot (enforced by the PSCI relay). We can thus specialise the read_ctr macro to always return a pre-computed, sanitised value. Special care is taken to prevent the use of this custome version outside of the protected mode. Reviewed-by: Quentin Perret <qperret@google.com> Signed-off-by: Marc Zyngier <maz@kernel.org>
Diffstat (limited to 'arch/arm64/kvm/va_layout.c')
-rw-r--r--arch/arm64/kvm/va_layout.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/arm64/kvm/va_layout.c b/arch/arm64/kvm/va_layout.c
index 978301392d67..acdb7b3cc97d 100644
--- a/arch/arm64/kvm/va_layout.c
+++ b/arch/arm64/kvm/va_layout.c
@@ -288,3 +288,10 @@ void kvm_get_kimage_voffset(struct alt_instr *alt,
{
generate_mov_q(kimage_voffset, origptr, updptr, nr_inst);
}
+
+void kvm_compute_final_ctr_el0(struct alt_instr *alt,
+ __le32 *origptr, __le32 *updptr, int nr_inst)
+{
+ generate_mov_q(read_sanitised_ftr_reg(SYS_CTR_EL0),
+ origptr, updptr, nr_inst);
+}