KVM: arm64: Use fallback mapping sizes for contiguous huge page sizes
Although huge pages can be created out of multiple contiguous PMDs or PTEs, the corresponding sizes are not supported at Stage-2 yet. Instead of failing the mapping, fall back to the nearer supported mapping size (CONT_PMD to PMD and CONT_PTE to PTE respectively). Suggested-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Gavin Shan <gshan@redhat.com> [maz: rewritten commit message] Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20201025230626.18501-1-gshan@redhat.com
This commit is contained in:
parent
e2fc6a9f68
commit
2f40c46021
@ -787,14 +787,26 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
|
|||||||
vma_shift = PAGE_SHIFT;
|
vma_shift = PAGE_SHIFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vma_shift == PUD_SHIFT &&
|
switch (vma_shift) {
|
||||||
!fault_supports_stage2_huge_mapping(memslot, hva, PUD_SIZE))
|
case PUD_SHIFT:
|
||||||
vma_shift = PMD_SHIFT;
|
if (fault_supports_stage2_huge_mapping(memslot, hva, PUD_SIZE))
|
||||||
|
break;
|
||||||
if (vma_shift == PMD_SHIFT &&
|
fallthrough;
|
||||||
!fault_supports_stage2_huge_mapping(memslot, hva, PMD_SIZE)) {
|
case CONT_PMD_SHIFT:
|
||||||
force_pte = true;
|
vma_shift = PMD_SHIFT;
|
||||||
|
fallthrough;
|
||||||
|
case PMD_SHIFT:
|
||||||
|
if (fault_supports_stage2_huge_mapping(memslot, hva, PMD_SIZE))
|
||||||
|
break;
|
||||||
|
fallthrough;
|
||||||
|
case CONT_PTE_SHIFT:
|
||||||
vma_shift = PAGE_SHIFT;
|
vma_shift = PAGE_SHIFT;
|
||||||
|
force_pte = true;
|
||||||
|
fallthrough;
|
||||||
|
case PAGE_SHIFT:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
WARN_ONCE(1, "Unknown vma_shift %d", vma_shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
vma_pagesize = 1UL << vma_shift;
|
vma_pagesize = 1UL << vma_shift;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user