Skip to content

Commit

Permalink
KVM: arm64: Explicitly map 'kvm_vgic_global_state' at EL2
Browse files Browse the repository at this point in the history
The pkvm hypervisor at EL2 may need to read the 'kvm_vgic_global_state'
variable from the host, for example when saving and restoring the state
of the virtual GIC.

Explicitly map 'kvm_vgic_global_state' in the stage-1 page-table of the
pKVM hypervisor rather than relying on mapping all of the host '.rodata'
section.

Tested-by: Vincent Donnefort <vdonnefort@google.com>
Signed-off-by: Quentin Perret <qperret@google.com>
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20221110190259.26861-24-will@kernel.org
  • Loading branch information
Quentin Perret authored and Marc Zyngier committed Nov 11, 2022
1 parent 73f38ef commit 27eb26b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions arch/arm64/kvm/hyp/nvhe/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ 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;

return 0;
}

Expand Down

0 comments on commit 27eb26b

Please sign in to comment.