All of lore.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, rubind@nvidia.com
Subject: [PATCH v9 1/2] selftests/vfio: Skip MSI tests for drivers that cannot raise interrupts
Date: Tue, 17 Mar 2026 14:42:38 -0700	[thread overview]
Message-ID: <20260317214239.124857-2-rubind@nvidia.com> (raw)
In-Reply-To: <20260317214239.124857-1-rubind@nvidia.com>

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.

Signed-off-by: Rubin Du <rubind@nvidia.com>
---
 .../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(+)

diff --git a/tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h b/tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h
index 2858885a89bb..a497fc990924 100644
--- a/tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h
+++ b/tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h
@@ -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);
 
diff --git a/tools/testing/selftests/vfio/vfio_pci_driver_test.c b/tools/testing/selftests/vfio/vfio_pci_driver_test.c
index afa0480ddd9b..8269da741b67 100644
--- a/tools/testing/selftests/vfio/vfio_pci_driver_test.c
+++ b/tools/testing/selftests/vfio/vfio_pci_driver_test.c
@@ -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);
-- 
2.43.0


  reply	other threads:[~2026-03-17 21:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-17 21:42 [PATCH v9 0/2] selftests/vfio: Add NVIDIA GPU Falcon DMA test driver Rubin Du
2026-03-17 21:42 ` Rubin Du [this message]
2026-03-19 18:29   ` [PATCH v9 1/2] selftests/vfio: Skip MSI tests for drivers that cannot raise interrupts David Matlack
2026-03-17 21:42 ` [PATCH v9 2/2] selftests/vfio: Add NVIDIA Falcon driver for DMA testing Rubin Du
2026-03-19 19:04   ` David Matlack
2026-03-19 19:29     ` Alex Williamson
2026-03-19 20:21       ` David Matlack
2026-03-19 19:06 ` [PATCH v9 0/2] selftests/vfio: Add NVIDIA GPU Falcon DMA test driver David Matlack

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=20260317214239.124857-2-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.