selftests/vfio: Add NVIDIA GPU Falcon DMA test driver
Subsystems (4)
v9 cover selftests/vfio: Add NVIDIA GPU Falcon DMA test driver
This patch series adds a new VFIO selftest plugin driver for NVIDIA GPUs that enables DMA testing via the Falcon microcontrollers.
Patch 1:
Kernel selftests are a collection of test programs that live within the Linux kernel source tree (tools/testing/selftests/) and are designed to test various kernel subsystems from userspace. The VFIO selftest framework have a pluggable driver architecture that allows different hardware drivers to implement various test capabilities. However, not all drivers can trigger MSI/MSI-X interrupts from software.
This patch adds checks to gracefully skip MSI-related tests when the driver's send_msi callback is NULL, allowing drivers without MSI support to still run the DMA functionality tests. It also makes MSI truly optional by checking msi_fd validity before operations.
Patch 2:
This patch introduces the core implementation of the plugin driver. It extracts and adapts relevant functionality from NVIDIA's gpu-admin-tools project [1], integrating 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 Falcon is a general-purpose microcontroller present on NVIDIA GPUs that can perform DMA operations between system memory and device memory.
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
Changes in v9:
- Squashed patch 3 (PMU falcon support for Kepler and Maxwell Gen1) into patch 2, as the registers and fields required have been approved for open source disclosure
Changes in v8:
- Corrected Makefile to also build nv_falcons driver on other architectures than x86_64
Changes in v7:
- Added Hopper (H100) support
- Made MSI optional by checking msi_fd != -1 in ASSERT_NO_MSI macro and guarding fcntl_set_nonblock() calls
- Refactored to use gpu_properties_map[] array indexed by enum gpu_arch
- Added falcon_map[] array indexed by enum falcon_type for cleaner initialization
- Coding style fixes
Changes in v6:
- Added GPU architecture detection
- Refactored GPU detection to use per-architecture property structs
Changes in v5:
- Reorganized as a 3-patch series
- Added patch to skip MSI tests for drivers without MSI support
- Removed stub MSI function from Falcon driver
- Added support to Maxwell Gen1 GPUs and Kepler GPUs
Changes in v4:
- Removed redundant PCI_VENDOR_ID_NVIDIA macro
- Macro cleanup and style fixes
Changes in v3:
- Updated cover letter to clarify purpose and scope
Changes in v2:
- Fixed NV_PMC_ENABLE_PWR macro value (0x2000, was incorrectly 0x1000)
- Added gpu_disable_bus_master and falcon_disable calls in remove path for proper cleanup
- Added error handling for unknown GPU pmc_boot_0 values
- General code cleanup and style fixes
- Note: Kepler cards may not work, pending further testing
Rubin Du (2):
selftests/vfio: Skip MSI tests for drivers that cannot raise
interrupts
selftests/vfio: Add NVIDIA Falcon driver for DMA testing
.../vfio/lib/drivers/nv_falcons/hw.h | 345 ++++++++ .../vfio/lib/drivers/nv_falcons/nv_falcons.c | 757 ++++++++++++++++++ .../lib/include/libvfio/vfio_pci_device.h | 3 + tools/testing/selftests/vfio/lib/libvfio.mk | 2 + .../selftests/vfio/lib/vfio_pci_driver.c | 4 +- .../selftests/vfio/vfio_pci_driver_test.c | 8 + 6 files changed, 1118 insertions(+), 1 deletion(-) 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
Signature · 1 line
2.43.0
PATCH v9 1/2 selftests/vfio: Skip MSI tests for drivers that cannot raise interrupts
Some device drivers may not have the capability to trigger MSI/MSI-X interrupts from software. Add checks to skip the send_msi test and the MSI portion of the mix_and_match test when the driver's send_msi callback is NULL, allowing these drivers to still run the DMA tests.
--- .../selftests/vfio/lib/include/libvfio/vfio_pci_device.h | 3 +++ tools/testing/selftests/vfio/vfio_pci_driver_test.c | 8 ++++++++ 2 files changed, 11 insertions(+)
tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h +3 -0
@@ -74,6 +74,9 @@ static inline void fcntl_set_nonblock(int fd) {int r; +if (fd ==-1 ) +return ; + r =fcntl (fd,F_GETFL ,0 );VFIO_ASSERT_NE (r,-1 ,"F_GETFL failed for fd %d\n" , fd);
tools/testing/selftests/vfio/vfio_pci_driver_test.c +8 -0
@@ -14,6 +14,8 @@ static const char *device_bdf;#define ASSERT_NO_MSI (_eventfd) do { \ u64 __value; \ \ + if (_eventfd == -1) \ + break; \ ASSERT_EQ(-1, read(_eventfd, &__value, 8)); \ ASSERT_EQ(EAGAIN, errno); \ } while (0)
@@ -175,6 +177,9 @@ TEST_F(vfio_pci_driver_test, send_msi) {u64 value; +if (self->device->driver.ops->send_msi ==NULL ) +SKIP (return,"Device does not support MSI\n" ); +vfio_pci_driver_send_msi (self->device);ASSERT_EQ (8 ,read (self->msi_fd, &value,8 ));ASSERT_EQ (1 , value);
@@ -201,6 +206,9 @@ TEST_F(vfio_pci_driver_test, mix_and_match) self->dst_iova, self->size); +if (self->device->driver.ops->send_msi ==NULL ) +continue ; +vfio_pci_driver_send_msi (self->device);ASSERT_EQ (8 ,read (self->msi_fd, &value,8 ));ASSERT_EQ (1 , value);
Signature · 1 line
2.43.0
David Matlack
maintainerRe: [PATCH v9 1/2] selftests/vfio: Skip MSI tests for drivers that cannot raise interrupts
Quoted 4 lines · Rubin Du
Some device drivers may not have the capability to trigger MSI/MSI-X interrupts from software. Add checks to skip the
send_msitest and the MSI portion of themix_and_matchtest when the driver'ssend_msicallback is NULL, allowing these drivers to still run the DMA tests.
I would prefer not to make send_msi() optional if possible. We sould need changes like this in all future tests that want to use send_msi().
Is there really no way for the nv_falcon to do something to cause the NV GPU to send an MSI?
PATCH v9 2/2 selftests/vfio: Add NVIDIA Falcon driver for DMA testing
In reply to Rubin DuAdd a new VFIO PCI driver for NVIDIA GPUs that enables DMA testing via the Falcon (Fast Logic Controller) microcontrollers. This driver extracts and adapts the DMA test functionality from the NVIDIA gpu-admin-tools project and integrates it into the existing VFIO selftest framework.
The Falcon is a general-purpose microcontroller present on NVIDIA GPUs that can perform DMA operations between system memory and device memory. By leveraging Falcon DMA, this driver allows NVIDIA GPUs to be tested alongside Intel IOAT and DSA devices using the same selftest infrastructure.
Supported GPUs:
- Kepler: K520, GTX660, K4000, K80, GT635
- Maxwell Gen1: GTX750, GTX745
- Maxwell Gen2: M60
- Pascal: P100, P4, P40
- Volta: V100
- Turing: T4
- Ampere: A16, A100, A10
- Ada: L4, L40S
- Hopper: H100
The PMU falcon on Kepler and Maxwell Gen1 GPUs uses legacy FBIF register offsets and requires enabling via PMC_ENABLE with the HUB bit set.
Limitations and tradeoffs:
1. Architecture support:
Blackwell and newer architectures may require additional work due to firmware.
2. Synchronous DMA operations:
Each transfer blocks until completion because the reference implementation does not expose command queuing - only one DMA operation can be in flight at a time.
The driver is named 'nv_falcon' to reflect that it specifically controls the Falcon microcontroller for DMA operations, rather than exposing general GPU functionality.
Reference implementation:
https://github.com/NVIDIA/gpu-admin-tools
--- .../vfio/lib/drivers/nv_falcons/hw.h | 340 ++++++++ .../vfio/lib/drivers/nv_falcons/nv_falcons.c | 750 ++++++++++++++++++ tools/testing/selftests/vfio/lib/libvfio.mk | 2 + .../selftests/vfio/lib/vfio_pci_driver.c | 3 + 4 files changed, 1095 insertions(+) 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
tools/testing/selftests/vfio/lib/drivers/nv_falcons/hw.h new file +340 -0
@@ -0,0 +1,340 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +*/ +#ifndef FALCON_DMA_H +#define FALCON_DMA_H + +/* PMC (Power Management Controller) Registers */ +#define NV_PMC_BOOT_0 0x00000000 +#define NV_PMC_ENABLE 0x00000200 +#define NV_PMC_ENABLE_PWR 0x00002000 +#define NV_PMC_ENABLE_HUB 0x20000000 + +/* Falcon Base Pages for Different Engines */ +#define NV_PPWR_FALCON_BASE 0x10a000 +#define NV_PGSP_FALCON_BASE 0x110000 + +/* Falcon Common Register Offsets (relative to base_page) */ +#define NV_FALCON_DMACTL_OFFSET 0x010c +#define NV_FALCON_CPUCTL_OFFSET 0x0100 +#define NV_FALCON_ENGINE_RESET_OFFSET 0x03c0 + +/* DMEM Control Register Flags */ +#define NV_PPWR_FALCON_DMEMC_AINCR_TRUE 0x01000000 +#define NV_PPWR_FALCON_DMEMC_AINCW_TRUE 0x02000000 + +/* Falcon DMEM port offsets (for port 0) */ +#define NV_FALCON_DMEMC_OFFSET 0x1c0 +#define NV_FALCON_DMEMD_OFFSET 0x1c4 + +/* DMA Register Offsets (relative to base_page) */ +#define NV_FALCON_DMA_ADDR_LOW_OFFSET 0x110 +#define NV_FALCON_DMA_MEM_OFFSET 0x114 +#define NV_FALCON_DMA_CMD_OFFSET 0x118 +#define NV_FALCON_DMA_BLOCK_OFFSET 0x11c +#define NV_FALCON_DMA_ADDR_HIGH_OFFSET 0x128 + +/* DMA Global Address Top Bits Register */ +#define NV_GPU_DMA_ADDR_TOP_BITS_REG 0x100f04 + +/* DMA Command Register Bit Definitions */ +#define NV_FALCON_DMA_CMD_WRITE_BIT 0x20 +#define NV_FALCON_DMA_CMD_SIZE_SHIFT 8 +#define NV_FALCON_DMA_CMD_DONE_BIT 0x2 + +/* DMA block size and alignment */ +#define NV_FALCON_DMA_MAX_TRANSFER_SIZE 256 +#define NV_FALCON_DMA_MAX_TRANSFER_COUNT 1 + +/* DMACTL register bits */ +#define NV_FALCON_DMACTL_DMEM_SCRUBBING 0x1 +#define NV_FALCON_DMACTL_READY_MASK 0x6 + +/* Falcon Core Selection Register */ +#define NV_FALCON_CORE_SELECT_OFFSET 0x1668 +#define NV_FALCON_CORE_SELECT_MASK 0x30 + +/* Falcon mailbox register (for Ada+ reset check) */ +#define NV_FALCON_MAILBOX_TEST_OFFSET 0x40c +#define NV_FALCON_MAILBOX_RESET_MAGIC 0xbadf5620 + +/* Falcon Message Queue Register Offsets (relative to base_page) */ +#define NV_FALCON_QUEUE_HEAD_BASE_OFFSET 0x2c00 +#define NV_FALCON_QUEUE_TAIL_BASE_OFFSET 0x2c04 +#define NV_FALCON_QUEUE_STRIDE 0x8 +#define NV_FALCON_MSG_QUEUE_HEAD_BASE_OFFSET 0x2c80 +#define NV_FALCON_MSG_QUEUE_TAIL_BASE_OFFSET 0x2c84 + +/* FSP Falcon Base Pages */ +#define NV_FSP_FALCON_BASE 0x8f0100 +#define NV_FSP_FALCON_BASE_PAGE 0x8f0000/* base_page = cpuctl & ~0xfff */ +#define NV_FSP_EMEM_BASE 0x8f2000 + +/* FSP EMEM Port Offsets (relative to FSP EMEM base) */ +#define NV_FSP_EMEMC_OFFSET 0xac0 +#define NV_FSP_EMEMD_OFFSET 0xac4 +#define NV_FSP_EMEM_PORT_STRIDE 0x8 + +/* EMEM Control Register Flags (same as DMEM) */ +#define NV_FALCON_EMEMC_AINCR 0x01000000 +#define NV_FALCON_EMEMC_AINCW 0x02000000 + +/* FSP RPC channel configuration */ +#define NV_FSP_RPC_CHANNEL_SIZE 1024 +#define NV_FSP_RPC_MAX_PACKET_SIZE 1024 +#define NV_FSP_RPC_CHANNEL_HOPPER 2 +#define NV_FSP_RPC_EMEM_BASE (NV_FSP_RPC_CHANNEL_HOPPER * NV_FSP_RPC_CHANNEL_SIZE) + +/* FSP EMEM port 2 registers (pre-computed for Hopper channel 2) */ +#define NV_FSP_EMEM_PORT2_CTRL (NV_FSP_EMEM_BASE + NV_FSP_EMEMC_OFFSET + \ + NV_FSP_RPC_CHANNEL_HOPPER * NV_FSP_EMEM_PORT_STRIDE) +#define NV_FSP_EMEM_PORT2_DATA (NV_FSP_EMEM_BASE + NV_FSP_EMEMD_OFFSET + \ + NV_FSP_RPC_CHANNEL_HOPPER * NV_FSP_EMEM_PORT_STRIDE) + +/* FSP queue register offsets (pre-computed for Hopper channel 2) */ +#define NV_FSP_QUEUE_HEAD (NV_FSP_FALCON_BASE_PAGE + NV_FALCON_QUEUE_HEAD_BASE_OFFSET + \ + NV_FSP_RPC_CHANNEL_HOPPER * NV_FALCON_QUEUE_STRIDE) +#define NV_FSP_QUEUE_TAIL (NV_FSP_FALCON_BASE_PAGE + NV_FALCON_QUEUE_TAIL_BASE_OFFSET + \ + NV_FSP_RPC_CHANNEL_HOPPER * NV_FALCON_QUEUE_STRIDE) +#define NV_FSP_MSG_QUEUE_HEAD (NV_FSP_FALCON_BASE_PAGE + NV_FALCON_MSG_QUEUE_HEAD_BASE_OFFSET + \ + NV_FSP_RPC_CHANNEL_HOPPER * NV_FALCON_QUEUE_STRIDE) +#define NV_FSP_MSG_QUEUE_TAIL (NV_FSP_FALCON_BASE_PAGE + NV_FALCON_MSG_QUEUE_TAIL_BASE_OFFSET + \ + NV_FSP_RPC_CHANNEL_HOPPER * NV_FALCON_QUEUE_STRIDE) + +/* MCTP Header */ +#define NV_MCTP_HDR_SEID_SHIFT 16 +#define NV_MCTP_HDR_SEID_MASK 0xff +#define NV_MCTP_HDR_SEQ_SHIFT 28 +#define NV_MCTP_HDR_SEQ_MASK 0x3 +#define NV_MCTP_HDR_EOM_BIT 0x40000000 +#define NV_MCTP_HDR_SOM_BIT 0x80000000 + +/* MCTP Message Header */ +#define NV_MCTP_MSG_TYPE_SHIFT 0 +#define NV_MCTP_MSG_TYPE_MASK 0x7f +#define NV_MCTP_MSG_TYPE_VENDOR_DEFINED 0x7e +#define NV_MCTP_MSG_VENDOR_ID_SHIFT 8 +#define NV_MCTP_MSG_VENDOR_ID_MASK 0xffff +#define NV_MCTP_MSG_VENDOR_ID_NVIDIA 0x10de +#define NV_MCTP_MSG_NVDM_TYPE_SHIFT 24 +#define NV_MCTP_MSG_NVDM_TYPE_MASK 0xff + +/* NVDM response type */ +#define NV_NVDM_TYPE_RESPONSE 0x15 + +/* Minimum response size: mctp_hdr + msg_hdr + status_hdr + type + status */ +#define NV_FSP_RPC_MIN_RESPONSE_WORDS 5 + +/* FBIF (Frame Buffer Interface) Registers */ +/* Legacy PMU FBIF offsets (Kepler, Maxwell Gen1) */ +#define NV_PMU_LEGACY_FBIF_CTL_OFFSET 0x624 +#define NV_PMU_LEGACY_FBIF_TRANSCFG_OFFSET 0x600 + +/* PMU FBIF offsets */ +#define NV_PMU_FBIF_CTL_OFFSET 0xe24 +#define NV_PMU_FBIF_TRANSCFG_OFFSET 0xe00 + +/* GSP FBIF offsets */ +#define NV_GSP_FBIF_CTL_OFFSET 0x624 +#define NV_GSP_FBIF_TRANSCFG_OFFSET 0x600 + +/* OFA Falcon Base Page and FBIF offsets (used for Hopper+ DMA) */ +#define NV_OFA_FALCON_BASE 0x844000 +#define NV_OFA_FBIF_CTL_OFFSET 0x424 +#define NV_OFA_FBIF_TRANSCFG_OFFSET 0x400 + +/* OFA DMA support check register (Hopper+) */ +#define NV_OFA_DMA_SUPPORT_CHECK_REG 0x8443c0 + +/* FSP NVDM command types */ +#define NV_NVDM_TYPE_FBDMA 0x22 +#define NV_FBDMA_SUBCMD_ENABLE 0x1 + +/* FBIF CTL2 offset (relative to fbif_ctl) */ +#define NV_FBIF_CTL2_OFFSET 0x60 + +/* FBIF TRANSCFG register bits */ +#define NV_FBIF_TRANSCFG_TARGET_MASK 0x3 +#define NV_FBIF_TRANSCFG_SYSMEM_DEFAULT 0x5 + +/* FBIF CTL register bits */ +#define NV_FBIF_CTL_ALLOW_PHYS_MODE 0x10 +#define NV_FBIF_CTL_ALLOW_FULL_PHYS_MODE 0x80 + +/* Memory clear register offsets */ +#define NV_MEM_CLEAR_OFFSET 0x100b20 +#define NV_BOOT_COMPLETE_OFFSET 0x118234 +#define NV_BOOT_COMPLETE_MASK 0x3ff + +/* FSP boot complete register (Hopper+) */ +#define NV_FSP_BOOT_COMPLETE_OFFSET 0x200bc +#define NV_FSP_BOOT_COMPLETE_MASK 0xff + +enum gpu_arch { +GPU_ARCH_UNKNOWN =-1 , +GPU_ARCH_KEPLER =0 , +GPU_ARCH_MAXWELL_GEN1 , +GPU_ARCH_MAXWELL_GEN2 , +GPU_ARCH_PASCAL , +GPU_ARCH_VOLTA , +GPU_ARCH_TURING , +GPU_ARCH_AMPERE , +GPU_ARCH_ADA , +GPU_ARCH_HOPPER , +}; + +enum falcon_type { +FALCON_TYPE_PMU_LEGACY =0 , +FALCON_TYPE_PMU , +FALCON_TYPE_GSP , +FALCON_TYPE_OFA , +}; + +struct falcon { +u32 base_page; +u32 dmactl; +u32 engine_reset; +u32 fbif_ctl; +u32 fbif_ctl2; +u32 fbif_transcfg; +u32 dmem_control_reg; +u32 dmem_data_reg; +bool no_outside_reset; +}; + +struct gpu_properties { +u32 pmc_enable_mask; +bool memory_clear_supported; +enum falcon_type falcon_type; +}; + +struct gpu_device { +enum gpu_arch arch; +void *bar0; +bool is_memory_clear_supported; +const struct falcon *falcon; +u32 pmc_enable_mask; +bool fsp_dma_enabled; +}; + +static const u32 verified_gpu_map[] = { +0x0e40a0a2 ,/* K520 */ +0x0e6000a1 ,/* GTX660 */ +0x0e63a0a1 ,/* K4000 */ +0x0f22d0a1 ,/* K80 */ +0x108000a1 ,/* GT635 */ +0x117010a2 ,/* GTX750 */ +0x117020a2 ,/* GTX745 */ +0x124320a1 ,/* M60 */ +0x130000a1 ,/* P100 */ +0x134000a1 ,/* P4 */ +0x132000a1 ,/* P40 */ +0x140000a1 ,/* V100 */ +0x164000a1 ,/* T4 */ +0xb77000a1 ,/* A16 */ +0x170000a1 ,/* A100 */ +0xb72000a1 ,/* A10 */ +0x194000a1 ,/* L4 */ +0x192000a1 ,/* L40S */ +}; + +#define VERIFIED_GPU_MAP_SIZE ARRAY_SIZE(verified_gpu_map) + +static const struct gpu_properties gpu_properties_map[] = { + [GPU_ARCH_KEPLER ] = { + .pmc_enable_mask =NV_PMC_ENABLE_PWR |NV_PMC_ENABLE_HUB , + .memory_clear_supported = false, + .falcon_type =FALCON_TYPE_PMU_LEGACY , + }, + [GPU_ARCH_MAXWELL_GEN1 ] = { + .pmc_enable_mask =NV_PMC_ENABLE_PWR |NV_PMC_ENABLE_HUB , + .memory_clear_supported = false, + .falcon_type =FALCON_TYPE_PMU_LEGACY , + }, + [GPU_ARCH_MAXWELL_GEN2 ] = { + .pmc_enable_mask =NV_PMC_ENABLE_PWR , + .memory_clear_supported = false, + .falcon_type =FALCON_TYPE_PMU , + }, + [GPU_ARCH_PASCAL ] = { + .pmc_enable_mask =NV_PMC_ENABLE_PWR , + .memory_clear_supported = false, + .falcon_type =FALCON_TYPE_PMU , + }, + [GPU_ARCH_VOLTA ] = { + .pmc_enable_mask =0 , + .memory_clear_supported = false, + .falcon_type =FALCON_TYPE_GSP , + }, + [GPU_ARCH_TURING ] = { + .pmc_enable_mask =0 , + .memory_clear_supported = true, + .falcon_type =FALCON_TYPE_GSP , + }, + [GPU_ARCH_AMPERE ] = { + .pmc_enable_mask =0 , + .memory_clear_supported = true, + .falcon_type =FALCON_TYPE_GSP , + }, + [GPU_ARCH_ADA ] = { + .pmc_enable_mask =0 , + .memory_clear_supported = true, + .falcon_type =FALCON_TYPE_PMU , + }, + [GPU_ARCH_HOPPER ] = { + .pmc_enable_mask =0 , + .memory_clear_supported = true, + .falcon_type =FALCON_TYPE_OFA , + }, +}; + +static const struct falcon falcon_map[] = { + [FALCON_TYPE_PMU_LEGACY ] = { + .base_page =NV_PPWR_FALCON_BASE , + .dmactl =NV_PPWR_FALCON_BASE +NV_FALCON_DMACTL_OFFSET , + .engine_reset =NV_PPWR_FALCON_BASE +NV_FALCON_ENGINE_RESET_OFFSET , + .fbif_ctl =NV_PPWR_FALCON_BASE +NV_PMU_LEGACY_FBIF_CTL_OFFSET , + .fbif_ctl2 =NV_PPWR_FALCON_BASE +NV_PMU_LEGACY_FBIF_CTL_OFFSET +NV_FBIF_CTL2_OFFSET , + .fbif_transcfg =NV_PPWR_FALCON_BASE +NV_PMU_LEGACY_FBIF_TRANSCFG_OFFSET , + .dmem_control_reg =NV_PPWR_FALCON_BASE +NV_FALCON_DMEMC_OFFSET , + .dmem_data_reg =NV_PPWR_FALCON_BASE +NV_FALCON_DMEMD_OFFSET , + .no_outside_reset = false, + }, + [FALCON_TYPE_PMU ] = { + .base_page =NV_PPWR_FALCON_BASE , + .dmactl =NV_PPWR_FALCON_BASE +NV_FALCON_DMACTL_OFFSET , + .engine_reset =NV_PPWR_FALCON_BASE +NV_FALCON_ENGINE_RESET_OFFSET , + .fbif_ctl =NV_PPWR_FALCON_BASE +NV_PMU_FBIF_CTL_OFFSET , + .fbif_ctl2 =NV_PPWR_FALCON_BASE +NV_PMU_FBIF_CTL_OFFSET +NV_FBIF_CTL2_OFFSET , + .fbif_transcfg =NV_PPWR_FALCON_BASE +NV_PMU_FBIF_TRANSCFG_OFFSET , + .dmem_control_reg =NV_PPWR_FALCON_BASE +NV_FALCON_DMEMC_OFFSET , + .dmem_data_reg =NV_PPWR_FALCON_BASE +NV_FALCON_DMEMD_OFFSET , + .no_outside_reset = false, + }, + [FALCON_TYPE_GSP ] = { + .base_page =NV_PGSP_FALCON_BASE , + .dmactl =NV_PGSP_FALCON_BASE +NV_FALCON_DMACTL_OFFSET , + .engine_reset =NV_PGSP_FALCON_BASE +NV_FALCON_ENGINE_RESET_OFFSET , + .fbif_ctl =NV_PGSP_FALCON_BASE +NV_GSP_FBIF_CTL_OFFSET , + .fbif_ctl2 =NV_PGSP_FALCON_BASE +NV_GSP_FBIF_CTL_OFFSET +NV_FBIF_CTL2_OFFSET , + .fbif_transcfg =NV_PGSP_FALCON_BASE +NV_GSP_FBIF_TRANSCFG_OFFSET , + .dmem_control_reg =NV_PGSP_FALCON_BASE +NV_FALCON_DMEMC_OFFSET , + .dmem_data_reg =NV_PGSP_FALCON_BASE +NV_FALCON_DMEMD_OFFSET , + .no_outside_reset = false, + }, + [FALCON_TYPE_OFA ] = { + .base_page =NV_OFA_FALCON_BASE , + .dmactl =NV_OFA_FALCON_BASE +NV_FALCON_DMACTL_OFFSET , + .engine_reset =NV_OFA_FALCON_BASE +NV_FALCON_ENGINE_RESET_OFFSET , + .fbif_ctl =NV_OFA_FALCON_BASE +NV_OFA_FBIF_CTL_OFFSET , + .fbif_ctl2 =NV_OFA_FALCON_BASE +NV_OFA_FBIF_CTL_OFFSET +NV_FBIF_CTL2_OFFSET , + .fbif_transcfg =NV_OFA_FALCON_BASE +NV_OFA_FBIF_TRANSCFG_OFFSET , + .dmem_control_reg =NV_OFA_FALCON_BASE +NV_FALCON_DMEMC_OFFSET , + .dmem_data_reg =NV_OFA_FALCON_BASE +NV_FALCON_DMEMD_OFFSET , + .no_outside_reset = true, + }, +}; + + +#endif /* FALCON_DMA_H */
tools/testing/selftests/vfio/lib/drivers/nv_falcons/nv_falcons.c new file +750 -0
750 lines not on this page · raw message
tools/testing/selftests/vfio/lib/libvfio.mk +2 -0
@@ -14,6 +14,8 @@ LIBVFIO_C += drivers/ioat/ioat.c LIBVFIO_C += drivers/dsa/dsa.c endif +LIBVFIO_C += drivers/nv_falcons/nv_falcons.c + LIBVFIO_OUTPUT := $(OUTPUT)/libvfio LIBVFIO_O := $(patsubst %.c, $(LIBVFIO_OUTPUT)/%.o, $(LIBVFIO_C))
tools/testing/selftests/vfio/lib/vfio_pci_driver.c +3 -0
@@ -7,11 +7,14 @@ extern struct vfio_pci_driver_ops dsa_ops;extern struct vfio_pci_driver_ops ioat_ops;#endif +extern struct vfio_pci_driver_ops nv_falcon_ops; +static struct vfio_pci_driver_ops *driver_ops[] = { #ifdef __x86_64__ &dsa_ops, &ioat_ops, #endif + &nv_falcon_ops, };void vfio_pci_driver_probe (struct vfio_pci_device *device)
Signature · 1 line
2.43.0
David Matlack
maintainerRe: [PATCH v9 2/2] selftests/vfio: Add NVIDIA Falcon driver for DMA testing
Quoted 27 lines · Rubin Du
Add a new VFIO PCI driver for NVIDIA GPUs that enables DMA testing via the Falcon (Fast Logic Controller) microcontrollers. This driver extracts and adapts the DMA test functionality from the NVIDIA gpu-admin-tools project and integrates it into the existing VFIO selftest framework.
The Falcon is a general-purpose microcontroller present on NVIDIA GPUs that can perform DMA operations between system memory and device memory. By leveraging Falcon DMA, this driver allows NVIDIA GPUs to be tested alongside Intel IOAT and DSA devices using the same selftest infrastructure.
Supported GPUs:
- Kepler: K520, GTX660, K4000, K80, GT635
- Maxwell Gen1: GTX750, GTX745
- Maxwell Gen2: M60
- Pascal: P100, P4, P40
- Volta: V100
- Turing: T4
- Ampere: A16, A100, A10
- Ada: L4, L40S
- Hopper: H100The PMU falcon on Kepler and Maxwell Gen1 GPUs uses legacy FBIF register offsets and requires enabling via
PMC_ENABLEwith the HUB bit set.Limitations and tradeoffs:
Quoted 8 lines
1. Architecture support:
Blackwell and newer architectures may require additional work due to firmware.2. Synchronous DMA operations:
Each transfer blocks until completion because the reference implementation does not expose command queuing - only one DMA operation can be in flight at a time.
Asynchronous DMA will be important for testing Live Update:
https://lore.kernel.org/kvm/[email protected]/
That is why I split memcpy_start() and memcpy_wait() from the beginning.
Would it be possible to add support for it here even though it is not in the reference implementation?
Quoted 9 lines
The driver is named '
nv_falcon' to reflect that it specifically controls the Falcon microcontroller for DMA operations, rather than exposing general GPU functionality.Reference implementation:
https://github.com/NVIDIA/gpu-admin-toolsSigned-off-by Rubin Du <[email protected]>
Alex Williamson
maintainerRe: [PATCH v9 2/2] selftests/vfio: Add NVIDIA Falcon driver for DMA testing
Quoted 37 lines · On Thu, 19 Mar 2026 19:04:37 +0000 David Matlack <[email protected]> wrote:
Quoted 27 lines · Rubin Du
Add a new VFIO PCI driver for NVIDIA GPUs that enables DMA testing via the Falcon (Fast Logic Controller) microcontrollers. This driver extracts and adapts the DMA test functionality from the NVIDIA gpu-admin-tools project and integrates it into the existing VFIO selftest framework.
The Falcon is a general-purpose microcontroller present on NVIDIA GPUs that can perform DMA operations between system memory and device memory. By leveraging Falcon DMA, this driver allows NVIDIA GPUs to be tested alongside Intel IOAT and DSA devices using the same selftest infrastructure.
Supported GPUs:
- Kepler: K520, GTX660, K4000, K80, GT635
- Maxwell Gen1: GTX750, GTX745
- Maxwell Gen2: M60
- Pascal: P100, P4, P40
- Volta: V100
- Turing: T4
- Ampere: A16, A100, A10
- Ada: L4, L40S
- Hopper: H100The PMU falcon on Kepler and Maxwell Gen1 GPUs uses legacy FBIF register offsets and requires enabling via
PMC_ENABLEwith the HUB bit set.Limitations and tradeoffs:
Quoted 8 lines
1. Architecture support:
Blackwell and newer architectures may require additional work due to firmware.2. Synchronous DMA operations:
Each transfer blocks until completion because the reference implementation does not expose command queuing - only one DMA operation can be in flight at a time.
Quoted 8 lines
Asynchronous DMA will be important for testing Live Update:
https://lore.kernel.org/kvm/[email protected]/
That is why I split
memcpy_start()andmemcpy_wait()from the beginning.Would it be possible to add support for it here even though it is not in the reference implementation?
I'll leave the can-we questions to Rubin, but do you see either the MSI or asynchronous issues as blockers? Currently our driver tests are limited to a very narrow range of Intel server platforms, whereas this is a plug'able endpoint we can install anywhere. I'd think that's sufficiently valuable in expanding the test base to make some compromises. Thanks,
Alex
David Matlack
maintainerRe: [PATCH v9 2/2] selftests/vfio: Add NVIDIA Falcon driver for DMA testing
Quoted 45 lines · Alex Williamson
Quoted 41 lines · On Thu, 19 Mar 2026 19:04:37 +0000 David Matlack <[email protected]> wrote:
Quoted 27 lines · Rubin Du
Add a new VFIO PCI driver for NVIDIA GPUs that enables DMA testing via the Falcon (Fast Logic Controller) microcontrollers. This driver extracts and adapts the DMA test functionality from the NVIDIA gpu-admin-tools project and integrates it into the existing VFIO selftest framework.
The Falcon is a general-purpose microcontroller present on NVIDIA GPUs that can perform DMA operations between system memory and device memory. By leveraging Falcon DMA, this driver allows NVIDIA GPUs to be tested alongside Intel IOAT and DSA devices using the same selftest infrastructure.
Supported GPUs:
- Kepler: K520, GTX660, K4000, K80, GT635
- Maxwell Gen1: GTX750, GTX745
- Maxwell Gen2: M60
- Pascal: P100, P4, P40
- Volta: V100
- Turing: T4
- Ampere: A16, A100, A10
- Ada: L4, L40S
- Hopper: H100The PMU falcon on Kepler and Maxwell Gen1 GPUs uses legacy FBIF register offsets and requires enabling via
PMC_ENABLEwith the HUB bit set.Limitations and tradeoffs:
Quoted 8 lines
1. Architecture support:
Blackwell and newer architectures may require additional work due to firmware.2. Synchronous DMA operations:
Each transfer blocks until completion because the reference implementation does not expose command queuing - only one DMA operation can be in flight at a time.Asynchronous DMA will be important for testing Live Update:
Quoted 7 lines
Quoted 4 lines
That is why I split
memcpy_start()andmemcpy_wait()from the beginning.Would it be possible to add support for it here even though it is not in the reference implementation?
I'll leave the can-we questions to Rubin, but do you see either the MSI or asynchronous issues as blockers?
No, I don't consider either to be hard blockers.
Quoted 5 lines
Currently our driver tests are
limited to a very narrow range of Intel server platforms, whereas this is a plug'able endpoint we can install anywhere. I'd think that's sufficiently valuable in expanding the test base to make some compromises. Thanks,
Yeah we can compromise if both issues cannot be resolved.
I hope to limit differences between the selftests drivers as much as possible, so that tests don't have to care. But I also recognize some divergence will be inevitable if we want to support a broad set of devices while also supporting more advanced features like asyncronous memcpy.
David Matlack
maintainerQuoted 2 lines · Rubin Du
This patch series adds a new VFIO selftest plugin driver for NVIDIA GPUs that enables DMA testing via the Falcon microcontrollers.
Thanks for adding a new driver! I'm glad to see more devices getting support so that VFIO selftsets can be run by more developers and in more environments.
I haven't taken a deep look at the driver implementation yet, because I had some higher level questions first that I left in the patches.
Quoted 4 lines
Changes in v9:
- Squashed patch 3 (PMU falcon support for Kepler and Maxwell Gen1) into patch 2, as the registers and fields required have been approved for open source disclosure
I did not see versions 1-8 on the mailing list. Are these from an internal review? If so, it would probably be best to drop them when sending upstream and start upstream reviews again at v1.