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

Mark Brown posted 1 patch 1 week, 1 day ago
linux-next: manual merge of the kvm-x86 tree with the kvm-riscv tree
Posted by Mark Brown 1 week, 1 day ago
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);
  }
Re: linux-next: manual merge of the kvm-x86 tree with the kvm-riscv tree
Posted by Mark Brown 1 week, 1 day ago
On Thu, Jan 29, 2026 at 03:00:39PM +0000, Mark Brown wrote:
> 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.

This also nsees the semantic fixup below:

From 11021bad2a6d62224d9216da62023e1a79cdd0dc Mon Sep 17 00:00:00 2001
From: Mark Brown <broonie@kernel.org>
Date: Thu, 29 Jan 2026 15:12:25 +0000
Subject: [PATCH] KVM: selftests: Fix up semantic changes

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 tools/testing/selftests/kvm/lib/kvm_util.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
index 265e173b73709..1959bf556e88e 100644
--- a/tools/testing/selftests/kvm/lib/kvm_util.c
+++ b/tools/testing/selftests/kvm/lib/kvm_util.c
@@ -359,17 +359,17 @@ struct kvm_vm *____vm_create(struct vm_shape shape)
 	case VM_MODE_P56V57_4K:
 	case VM_MODE_P50V57_4K:
 	case VM_MODE_P41V57_4K:
-		vm->pgtable_levels = 5;
+		vm->mmu.pgtable_levels = 5;
 		break;
 	case VM_MODE_P56V48_4K:
 	case VM_MODE_P50V48_4K:
 	case VM_MODE_P41V48_4K:
-		vm->pgtable_levels = 4;
+		vm->mmu.pgtable_levels = 4;
 		break;
 	case VM_MODE_P56V39_4K:
 	case VM_MODE_P50V39_4K:
 	case VM_MODE_P41V39_4K:
-		vm->pgtable_levels = 3;
+		vm->mmu.pgtable_levels = 3;
 		break;
 	default:
 		TEST_FAIL("Unknown guest mode: 0x%x", vm->mode);
-- 
2.47.3