public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: David Matlack <dmatlack@google.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: David Matlack <dmatlack@google.com>,
	Jason Gunthorpe <jgg@nvidia.com>, Josh Hilke <jrhilke@google.com>,
	 kvm@vger.kernel.org, Vipin Sharma <vipinsh@google.com>
Subject: [PATCH 08/12] vfio: selftests: Rename struct vfio_dma_region to dma_region
Date: Wed,  8 Oct 2025 23:25:27 +0000	[thread overview]
Message-ID: <20251008232531.1152035-9-dmatlack@google.com> (raw)
In-Reply-To: <20251008232531.1152035-1-dmatlack@google.com>

Rename struct vfio_dma_region to dma_region. This is in preparation for
separating the VFIO PCI device library code from the IOMMU library code.
This name change also better reflects the fact that DMA mappings can be
managed by either VFIO or IOMMUFD. i.e. the "vfio_" prefix is
misleading.

Signed-off-by: David Matlack <dmatlack@google.com>
---
 .../testing/selftests/vfio/lib/include/vfio_util.h |  8 ++++----
 tools/testing/selftests/vfio/lib/vfio_pci_device.c | 14 +++++++-------
 .../testing/selftests/vfio/vfio_dma_mapping_test.c |  2 +-
 .../testing/selftests/vfio/vfio_pci_driver_test.c  |  6 +++---
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/tools/testing/selftests/vfio/lib/include/vfio_util.h b/tools/testing/selftests/vfio/lib/include/vfio_util.h
index b7175d4c2132..cce521212348 100644
--- a/tools/testing/selftests/vfio/lib/include/vfio_util.h
+++ b/tools/testing/selftests/vfio/lib/include/vfio_util.h
@@ -77,7 +77,7 @@ typedef u64 iova_t;
 
 #define INVALID_IOVA UINT64_MAX
 
