public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Alex Mastro <amastro@fb.com>
To: Alex Williamson <alex@shazbot.org>,
	David Matlack <dmatlack@google.com>,
	Shuah Khan <shuah@kernel.org>
Cc: Peter Xu <peterx@redhat.com>, <linux-kernel@vger.kernel.org>,
	<kvm@vger.kernel.org>, <linux-kselftest@vger.kernel.org>,
	Jason Gunthorpe <jgg@ziepe.ca>, Alex Mastro <amastro@fb.com>
Subject: [PATCH v2 0/3] vfio: selftests: Add MMIO DMA mapping test
Date: Tue, 13 Jan 2026 15:08:35 -0800	[thread overview]
Message-ID: <20260113-map-mmio-test-v2-0-e6d34f09c0bb@fb.com> (raw)

Test IOMMU mapping the BAR mmaps created during vfio_pci_device_setup().

All IOMMU modes are tested: vfio_type1 variants are expected to succeed,
while non-type1 modes are expected to fail. iommufd compat mode can be
updated to expect success once kernel support lands; native iommufd will
not support mapping vaddrs backed by MMIO (it will support dma-buf based
MMIO mapping instead).

To: Alex Williamson <alex@shazbot.org>
To: David Matlack <dmatlack@google.com>
To: Shuah Khan <shuah@kernel.org>
Cc: Peter Xu <peterx@redhat.com>
Cc: linux-kernel@vger.kernel.org
Cc: kvm@vger.kernel.org
Cc: linux-kselftest@vger.kernel.org
Cc: Jason Gunthorpe <jgg@ziepe.ca>

Changes in v2:
- Split into patch series
- Factor out mmap_aligned() for vaddr alignment
- Align BAR mmaps to improve hugepage IOMMU mapping efficiency
- Centralize MODE_* string definitions
- Add is_power_of_2() assertion for BAR size
- Simplify align calculation to min(size, 1G)
- Add map_bar_misaligned test case
- Link to v1: https://lore.kernel.org/all/aWA4GKp5ld92sY6e@devgpu015.cco6.facebook.com

Signed-off-by: Alex Mastro <amastro@fb.com>
---
Alex Mastro (3):
      vfio: selftests: Centralize IOMMU mode name definitions
      vfio: selftests: Align BAR mmaps for efficient IOMMU mapping
      vfio: selftests: Add vfio_dma_mapping_mmio_test

 tools/testing/selftests/vfio/Makefile              |   1 +
 tools/testing/selftests/vfio/lib/include/libvfio.h |   9 ++
 .../selftests/vfio/lib/include/libvfio/iommu.h     |   6 +
 tools/testing/selftests/vfio/lib/iommu.c           |  12 +-
 tools/testing/selftests/vfio/lib/libvfio.c         |  25 ++++
 tools/testing/selftests/vfio/lib/vfio_pci_device.c |  24 +++-
 .../selftests/vfio/vfio_dma_mapping_mmio_test.c    | 144 +++++++++++++++++++++
 .../testing/selftests/vfio/vfio_dma_mapping_test.c |   2 +-
 8 files changed, 215 insertions(+), 8 deletions(-)
---
base-commit: d721f52e31553a848e0e9947ca15a49c5674aef3
change-id: 20260112-map-mmio-test-b4e4c2d917a9

Best regards,
-- 
Alex Mastro <amastro@fb.com>


             reply	other threads:[~2026-01-13 23:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-13 23:08 Alex Mastro [this message]
2026-01-13 23:08 ` [PATCH v2 1/3] vfio: selftests: Centralize IOMMU mode name definitions Alex Mastro
2026-01-13 23:08 ` [PATCH v2 2/3] vfio: selftests: Align BAR mmaps for efficient IOMMU mapping Alex Mastro
2026-01-14 17:30   ` David Matlack
2026-01-14 18:44     ` Alex Mastro
2026-01-13 23:08 ` [PATCH v2 3/3] vfio: selftests: Add vfio_dma_mapping_mmio_test Alex Mastro
2026-01-14 17:52   ` David Matlack
2026-01-14 18:45     ` Alex Mastro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260113-map-mmio-test-v2-0-e6d34f09c0bb@fb.com \
    --to=amastro@fb.com \
    --cc=alex@shazbot.org \
    --cc=dmatlack@google.com \
    --cc=jgg@ziepe.ca \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=peterx@redhat.com \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox