Skip to content

Commit faf0003

Browse files
Gavin ShanMarc Zyngier
authored andcommitted
KVM: arm64: Fix build error in user_mem_abort()
The PUD and PMD are folded into PGD when the following options are enabled. In that case, PUD_SHIFT is equal to PMD_SHIFT and we fail to build with the indicated errors: CONFIG_ARM64_VA_BITS_42=y CONFIG_ARM64_PAGE_SHIFT=16 CONFIG_PGTABLE_LEVELS=3 arch/arm64/kvm/mmu.c: In function ‘user_mem_abort’: arch/arm64/kvm/mmu.c:798:2: error: duplicate case value case PMD_SHIFT: ^~~~ arch/arm64/kvm/mmu.c:791:2: note: previously used here case PUD_SHIFT: ^~~~ This fixes the issue by skipping the check on PUD huge page when PUD and PMD are folded into PGD. Fixes: 2f40c46 ("KVM: arm64: Use fallback mapping sizes for contiguous huge page sizes") Reported-by: Eric Auger <eric.auger@redhat.com> Signed-off-by: Gavin Shan <gshan@redhat.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20201103003009.32955-1-gshan@redhat.com
1 parent 22f5538 commit faf0003

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

arch/arm64/kvm/mmu.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,10 +788,12 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
788788
}
789789

790790
switch (vma_shift) {
791+
#ifndef __PAGETABLE_PMD_FOLDED
791792
case PUD_SHIFT:
792793
if (fault_supports_stage2_huge_mapping(memslot, hva, PUD_SIZE))
793794
break;
794795
fallthrough;
796+
#endif
795797
case CONT_PMD_SHIFT:
796798
vma_shift = PMD_SHIFT;
797799
fallthrough;

0 commit comments

Comments
 (0)