-struct vfio_dma_region {
+struct dma_region {
 	struct list_head link;
 	void *vaddr;
 	iova_t iova;
@@ -151,7 +151,7 @@ struct vfio_pci_driver {
 	bool memcpy_in_progress;
 
 	/* Region to be used by the driver (e.g. for in-memory descriptors) */
-	struct vfio_dma_region region;
+	struct dma_region region;
 
 	/* The maximum size that can be passed to memcpy_start(). */
 	u64 max_memcpy_size;
@@ -222,9 +222,9 @@ void vfio_pci_device_cleanup(struct vfio_pci_device *device);
 void vfio_pci_device_reset(struct vfio_pci_device *device);
 
 void vfio_pci_dma_map(struct vfio_pci_device *device,
-		      struct vfio_dma_region *region);
+		      struct dma_region *region);
 void vfio_pci_dma_unmap(struct vfio_pci_device *device,
-			struct vfio_dma_region *region);
+			struct dma_region *region);
 
 void vfio_pci_config_access(struct vfio_pci_device *device, bool write,
 			    size_t config, size_t size, void *data);
diff --git a/tools/testing/selftests/vfio/lib/vfio_pci_device.c b/tools/testing/selftests/vfio/lib/vfio_pci_device.c
index 1788e7892ee3..c9cfba1dc62c 100644
--- a/tools/testing/selftests/vfio/lib/vfio_pci_device.c
+++ b/tools/testing/selftests/vfio/lib/vfio_pci_device.c
@@ -30,7 +30,7 @@
 
 iova_t __to_iova(struct vfio_pci_device *device, void *vaddr)
 {
-	struct vfio_dma_region *region;
+	struct dma_region *region;
 
 	list_for_each_entry(region, &device->iommu->dma_regions, link) {
 		if (vaddr < region->vaddr)
@@ -142,7 +142,7 @@ static void vfio_pci_irq_get(struct vfio_pci_device *device, u32 index,
 }
 
 static void vfio_iommu_dma_map(struct vfio_pci_device *device,
-			       struct vfio_dma_region *region)
+			       struct dma_region *region)
 {
 	struct vfio_iommu_type1_dma_map args = {
 		.argsz = sizeof(args),
@@ -156,7 +156,7 @@ static void vfio_iommu_dma_map(struct vfio_pci_device *device,
 }
 
 static void iommufd_dma_map(struct vfio_pci_device *device,
-			    struct vfio_dma_region *region)
+			    struct dma_region *region)
 {
 	struct iommu_ioas_map args = {
 		.size = sizeof(args),
@@ -173,7 +173,7 @@ static void iommufd_dma_map(struct vfio_pci_device *device,
 }
 
 void vfio_pci_dma_map(struct vfio_pci_device *device,
-		      struct vfio_dma_region *region)
+		      struct dma_region *region)
 {
 	if (device->iommu->iommufd)
 		iommufd_dma_map(device, region);
@@ -184,7 +184,7 @@ void vfio_pci_dma_map(struct vfio_pci_device *device,
 }
 
 static void vfio_iommu_dma_unmap(struct vfio_pci_device *device,
-				 struct vfio_dma_region *region)
+				 struct dma_region *region)
 {
 	struct vfio_iommu_type1_dma_unmap args = {
 		.argsz = sizeof(args),
@@ -196,7 +196,7 @@ static void vfio_iommu_dma_unmap(struct vfio_pci_device *device,
 }
 
 static void iommufd_dma_unmap(struct vfio_pci_device *device,
-			      struct vfio_dma_region *region)
+			      struct dma_region *region)
 {
 	struct iommu_ioas_unmap args = {
 		.size = sizeof(args),
@@ -209,7 +209,7 @@ static void iommufd_dma_unmap(struct vfio_pci_device *device,
 }
 
 void vfio_pci_dma_unmap(struct vfio_pci_device *device,
-			struct vfio_dma_region *region)
+			struct dma_region *region)
 {
 	if (device->iommu->iommufd)
 		iommufd_dma_unmap(device, region);
diff --git a/tools/testing/selftests/vfio/vfio_dma_mapping_test.c b/tools/testing/selftests/vfio/vfio_dma_mapping_test.c
index ab19c54a774d..680232777839 100644
--- a/tools/testing/selftests/vfio/vfio_dma_mapping_test.c
+++ b/tools/testing/selftests/vfio/vfio_dma_mapping_test.c
@@ -126,7 +126,7 @@ TEST_F(vfio_dma_mapping_test, dma_map_unmap)
 {
 	const u64 size = variant->size ?: getpagesize();
 	const int flags = variant->mmap_flags;
-	struct vfio_dma_region region;
+	struct dma_region region;
 	struct iommu_mapping mapping;
 	u64 mapping_size = size;
 	int rc;
diff --git a/tools/testing/selftests/vfio/vfio_pci_driver_test.c b/tools/testing/selftests/vfio/vfio_pci_driver_test.c
index 2dbd70b7db62..79128a0c278d 100644
--- a/tools/testing/selftests/vfio/vfio_pci_driver_test.c
+++ b/tools/testing/selftests/vfio/vfio_pci_driver_test.c
@@ -19,7 +19,7 @@ static const char *device_bdf;
 } while (0)
 
 static void region_setup(struct vfio_pci_device *device,
-			 struct vfio_dma_region *region, u64 size)
+			 struct dma_region *region, u64 size)
 {
 	const int flags = MAP_SHARED | MAP_ANONYMOUS;
 	const int prot = PROT_READ | PROT_WRITE;
@@ -36,7 +36,7 @@ static void region_setup(struct vfio_pci_device *device,
 }
 
 static void region_teardown(struct vfio_pci_device *device,
-			    struct vfio_dma_region *region)
+			    struct dma_region *region)
 {
 	vfio_pci_dma_unmap(device, region);
 	VFIO_ASSERT_EQ(munmap(region->vaddr, region->size), 0);
@@ -44,7 +44,7 @@ static void region_teardown(struct vfio_pci_device *device,
 
 FIXTURE(vfio_pci_driver_test) {
 	struct vfio_pci_device *device;
-	struct vfio_dma_region memcpy_region;
+	struct dma_region memcpy_region;
 	void *vaddr;
 	int msi_fd;
 
-- 
2.51.0.710.ga91ca5db03-goog


  parent reply	other threads:[~2025-10-08 23:26 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-08 23:25 [PATCH 00/12] vfio: selftests: Support for multi-device tests David Matlack
2025-10-08 23:25 ` [PATCH 01/12] vfio: selftests: Split run.sh into separate scripts David Matlack
2025-11-10  3:21   ` Raghavendra Rao Ananta
2025-11-10 18:19     ` David Matlack
2025-10-08 23:25 ` [PATCH 02/12] vfio: selftests: Allow passing multiple BDFs on the command line David Matlack
2025-11-10  3:45   ` Raghavendra Rao Ananta
2025-11-10 18:31     ` David Matlack
2025-10-08 23:25 ` [PATCH 03/12] vfio: selftests: Rename struct vfio_iommu_mode to iommu_mode David Matlack
2025-10-08 23:25 ` [PATCH 04/12] vfio: selftests: Introduce struct iommu David Matlack
2025-10-08 23:25 ` [PATCH 05/12] vfio: selftests: Support multiple devices in the same container/iommufd David Matlack
2025-10-27 16:21   ` David Matlack
2025-11-07  3:37     ` Josh Hilke
2025-10-08 23:25 ` [PATCH 06/12] vfio: selftests: Eliminate overly chatty logging David Matlack
2025-10-08 23:25 ` [PATCH 07/12] vfio: selftests: Prefix logs with device BDF where relevant David Matlack
2025-11-10  4:54   ` Raghavendra Rao Ananta
2025-11-10 18:28     ` David Matlack
2025-10-08 23:25 ` David Matlack [this message]
2025-10-08 23:25 ` [PATCH 09/12] vfio: selftests: Move iommu_*() functions into iommu.c David Matlack
2025-10-08 23:25 ` [PATCH 10/12] vfio: selftests: Rename vfio_util.h to libvfio.h David Matlack
2025-10-08 23:25 ` [PATCH 11/12] vfio: selftests: Split libvfio.h into separate header files David Matlack
2025-10-08 23:25 ` [PATCH 12/12] vfio: selftests: Add vfio_pci_device_init_perf_test David Matlack
2025-10-16 16:12   ` David Matlack
2025-11-05 19:06 ` [PATCH 00/12] vfio: selftests: Support for multi-device tests Alex Williamson
2025-11-05 21:03   ` David Matlack
2025-11-05 21:54     ` Alex Williamson

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=20251008232531.1152035-9-dmatlack@google.com \
    --to=dmatlack@google.com \
    --cc=alex.williamson@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=jrhilke@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=vipinsh@google.com \
    /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