RISC-V KVM checks memslot alignment and head/tail coverage before
installing THP-backed PMD G-stage block mappings, but the hugetlb path
has used the hugetlb VMA size directly. That can be wrong for memslots
whose HVA and GPA have different offsets within the target block, or for
partial head/tail blocks.
Generalize the existing block eligibility helper so it can check a
caller-provided target size, use it to select hugetlb mappings with a
PUD -> PMD -> PAGE_SIZE fallback, and add a selftest mode that creates a
hugetlb memslot with a deliberate HVA/GPA offset mismatch.
Jinyu Tang (3):
KVM: riscv: Pass the target size to huge G-stage checks
KVM: riscv: Check hugetlb block mappings against memslot bounds
KVM: selftests: Add a hugetlb memslot alignment test mode
arch/riscv/kvm/mmu.c | 53 +++++++++++++++----
.../selftests/kvm/kvm_page_table_test.c | 28 +++++++---
2 files changed, 65 insertions(+), 16 deletions(-)
--
2.43.0