From nobody Mon Dec 1 22:34:45 2025 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 35B1E346A18 for ; Wed, 26 Nov 2025 23:17:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764199079; cv=none; b=n4p5wuWK9wi5mRV0Rvxkf/aoBTrvuL6w/eMSKYdV1oeWf6AkSQBH5rSDpleqHp2ZhQox1fidlfHzHOeS9WJOAkjGRfj3WzzVttu7IakggitmBqr+ACE9LENXQbpFdnRU2qwXHFR2y0FfBp/AVP9UOCn5OYLfHJwoQoroz2YGV8g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764199079; c=relaxed/simple; bh=5/SCuudTnVJVagXzmpq8FqpR4LPOkZ4AQaSUVZpAyeA=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=m8LMTyipMymMwX94k4M/zccGFttzM1Cqo2nJWwHnJ9sJJevNBkNsvWjyucFFy8UICw7xcVDvti46b0v91eP5aO8GPSPzzeg5bndtJfzO/tT5f1dyxQUC9bUSke/7325JCaIOOGXJb/XVmjzxaWHelwK72lXQdvoPeKc+25JAoXg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--dmatlack.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=oW1hvqn1; arc=none smtp.client-ip=209.85.216.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--dmatlack.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="oW1hvqn1" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-340c261fb38so384796a91.0 for ; Wed, 26 Nov 2025 15:17:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1764199077; x=1764803877; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=2a9D5jJ9FB8GiVn7bo2b0SNxBhehEjQAFnObT7UgTmQ=; b=oW1hvqn1a71LL3ffufvUkUSm1WF1QIMuNMroMzuZp4Mg9oOD/kV/6I5O34MHXE4t5v WhlvsuI2PubNNuRiBORT2rjCwksbHlMn1K/9KUVkWZjKpYuKe352PqSv0aMmrc5yOzpG 3HRlbruKsqmHTUP7sqsNFhFqdxwTHFqbaHIsV/ZkUvWLFry0ilgf2i2gz89X0eWLZ1EE D2p8KBS8MbgC9hetmfohaplvoEMP78tb9zc+0uVQhDpwlmxCREfi0/20r8cBJdZLZfTg 9bV8h/AcIXcAYm0QDjeF6nJyI3aesUaaBSbQyP5NEptivNnWNhVXbBleH2TNm3Gl0ilU lVCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764199077; x=1764803877; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2a9D5jJ9FB8GiVn7bo2b0SNxBhehEjQAFnObT7UgTmQ=; b=UpeYTjtpIZIpbzRs+sBS2o6VYmUDYYQYCyGKfEQ4HE56NkhyAPvwRg40zYWQy3tOYU 6VwSzLvm85RoJhbq9dSnGtMMSA7wRqGvEgCIScju0VKlm3PfB693pe8iZPMumTWMeYqQ KIo6/E98nf0vyqFq74bKi3HfF8Y6m7lhw+0pgWtUYZ1a8v45xbqKjlV8/rWdga6IdK/w UjLQAQzKeNtmosW0TYaS4zMimrUYyeDQ9u4YmUvM/MxbMHZTvg+ZR4QFl8Hcdhxd5P3p okAup3bZVJ/tYr/QTVWZUTScToCjP6kJenqfe7St75eBgCJc9RgIpzJAqBr6BJvHOO/J zW0g== X-Forwarded-Encrypted: i=1; AJvYcCVng9GlwDYPIdQX9uEU3yNyzc40YMrsG3Inj3r6igocS8he1ii7d6nqQIirsL69lEF78j3stROicFII9/w=@vger.kernel.org X-Gm-Message-State: AOJu0YyzasCiAte96E6AcMb45G5/VD8qXKVJCuooKvZeIlTzkbS+I5yS /sBxrc+PuK/qUwiQNcJuLsgQ/6OUMEb4VamI/T2Q82c3xgYNWTaG79+i+6qu4j8ISlcV3KU2wr9 LPihYQoxcgyQ/Aw== X-Google-Smtp-Source: AGHT+IHuIShD6RC7Uglwv6GJggqqApaqxy3RkM9V/d+JZpaS74r3sOttZlNtCq4H6+fs9d4t2pHOQSUCma4m6Q== X-Received: from pjbmt14.prod.google.com ([2002:a17:90b:230e:b0:33b:d40a:d93a]) (user=dmatlack job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:3d85:b0:32d:f352:f764 with SMTP id 98e67ed59e1d1-34733e6caa6mr15630962a91.2.1764199077598; Wed, 26 Nov 2025 15:17:57 -0800 (PST) Date: Wed, 26 Nov 2025 23:17:25 +0000 In-Reply-To: <20251126231733.3302983-1-dmatlack@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251126231733.3302983-1-dmatlack@google.com> X-Mailer: git-send-email 2.52.0.487.g5c8c507ade-goog Message-ID: <20251126231733.3302983-11-dmatlack@google.com> Subject: [PATCH v4 10/18] vfio: selftests: Rename struct vfio_dma_region to dma_region From: David Matlack To: Alex Williamson Cc: Alex Mastro , David Matlack , Jason Gunthorpe , Josh Hilke , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Raghavendra Rao Ananta , Vipin Sharma Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Tested-by: Alex Mastro Reviewed-by: Raghavendra Rao Ananta Signed-off-by: David Matlack --- 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/t= esting/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; =20 #define INVALID_IOVA UINT64_MAX =20 -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; =20 /* Region to be used by the driver (e.g. for in-memory descriptors) */ - struct vfio_dma_region region; + struct dma_region region; =20 /* 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 *al= locator); iova_t iova_allocator_alloc(struct iova_allocator *allocator, size_t size); =20 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= ); =20 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); } =20 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/tes= ting/selftests/vfio/lib/vfio_pci_device.c index f0cf18d3de55..422ad8dfad95 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 *allo= cator, size_t size) =20 iova_t __to_iova(struct vfio_pci_device *device, void *vaddr) { - struct vfio_dma_region *region; + struct dma_region *region; =20 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 *de= vice, u32 index, } =20 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 =3D { .argsz =3D sizeof(args), @@ -404,7 +404,7 @@ static int vfio_iommu_dma_map(struct vfio_pci_device *d= evice, } =20 static int iommufd_dma_map(struct vfio_pci_device *device, - struct vfio_dma_region *region) + struct dma_region *region) { struct iommu_ioas_map args =3D { .size =3D sizeof(args), @@ -424,7 +424,7 @@ static int iommufd_dma_map(struct vfio_pci_device *devi= ce, } =20 int __vfio_pci_dma_map(struct vfio_pci_device *device, - struct vfio_dma_region *region) + struct dma_region *region) { int ret; =20 @@ -480,7 +480,7 @@ static int iommufd_dma_unmap(int fd, u64 iova, u64 leng= th, u32 ioas_id, } =20 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; =20 @@ -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; =20 if (device->iommu->iommufd) ret =3D iommufd_dma_unmap(device->iommu->iommufd, 0, UINT64_MAX, diff --git a/tools/testing/selftests/vfio/vfio_dma_mapping_test.c b/tools/t= esting/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 =3D variant->size ?: getpagesize(); const int flags =3D variant->mmap_flags; - struct vfio_dma_region region; + struct dma_region region; struct iommu_mapping mapping; u64 mapping_size =3D 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; }; =20 @@ -227,7 +227,7 @@ FIXTURE_VARIANT_ADD_ALL_IOMMU_MODES(); =20 FIXTURE_SETUP(vfio_dma_map_limit_test) { - struct vfio_dma_region *region =3D &self->region; + struct dma_region *region =3D &self->region; struct iommu_iova_range *ranges; u64 region_size =3D getpagesize(); iova_t last_iova; @@ -264,7 +264,7 @@ FIXTURE_TEARDOWN(vfio_dma_map_limit_test) =20 TEST_F(vfio_dma_map_limit_test, unmap_range) { - struct vfio_dma_region *region =3D &self->region; + struct dma_region *region =3D &self->region; u64 unmapped; int rc; =20 @@ -278,7 +278,7 @@ TEST_F(vfio_dma_map_limit_test, unmap_range) =20 TEST_F(vfio_dma_map_limit_test, unmap_all) { - struct vfio_dma_region *region =3D &self->region; + struct dma_region *region =3D &self->region; u64 unmapped; int rc; =20 @@ -292,7 +292,7 @@ TEST_F(vfio_dma_map_limit_test, unmap_all) =20 TEST_F(vfio_dma_map_limit_test, overflow) { - struct vfio_dma_region *region =3D &self->region; + struct dma_region *region =3D &self->region; int rc; =20 region->iova =3D ~(iova_t)0 & ~(region->size - 1); diff --git a/tools/testing/selftests/vfio/vfio_pci_driver_test.c b/tools/te= sting/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; =20 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 =3D MAP_SHARED | MAP_ANONYMOUS; const int prot =3D PROT_READ | PROT_WRITE; @@ -37,7 +37,7 @@ static void region_setup(struct vfio_pci_device *device, } =20 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; =20 --=20 2.52.0.487.g5c8c507ade-goog