linux-next: manual merge of the kvm-arm tree with the kvm tree
From: Mark Brown
Date: Mon Oct 19 2026 - 13:30:40 EST
Hi all,
Today's linux-next merge of the kvm-arm tree got a conflict in:
arch/arm64/kvm/mmu.c
between commit:
dd0bc00e3e920 ("Merge branch kvm-arm64/cca-7.4 into kvmarm-master/next")
from the kvm tree and commits:
b44a8c32f0116 ("KVM: arm64: Abstract out memory abort handling")
892c8a0bcc8e3 ("Merge branch kvm-arm64/cca-7.4 into kvmarm-master/next")
from the kvm-arm tree.
I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.
diff --combined arch/arm64/kvm/mmu.c
index 6e28ded84b4d2,c9622b6e4c741..0000000000000
--- a/arch/arm64/kvm/mmu.c
+++ b/arch/arm64/kvm/mmu.c
@@@ -329,6 -329,9 +329,9 @@@ static void kvm_vm_stage2_unmap_range(s
struct kvm *kvm = kvm_s2_mmu_to_kvm(mmu);
int (*fn)(struct kvm_pgtable *, u64, u64);
+ lockdep_assert_held_write(&kvm->mmu_lock);
+ WARN_ON(size & ~PAGE_MASK);
+
if (kvm_is_nested_s2_mmu(kvm, mmu))
fn = kvm_pgtable_stage2_unmap_tracked;
else
@@@ -1585,11 -1588,32 +1588,11 @@@ transparent_hugepage_adjust(const struc
return PAGE_SIZE;
}
-static int get_vma_page_shift(struct vm_area_struct *vma, unsigned long hva)
+static int get_vma_page_shift(struct vm_area_struct *vma)
{
- unsigned long pa;
-
- if (is_vm_hugetlb_page(vma) && !(vma->vm_flags & VM_PFNMAP))
+ if (vma_is_hugetlb(vma))
return huge_page_shift(hstate_vma(vma));
- if (!(vma->vm_flags & VM_PFNMAP))
- return PAGE_SHIFT;
-
- VM_BUG_ON(is_vm_hugetlb_page(vma));
-
- pa = (vma->vm_pgoff << PAGE_SHIFT) + (hva - vma->vm_start);
-
-#ifndef __PAGETABLE_PMD_FOLDED
- if ((hva & (PUD_SIZE - 1)) == (pa & (PUD_SIZE - 1)) &&
- ALIGN_DOWN(hva, PUD_SIZE) >= vma->vm_start &&
- ALIGN(hva, PUD_SIZE) <= vma->vm_end)
- return PUD_SHIFT;
-#endif
-
- if ((hva & (PMD_SIZE - 1)) == (pa & (PMD_SIZE - 1)) &&
- ALIGN_DOWN(hva, PMD_SIZE) >= vma->vm_start &&
- ALIGN(hva, PMD_SIZE) <= vma->vm_end)
- return PMD_SHIFT;
-
return PAGE_SHIFT;
}
@@@ -1927,7 -1951,7 +1930,7 @@@ static short kvm_s2_resolve_vma_size(co
vma_shift = PAGE_SHIFT;
} else {
s2vi->max_map_size = PUD_SIZE;
- vma_shift = get_vma_page_shift(vma, s2fd->hva);
+ vma_shift = get_vma_page_shift(vma);
}
switch (vma_shift) {
@@@ -2078,6 -2102,16 +2081,6 @@@ static int kvm_s2_fault_pin_pfn(const s
return -EFAULT;
}
} else {
- /*
- * If the page was identified as device early by looking at
- * the VMA flags, vma_pagesize is already representing the
- * largest quantity we can map. If instead it was mapped
- * via __kvm_faultin_pfn(), vma_pagesize is set to PAGE_SIZE
- * and must not be upgraded.
- *
- * In both cases, we don't let transparent_hugepage_adjust()
- * change things at the last minute.
- */
s2vi->map_non_cacheable = true;
}
@@@ -2179,10 -2213,10 +2182,10 @@@ static int kvm_s2_fault_map(const struc
/*
* If we are not forced to use page mapping, check if we are
- * backed by a THP and thus use block mapping if possible.
+ * backed by a huge stage-1 mapping and thus use block mapping if
+ * possible.
*/
- if (mapping_size == PAGE_SIZE &&
- !(s2vi->max_map_size == PAGE_SIZE || s2vi->map_non_cacheable)) {
+ if (mapping_size == PAGE_SIZE && s2vi->max_map_size != PAGE_SIZE) {
if (perm_fault_granule > PAGE_SIZE) {
mapping_size = perm_fault_granule;
} else {
@@@ -2276,6 -2310,10 +2279,6 @@@ static int user_mem_abort(const struct
return ret;
}
- /*
- * Let's check if we will get back a huge page backed by hugetlbfs, or
- * get block mapping for device MMIO region.
- */
ret = kvm_s2_fault_pin_pfn(s2fd, &s2vi);
if (ret == -EHWPOISON) {
/* If result is specified, let the caller handle this. */
@@@ -2298,9 -2336,11 +2301,11 @@@
static int kvm_vm_mem_abort(const struct kvm_s2_fault_desc *s2fd)
{
- VM_WARN_ON_ONCE(kvm_s2_fault_is_perm(s2fd) &&
- !esr_abt_is_write_fault(s2fd->esr) &&
- !kvm_s2_fault_is_exec(s2fd));
+ struct kvm_vcpu *vcpu = s2fd->vcpu;
+
+ VM_WARN_ON_ONCE(kvm_vcpu_trap_is_permission_fault(vcpu) &&
+ !kvm_is_write_fault(vcpu) &&
+ !esr_abt_is_exec_fault(kvm_vcpu_get_esr(vcpu)));
if (kvm_slot_has_gmem(s2fd->memslot))
return gmem_abort(s2fd, NULL);
@@@ -2953,18 -2993,18 +2958,18 @@@ void kvm_set_way_flush(struct kvm_vcpu
/*
* If this is the first time we do a S/W operation
- * (i.e. HCR_TVM not set) flush the whole memory, and set the
+ * (i.e. HCR_EL2_TVM not set) flush the whole memory, and set the
* VM trapping.
*
* Otherwise, rely on the VM trapping to wait for the MMU +
* Caches to be turned off. At that point, we'll be able to
* clean the caches again.
*/
- if (!(hcr & HCR_TVM)) {
+ if (!(hcr & HCR_EL2_TVM)) {
trace_kvm_set_way_flush(*vcpu_pc(vcpu),
vcpu_has_cache_enabled(vcpu));
stage2_flush_vm(vcpu->kvm);
- *vcpu_hcr(vcpu) = hcr | HCR_TVM;
+ *vcpu_hcr(vcpu) = hcr | HCR_EL2_TVM;
}
}
@@@ -2982,7 -3022,7 +2987,7 @@@ void kvm_toggle_cache(struct kvm_vcpu *
/* Caches are now on, stop trapping VM ops (until a S/W op) */
if (now_enabled)
- *vcpu_hcr(vcpu) &= ~HCR_TVM;
+ *vcpu_hcr(vcpu) &= ~HCR_EL2_TVM;
trace_kvm_toggle_cache(*vcpu_pc(vcpu), was_enabled, now_enabled);
}
Attachment:
signature.asc
Description: PGP signature