Subject: linux-next: manual merge of the kvm-x86 tree with the kvm-riscv tree

From: Mark Brown <[email-masked]>
Date: Thu, 29 Jan 2026 15:00:39 +0000

Hi all,

Today's linux-next merge of the kvm-x86 tree got a conflict in:

  tools/testing/selftests/kvm/lib/riscv/processor.c

between commit:

  7631f7b1ccc9e ("KVM: riscv: selftests: Add riscv vm satp modes")

from the kvm-riscv tree and commit:

  9f073ac25b4c4 ("KVM: selftests: Add "struct kvm_mmu" to track a given MMU instance")

from the kvm-x86 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 --cc tools/testing/selftests/kvm/lib/riscv/processor.c
index 373cf4d1ed809,e6ec7c224fc3e..0000000000000
--- a/tools/testing/selftests/kvm/lib/riscv/processor.c
+++ b/tools/testing/selftests/kvm/lib/riscv/processor.c
@@@ -64,15 -68,15 +64,15 @@@ static uint64_t pte_index(struct kvm_v
  
  void virt_arch_pgd_alloc(struct kvm_vm *vm)
  {
 -	size_t nr_pages = page_align(vm, ptrs_per_pte(vm) * 8) / vm->page_size;
 +	size_t nr_pages = vm_page_align(vm, ptrs_per_pte(vm) * 8) / vm->page_size;
  
- 	if (vm->pgd_created)
+ 	if (vm->mmu.pgd_created)
  		return;
  
- 	vm->pgd = vm_phy_pages_alloc(vm, nr_pages,
- 				     KVM_GUEST_PAGE_TABLE_MIN_PADDR,
- 				     vm->memslots[MEM_REGION_PT]);
- 	vm->pgd_created = true;
+ 	vm->mmu.pgd = vm_phy_pages_alloc(vm, nr_pages,
+ 					 KVM_GUEST_PAGE_TABLE_MIN_PADDR,
+ 					 vm->memslots[MEM_REGION_PT]);
+ 	vm->mmu.pgd_created = true;
  }
  
  void virt_arch_pg_map(struct kvm_vm *vm, uint64_t vaddr, uint64_t paddr)
@@@ -220,14 -212,8 +221,14 @@@ void riscv_vcpu_mmu_setup(struct kvm_vc
  		TEST_FAIL("Unknown guest mode, mode: 0x%x", vm->mode);
  	}
  
 +	max_satp_mode = vcpu_get_reg(vcpu, RISCV_CONFIG_REG(satp_mode));
 +
 +	if ((satp_mode >> SATP_MODE_SHIFT) > max_satp_mode)
 +		TEST_FAIL("Unable to set satp mode 0x%lx, max mode 0x%lx\n",
 +			  satp_mode >> SATP_MODE_SHIFT, max_satp_mode);
 +
- 	satp = (vm->pgd >> PGTBL_PAGE_SIZE_SHIFT) & SATP_PPN;
+ 	satp = (vm->mmu.pgd >> PGTBL_PAGE_SIZE_SHIFT) & SATP_PPN;
 -	satp |= SATP_MODE_48;
 +	satp |= satp_mode;
  
  	vcpu_set_reg(vcpu, RISCV_GENERAL_CSR_REG(satp), satp);
  }