]> git.ipfire.org Git - thirdparty/linux.git/commit
mshv: Align huge page stride with guest mapping
authorStanislav Kinsburskii <skinsburskii@linux.microsoft.com>
Wed, 7 Jan 2026 18:45:43 +0000 (18:45 +0000)
committerWei Liu <wei.liu@kernel.org>
Thu, 15 Jan 2026 07:10:27 +0000 (07:10 +0000)
commit259add0d982cbe83170f0c2a9f160834f0f83dd4
tree0a4ea79eaa16a9150984e2f116979de651397f4c
parent49f49d47af67f8a7b221db1d758fc634242dc91a
mshv: Align huge page stride with guest mapping

Ensure that a stride larger than 1 (huge page) is only used when page
points to a head of a huge page and both the guest frame number (gfn) and
the operation size (page_count) are aligned to the huge page size
(PTRS_PER_PMD). This matches the hypervisor requirement that map/unmap
operations for huge pages must be guest-aligned and cover a full huge page.

Add mshv_chunk_stride() to encapsulate this alignment and page-order
validation, and plumb a huge_page flag into the region chunk handlers.
This prevents issuing large-page map/unmap/share operations that the
hypervisor would reject due to misaligned guest mappings.

Fixes: abceb4297bf8 ("mshv: Fix huge page handling in memory region traversal")
Signed-off-by: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
Reviewed-by: Nuno Das Neves <nunodasneves@linux.microsoft.com>
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
drivers/hv/mshv_regions.c