Skip to content

Commit 8531d5a

Browse files
author
Marc Zyngier
committed
KVM: arm64: pkvm: Fallback to level-3 mapping on host stage-2 fault
If, for any odd reason, we cannot converge to mapping size that is completely contained in a memblock region, we fail to install a S2 mapping and go back to the faulting instruction. Rince, repeat. This happens when faulting in regions that are smaller than a page or that do not have PAGE_SIZE-aligned boundaries (as witnessed on an O6 board that refuses to boot in protected mode). In this situation, fallback to using a PAGE_SIZE mapping anyway -- it isn't like we can go any lower. Fixes: e728e70 ("KVM: arm64: Adjust range correctly during host stage-2 faults") Link: https://lore.kernel.org/r/86wlzr77cn.wl-maz@kernel.org Cc: stable@vger.kernel.org Cc: Quentin Perret <qperret@google.com> Reviewed-by: Quentin Perret <qperret@google.com> Link: https://patch.msgid.link/20260305132751.2928138-1-maz@kernel.org Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent ac6769c commit 8531d5a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

arch/arm64/kvm/hyp/nvhe/mem_protect.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ static int host_stage2_adjust_range(u64 addr, struct kvm_mem_range *range)
518518
granule = kvm_granule_size(level);
519519
cur.start = ALIGN_DOWN(addr, granule);
520520
cur.end = cur.start + granule;
521-
if (!range_included(&cur, range))
521+
if (!range_included(&cur, range) && level < KVM_PGTABLE_LAST_LEVEL)
522522
continue;
523523
*range = cur;
524524
return 0;

0 commit comments

Comments
 (0)