Skip to content

Commit 64a1fbd

Browse files
Quentin PerretMarc Zyngier
authored andcommitted
KVM: arm64: pkvm: Make kvm_host_owns_hyp_mappings() robust to VHE
The kvm_host_owns_hyp_mappings() function should return true if and only if the host kernel is responsible for creating the hypervisor stage-1 mappings. That is only possible in standard non-VHE mode, or during boot in protected nVHE mode. But either way, none of this makes sense in VHE, so make sure to catch this case as well, hence making the function return sensible values in any context (VHE or not). Suggested-by: Marc Zyngier <[email protected]> Signed-off-by: Quentin Perret <[email protected]> Acked-by: Will Deacon <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent bff01cb commit 64a1fbd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/arm64/kvm/mmu.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,9 @@ void free_hyp_pgds(void)
239239

240240
static bool kvm_host_owns_hyp_mappings(void)
241241
{
242+
if (is_kernel_in_hyp_mode())
243+
return false;
244+
242245
if (static_branch_likely(&kvm_protected_mode_initialized))
243246
return false;
244247

0 commit comments

Comments
 (0)