KVM: arm64: selftests: Test a THP whose first fault is on a tail page

On a host whose PMD level is folded, KVM mapped host memory past a THP
when the guest first touched the THP at a page other than its first.

Add a scenario for that case. The guest writes to the second host page
of a memslot backed by one THP, then reads the first address past the
memslot. The test checks that the write landed in that page, and that
the read exits to userspace as MMIO. On a host whose PMD level isn't
folded, the scenario passes with or without the fix. It doesn't use
hugetlb pages, so it runs before the probe that skips the rest of the
test when they aren't reserved.

Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
Link: https://patch.msgid.link/20261123103505.1006067-3-fuad.tabba@linux.dev
Signed-off-by: Marc Zyngier <maz@kernel.org>
1 file changed