Skip to contentSkip to conversation

KVM: arm64: Fix build error in user_mem_abort()

PATCH Applied Gavin Shan 2 participants 2 messages Nov 3, 2020 – Nov 6, 2020

Subsystems (2)
lore
Share & tools
lore

Gavin Shan

author
#0 lore raw

PATCH 1/1 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 2f40c46021bbb ("KVM: arm64: Use fallback mapping sizes for contiguous huge page sizes")
---
 arch/arm64/kvm/mmu.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/kvm/mmu.c +2 -0
index 57972bdb213a..1a01da9fdc99 100644
@@ -788,10 +788,12 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
 	}
 
 	switch (vma_shift) {
+#ifndef __PAGETABLE_PMD_FOLDED
 	case PUD_SHIFT:
 		if (fault_supports_stage2_huge_mapping(memslot, hva, PUD_SIZE))
 			break;
 		fallthrough;
+#endif
 	case CONT_PMD_SHIFT:
 		vma_shift = PMD_SHIFT;
 		fallthrough;
Signature · 6 lines
2.23.0

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
maintainer Applied
#1 lore raw
Quoted 9 lines · Gavin Shan

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

[...]

Applied to next, thanks!

[1/1] KVM: arm64: Fix build error in user_mem_abort()

      commit: faf000397e7f103df9953a312e1df21df1dc797f

Cheers,

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.