From: David Matlack <dmatlack@google.com>
To: Alex Williamson <alex@shazbot.org>
Cc: Alex Mastro <amastro@fb.com>, David Matlack <dmatlack@google.com>,
Jason Gunthorpe <jgg@nvidia.com>,
Josh Hilke <jrhilke@google.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org,
Raghavendra Rao Ananta <rananta@google.com>,
Vipin Sharma <vipinsh@google.com>
Subject: [PATCH v3 10/18] vfio: selftests: Rename struct vfio_dma_region to dma_region
Date: Fri, 21 Nov 2025 18:14:21 +0000 [thread overview]
Message-ID: <20251121181429.1421717-11-dmatlack@google.com> (raw)
In-Reply-To: <20251121181429.1421717-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.
Reviewed-by: Alex Mastro <amastro@fb.com>
Tested-by: Alex Mastro <amastro@fb.com>
Signed-off-by: David Matlack <dmatlack@google.com>
---
tools/testing/selftests/vfio/lib/include/vfio_util.h | 12 ++++++------
tools/testing/selftests/vfio/lib/vfio_pci_device.c | 12 ++++++------
tools/testing/selftests/vfio/vfio_dma_mapping_test.c | 12 ++++++------
tools/testing/selftests/vfio/vfio_pci_driver_test.c | 6 +++---
4 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/tools/testing/selftests/vfio/lib/include/vfio_util.h b/tools/testing/selftests/vfio/lib/include/vfio_util.h
index babbf90688e8..7784422116de 100644
--- a/tools/testing/selftests/vfio/lib/include/vfio_util.h
+++ b/tools/testing/selftests/vfio/lib/include/vfio_util.h
@@ -80,7 +80,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;
@@ -154,7 +154,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;
@@ -236,20 +236,20 @@ void iova_allocator_cleanup(struct iova_allocator *allocator);
iova_t iova_allocator_alloc(struct iova_allocator *allocator, size_t size);
int __vfio_pci_dma_map(struct vfio_pci_device *device,
- struct vfio_dma_region *region);
+ struct dma_region *region);
int __vfio_pci_dma_unmap(struct vfio_pci_device *device,
- struct vfio_dma_region *region,
+ struct dma_region *region,
u64 *unmapped);
int __vfio_pci_dma_unmap_all(struct vfio_pci_device *device, u64 *unmapped);
static inline void vfio_pci_dma_map(struct vfio_pci_device *device,
- struct vfio_dma_region *region)
+ struct dma_region *region)
{
VFIO_ASSERT_EQ(__vfio_pci_dma_map(device, region), 0);
}
static inline void vfio_pci_dma_unmap(struct vfio_pci_device *device,
- struct vfio_dma_region *region)
+ struct dma_region *region)
{
VFIO_ASSERT_EQ(__vfio_pci_dma_unmap(device, region, NULL), 0);
}
diff --git a/tools/testing/selftests/vfio/lib/vfio_pci_device.c b/tools/testing/selftests/vfio/lib/vfio_pci_device.c
index f3aea724695d..877b145cef63 100644
--- a/tools/testing/selftests/vfio/lib/vfio_pci_device.c
+++ b/tools/testing/selftests/vfio/lib/vfio_pci_device.c
@@ -275,7 +275,7 @@ iova_t iova_allocator_alloc(struct iova_allocator *allocator, size_t size)
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)
@@ -387,7 +387,7 @@ static void vfio_pci_irq_get(struct vfio_pci_device *device, u32 index,
}
static int 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),
@@ -404,7 +404,7 @@ static int vfio_iommu_dma_map(struct vfio_pci_device *device,
}
static int 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),
@@ -424,7 +424,7 @@ static int iommufd_dma_map(struct vfio_pci_device *device,
}
int __vfio_pci_dma_map(struct vfio_pci_device *device,
- struct vfio_dma_region *region)
+ struct dma_region *region)
{
int ret;
@@ -480,7 +480,7 @@ static int iommufd_dma_unmap(int fd, u64 iova, u64 length, u32 ioas_id,
}
int __vfio_pci_dma_unmap(struct vfio_pci_device *device,
- struct vfio_dma_region *region, u64 *unmapped)
+ struct dma_region *region, u64 *unmapped)
{
int ret;
@@ -504,7 +504,7 @@ int __vfio_pci_dma_unmap(struct vfio_pci_device *device,
int __vfio_pci_dma_unmap_all(struct vfio_pci_device *device, u64 *unmapped)
{
int ret;
- struct vfio_dma_region *curr, *next;
+ struct dma_region *curr, *next;
if (device->iommu->iommufd)
ret = iommufd_dma_unmap(device->iommu->iommufd, 0, UINT64_MAX,
diff --git a/tools/testing/selftests/vfio/vfio_dma_mapping_test.c b/tools/testing/selftests/vfio/vfio_dma_mapping_test.c
index 4727feb214c8..289af4665803 100644
--- a/tools/testing/selftests/vfio/vfio_dma_mapping_test.c
+++ b/tools/testing/selftests/vfio/vfio_dma_mapping_test.c
@@ -136,7 +136,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;
u64 unmapped;
@@ -208,7 +208,7 @@ TEST_F(vfio_dma_mapping_test, dma_map_unmap)
FIXTURE(vfio_dma_map_limit_test) {
struct iommu *iommu;
struct vfio_pci_device *device;
- struct vfio_dma_region region;
+ struct dma_region region;
size_t mmap_size;
};
@@ -227,7 +227,7 @@ FIXTURE_VARIANT_ADD_ALL_IOMMU_MODES();
FIXTURE_SETUP(vfio_dma_map_limit_test)
{
- struct vfio_dma_region *region = &self->region;
+ struct dma_region *region = &self->region;
struct iommu_iova_range *ranges;
u64 region_size = getpagesize();
iova_t last_iova;
@@ -264,7 +264,7 @@ FIXTURE_TEARDOWN(vfio_dma_map_limit_test)
TEST_F(vfio_dma_map_limit_test, unmap_range)
{
- struct vfio_dma_region *region = &self->region;
+ struct dma_region *region = &self->region;
u64 unmapped;
int rc;
@@ -278,7 +278,7 @@ TEST_F(vfio_dma_map_limit_test, unmap_range)
TEST_F(vfio_dma_map_limit_test, unmap_all)
{
- struct vfio_dma_region *region = &self->region;
+ struct dma_region *region = &self->region;
u64 unmapped;
int rc;
@@ -292,7 +292,7 @@ TEST_F(vfio_dma_map_limit_test, unmap_all)
TEST_F(vfio_dma_map_limit_test, overflow)
{
- struct vfio_dma_region *region = &self->region;
+ struct dma_region *region = &self->region;
int rc;
region->iova = ~(iova_t)0 & ~(region->size - 1);
diff --git a/tools/testing/selftests/vfio/vfio_pci_driver_test.c b/tools/testing/selftests/vfio/vfio_pci_driver_test.c
index b0c7d812de1f..057aa9bbe13e 100644
--- a/tools/testing/selftests/vfio/vfio_pci_driver_test.c
+++ b/tools/testing/selftests/vfio/vfio_pci_driver_test.c
@@ -20,7 +20,7 @@ static const char *device_bdf;
static void region_setup(struct vfio_pci_device *device,
struct iova_allocator *iova_allocator,
- 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;
@@ -37,7 +37,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);
@@ -47,7 +47,7 @@ FIXTURE(vfio_pci_driver_test) {
struct iommu *iommu;
struct vfio_pci_device *device;
struct iova_allocator *iova_allocator;
- struct vfio_dma_region memcpy_region;
+ struct dma_region memcpy_region;
void *vaddr;
int msi_fd;
--
2.52.0.rc2.455.g230fcf2819-goog
next prev parent reply other threads:[~2025-11-21 18:14 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-21 18:14 [PATCH v3 00/18] vfio: selftests: Support for multi-device tests David Matlack
2025-11-21 18:14 ` [PATCH v3 01/18] vfio: selftests: Move run.sh into scripts directory David Matlack
2025-11-21 18:14 ` [PATCH v3 02/18] vfio: selftests: Split run.sh into separate scripts David Matlack
2025-11-21 18:14 ` [PATCH v3 03/18] vfio: selftests: Allow passing multiple BDFs on the command line David Matlack
2025-11-21 18:14 ` [PATCH v3 04/18] vfio: selftests: Rename struct vfio_iommu_mode to iommu_mode David Matlack
2025-11-21 18:14 ` [PATCH v3 05/18] vfio: selftests: Introduce struct iommu David Matlack
2025-11-21 18:14 ` [PATCH v3 06/18] vfio: selftests: Support multiple devices in the same container/iommufd David Matlack
2025-11-24 11:17 ` Raghavendra Rao Ananta
2025-11-25 17:37 ` David Matlack
2025-11-21 18:14 ` [PATCH v3 07/18] vfio: selftests: Eliminate overly chatty logging David Matlack
2025-11-22 14:56 ` kernel test robot
2025-11-21 18:14 ` [PATCH v3 08/18] vfio: selftests: Prefix logs with device BDF where relevant David Matlack
2025-11-21 18:14 ` [PATCH v3 09/18] vfio: selftests: Upgrade driver logging to dev_err() David Matlack
2025-11-21 18:14 ` David Matlack [this message]
2025-11-21 18:14 ` [PATCH v3 11/18] vfio: selftests: Move IOMMU library code into iommu.c David Matlack
2025-11-23 1:59 ` kernel test robot
2025-11-21 18:14 ` [PATCH v3 12/18] vfio: selftests: Move IOVA allocator into iova_allocator.c David Matlack
2025-11-23 1:57 ` kernel test robot
2025-11-21 18:14 ` [PATCH v3 13/18] vfio: selftests: Stop passing device for IOMMU operations David Matlack
2025-11-21 18:14 ` [PATCH v3 14/18] vfio: selftests: Rename vfio_util.h to libvfio.h David Matlack
2025-11-21 18:14 ` [PATCH v3 15/18] vfio: selftests: Move vfio_selftests_*() helpers into libvfio.c David Matlack
2025-11-21 18:14 ` [PATCH v3 16/18] vfio: selftests: Split libvfio.h into separate header files David Matlack
2025-11-21 18:14 ` [PATCH v3 17/18] vfio: selftests: Eliminate INVALID_IOVA David Matlack
2025-11-21 18:14 ` [PATCH v3 18/18] vfio: selftests: Add vfio_pci_device_init_perf_test David Matlack
2025-11-24 11:20 ` [PATCH v3 00/18] vfio: selftests: Support for multi-device tests Raghavendra Rao Ananta
2025-11-25 17:38 ` 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=20251121181429.1421717-11-dmatlack@google.com \
--to=dmatlack@google.com \
--cc=alex@shazbot.org \
--cc=amastro@fb.com \
--cc=jgg@nvidia.com \
--cc=jrhilke@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=rananta@google.com \
--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