From fa96b5be92e5639f34b0e0509788a1e23909195e Mon Sep 17 00:00:00 2001 From: Quentin Perret Date: Tue, 29 Mar 2022 13:29:28 +0100 Subject: [PATCH] ANDROID: KVM: arm64: Explicitely map kvm_vgic_global_state at EL2 The pkvm hypervisor may need to read the kvm_vgic_global_state variable at EL2. Make sure to explicitely map it in the its stage-1 page-table rather than relying on mapping all of .rodata. Signed-off-by: Quentin Perret Bug: 225169428 Change-Id: I72d1eba78fb6b7593d236539cd81269480856fdf --- arch/arm64/kvm/hyp/nvhe/setup.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm64/kvm/hyp/nvhe/setup.c b/arch/arm64/kvm/hyp/nvhe/setup.c index 18638652f06d..cc2dc27488e0 100644 --- a/arch/arm64/kvm/hyp/nvhe/setup.c +++ b/arch/arm64/kvm/hyp/nvhe/setup.c @@ -150,6 +150,10 @@ static int recreate_hyp_mappings(phys_addr_t phys, unsigned long size, if (ret) return ret; + ret = pkvm_create_mappings(&kvm_vgic_global_state, &kvm_vgic_global_state + 1, prot); + if (ret) + return ret; + start = hyp_phys_to_virt(pvmfw_base); end = start + pvmfw_size; prot = pkvm_mkstate(PAGE_HYP, PKVM_PAGE_OWNED);