KVM: arm64: selftests: Don't identity map the ucall MMIO hole
authorOliver Upton <oliver.upton@linux.dev>
Fri, 9 Dec 2022 01:53:04 +0000 (01:53 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 27 Dec 2022 11:00:50 +0000 (06:00 -0500)
commit7a16142505cbb9b80d5e998e32b1d882e0f45d64
tree3fde2021b1e37be9ad45c96569ac702fcb02b621
parentfeb84f6daa7e7d51444d13fa65df7d5562fd0075
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 <oliver.upton@linux.dev>
Message-Id: <20221209015307.1781352-6-oliver.upton@linux.dev>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/lib/aarch64/ucall.c