public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Rubin Du <rubind@nvidia.com>
To: Alex Williamson <alex@shazbot.org>,
	David Matlack <dmatlack@google.com>,
	Shuah Khan <shuah@kernel.org>
Cc: kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v10 0/2] selftests/vfio: Add NVIDIA GPU Falcon DMA test driver
Date: Wed, 25 Mar 2026 14:43:27 -0700	[thread overview]
Message-ID: <20260325214329.464727-1-rubind@nvidia.com> (raw)

Patch 1:

Add VFIO_PCI_DRIVER_F_NO_SEND_MSI feature flag for drivers that cannot
trigger MSI interrupts. Drivers that lack MSI support opt-in by setting
this flag.

Change vfio_pci_driver_send_msi() to return int, checking the flag
internally and returning -EOPNOTSUPP when set. Add
fcntl_set_msi_nonblock(self) and update ASSERT_NO_MSI(self) to check
the flag internally.

Patch 2:

Falcons are general-purpose microcontrollers present on NVIDIA GPUs
that can perform DMA operations between system memory and device memory.

Introduce the nv_falcon plugin driver, which extracts and adapts
relevant functionality from NVIDIA's gpu-admin-tools project [1] and
integrates it into the VFIO selftest framework. As a result, any
system equipped with a PCIe slot and a supported NVIDIA GPU can now
run VFIO DMA selftests using commonly available hardware.

The core VFIO selftest infrastructure handles:

- VFIO container/group management
- IOMMU domain setup
- DMA buffer allocation and mapping
- Test orchestration and reporting

The plugin drivers provide device-specific implementations for:

- Probing and initializing device
- Triggering DMA operations
- Verifying DMA completion
- Device cleanup


[1] https://github.com/NVIDIA/gpu-admin-tools

Note on version numbering: v1 through v9 were internal review
iterations that were mistakenly carried over to the upstream
submission. Apologies for the confusion, the internal changelog
has been dropped.

Changes in v10:
- Replaced NULL pointer checks on send_msi() with per-device
  VFIO_PCI_DRIVER_F_NO_SEND_MSI feature flag
- Changed vfio_pci_driver_send_msi() to return int with the feature
  check moved inside, so callers branch on the return value
- Added fcntl_set_msi_nonblock(self) and updated ASSERT_NO_MSI(self)
  macros that check the flag internally
- Moved DMA execution from memcpy_start() to memcpy_wait() so that
  memcpy_start() stores parameters and returns immediately, emulating
  async behavior to conform to the memcpy_start()/memcpy_wait() contract
- Split GPU_ARCH_PASCAL into GPU_ARCH_PASCAL (P100, PMC reset) and
  GPU_ARCH_PASCAL_10X (P4/P40, engine reset) to match per-product
  reset behavior
- Minor cleanups: improved size_to_dma_encoding(), fixed DMA address
  bits mask

Rubin Du (2):
  selftests/vfio: Add NO_SEND_MSI feature flag and MSI helper macros
  selftests/vfio: Add NVIDIA Falcon driver for DMA testing

 .../vfio/lib/drivers/nv_falcons/hw.h          | 365 +++++++++
 .../vfio/lib/drivers/nv_falcons/nv_falcons.c  | 739 ++++++++++++++++++
 .../lib/include/libvfio/vfio_pci_driver.h     |   5 +-
 tools/testing/selftests/vfio/lib/libvfio.mk   |   2 +
 .../selftests/vfio/lib/vfio_pci_driver.c      |   9 +-
 .../selftests/vfio/vfio_pci_driver_test.c     |  41 +-
 6 files changed, 1142 insertions(+), 19 deletions(-)
 create mode 100644 tools/testing/selftests/vfio/lib/drivers/nv_falcons/hw.h
 create mode 100644 tools/testing/selftests/vfio/lib/drivers/nv_falcons/nv_falcons.c

-- 
2.43.0


             reply	other threads:[~2026-03-25 21:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-25 21:43 Rubin Du [this message]
2026-03-25 21:43 ` [PATCH v10 1/2] selftests/vfio: Add NO_SEND_MSI feature flag and MSI helper macros Rubin Du
2026-03-27 22:04   ` David Matlack
2026-03-30 20:15     ` Rubin Du
2026-03-25 21:43 ` [PATCH v10 2/2] selftests/vfio: Add NVIDIA Falcon driver for DMA testing Rubin Du
2026-03-27 22:38   ` David Matlack
2026-03-30 20:15     ` Rubin Du

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=20260325214329.464727-1-rubind@nvidia.com \
    --to=rubind@nvidia.com \
    --cc=alex@shazbot.org \
    --cc=dmatlack@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --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