]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
vfio: selftests: Align BAR mmaps for efficient IOMMU mapping
authorAlex Mastro <amastro@fb.com>
Wed, 14 Jan 2026 18:57:17 +0000 (10:57 -0800)
committerAlex Williamson <alex@shazbot.org>
Mon, 19 Jan 2026 17:06:30 +0000 (10:06 -0700)
commit557dbdf6c4e9c2dc3d4a4476c67ef14dca32378d
treeccf91df662c70513326a45c4cfa74cb49158b14e
parent03b7c2d763c907f508edf8c317c0e920ce072a33
vfio: selftests: Align BAR mmaps for efficient IOMMU mapping

Update vfio_pci_bar_map() to align BAR mmaps for efficient huge page
mappings. The manual mmap alignment can be removed once mmap(!MAP_FIXED)
on vfio device fds improves to automatically return well-aligned
addresses.

Also add MADV_HUGEPAGE, which encourages the kernel to use huge pages
(e.g. when /sys/kernel/mm/transparent_hugepage/enabled is set to "madvise").

Drop MAP_FILE from mmap(). It is an ignored compatibility flag.

Signed-off-by: Alex Mastro <amastro@fb.com>
Reviewed-by: David Matlack <dmatlack@google.com>
Tested-by: David Matlack <dmatlack@google.com>
Link: https://lore.kernel.org/r/20260114-map-mmio-test-v3-2-44e036d95e64@fb.com
Signed-off-by: Alex Williamson <alex@shazbot.org>
tools/testing/selftests/vfio/lib/include/libvfio.h
tools/testing/selftests/vfio/lib/libvfio.c
tools/testing/selftests/vfio/lib/vfio_pci_device.c