Skip to content

Commit 7a16142

Browse files
ouptonbonzini
authored andcommitted
KVM: arm64: selftests: Don't identity map the ucall MMIO hole
Currently the ucall MMIO hole is placed immediately after slot0, which is a relatively safe address in the PA space. However, it is possible that the same address has already been used for something else (like the guest program image) in the VA space. At least in my own testing, building the vgic_irq test with clang leads to the MMIO hole appearing underneath gicv3_ops. Stop identity mapping the MMIO hole and instead find an unused VA to map to it. Yet another subtle detail of the KVM selftests library is that virt_pg_map() does not update vm->vpages_mapped. Switch over to virt_map() instead to guarantee that the chosen VA isn't to something else. Signed-off-by: Oliver Upton <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent feb84f6 commit 7a16142

File tree

1 file changed

+4
-2
lines changed
  • tools/testing/selftests/kvm/lib/aarch64

1 file changed

+4
-2
lines changed

tools/testing/selftests/kvm/lib/aarch64/ucall.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ static vm_vaddr_t *ucall_exit_mmio_addr;
1414

1515
void ucall_arch_init(struct kvm_vm *vm, vm_paddr_t mmio_gpa)
1616
{
17-
virt_pg_map(vm, mmio_gpa, mmio_gpa);
17+
vm_vaddr_t mmio_gva = vm_vaddr_unused_gap(vm, vm->page_size, KVM_UTIL_MIN_VADDR);
18+
19+
virt_map(vm, mmio_gva, mmio_gpa, 1);
1820

1921
vm->ucall_mmio_addr = mmio_gpa;
2022

21-
write_guest_global(vm, ucall_exit_mmio_addr, (vm_vaddr_t *)mmio_gpa);
23+
write_guest_global(vm, ucall_exit_mmio_addr, (vm_vaddr_t *)mmio_gva);
2224
}
2325

2426
void ucall_arch_do_ucall(vm_vaddr_t uc)

0 commit comments

Comments
 (0)