From: Narayana Murty N <nnmlinux@linux.ibm.com>
To: alex@shazbot.org, dmatlack@google.com, shuah@kernel.org
Cc: amastro@fb.com, rananta@google.com, nnmlinux@linux.ibm.com,
kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, vaibhav@linux.ibm.com,
sbhat@linux.ibm.com, harshpb@linux.ibm.com
Subject: [RFC PATCH 2/6] selftests/vfio: add sPAPR TCE v2 IOMMU mode
Date: Thu, 2 Jul 2026 23:28:02 -0400 [thread overview]
Message-ID: <20260703032806.40946-3-nnmlinux@linux.ibm.com> (raw)
In-Reply-To: <20260703032806.40946-1-nnmlinux@linux.ibm.com>
Add a PowerPC-specific VFIO selftest IOMMU mode for sPAPR TCE v2.
The new mode uses the legacy VFIO container interface with
VFIO_SPAPR_TCE_v2_IOMMU. It does not use iommufd or VFIO cdev.
On PowerPC, generate the sPAPR TCE v2 fixture variant so the tests exercise
the backend that is valid for this platform.
Signed-off-by: Narayana Murty N <nnmlinux@linux.ibm.com>
---
tools/testing/selftests/vfio/lib/include/libvfio/iommu.h | 8 ++++++++
tools/testing/selftests/vfio/lib/iommu.c | 7 +++++++
2 files changed, 15 insertions(+)
diff --git a/tools/testing/selftests/vfio/lib/include/libvfio/iommu.h b/tools/testing/selftests/vfio/lib/include/libvfio/iommu.h
index e9a3386a4719..ba027a7270d0 100644
--- a/tools/testing/selftests/vfio/lib/include/libvfio/iommu.h
+++ b/tools/testing/selftests/vfio/lib/include/libvfio/iommu.h
@@ -66,17 +66,25 @@ struct iommu_iova_range *iommu_iova_ranges(struct iommu *iommu, u32 *nranges);
#define MODE_IOMMUFD_COMPAT_TYPE1 "iommufd_compat_type1"
#define MODE_IOMMUFD_COMPAT_TYPE1V2 "iommufd_compat_type1v2"
#define MODE_IOMMUFD "iommufd"
+#ifdef __powerpc__
+#define MODE_VFIO_SPAPR_TCE_V2_IOMMU "vfio_spapr_tce_v2_iommu"
+#endif
/*
* Generator for VFIO selftests fixture variants that replicate across all
* possible IOMMU modes. Tests must define FIXTURE_VARIANT_ADD_IOMMU_MODE()
* which should then use FIXTURE_VARIANT_ADD() to create the variant.
*/
+#ifdef __powerpc__
+#define FIXTURE_VARIANT_ADD_ALL_IOMMU_MODES(...) \
+FIXTURE_VARIANT_ADD_IOMMU_MODE(vfio_spapr_tce_v2_iommu, ##__VA_ARGS__)
+#else
#define FIXTURE_VARIANT_ADD_ALL_IOMMU_MODES(...) \
FIXTURE_VARIANT_ADD_IOMMU_MODE(vfio_type1_iommu, ##__VA_ARGS__); \
FIXTURE_VARIANT_ADD_IOMMU_MODE(vfio_type1v2_iommu, ##__VA_ARGS__); \
FIXTURE_VARIANT_ADD_IOMMU_MODE(iommufd_compat_type1, ##__VA_ARGS__); \
FIXTURE_VARIANT_ADD_IOMMU_MODE(iommufd_compat_type1v2, ##__VA_ARGS__); \
FIXTURE_VARIANT_ADD_IOMMU_MODE(iommufd, ##__VA_ARGS__)
+#endif
#endif /* SELFTESTS_VFIO_LIB_INCLUDE_LIBVFIO_IOMMU_H */
diff --git a/tools/testing/selftests/vfio/lib/iommu.c b/tools/testing/selftests/vfio/lib/iommu.c
index 035dac069d60..e86457a715bf 100644
--- a/tools/testing/selftests/vfio/lib/iommu.c
+++ b/tools/testing/selftests/vfio/lib/iommu.c
@@ -47,6 +47,13 @@ static const struct iommu_mode iommu_modes[] = {
{
.name = MODE_IOMMUFD,
},
+#ifdef __powerpc__
+ {
+ .name = MODE_VFIO_SPAPR_TCE_V2_IOMMU,
+ .container_path = "/dev/vfio/vfio",
+ .iommu_type = VFIO_SPAPR_TCE_v2_IOMMU,
+ },
+#endif
};
static const struct iommu_mode *lookup_iommu_mode(const char *iommu_mode)
--
2.51.1
next prev parent reply other threads:[~2026-07-03 7:53 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-03 3:28 [RFC PATCH 0/6] selftests/vfio: Add sPAPR TCE v2 coverage Narayana Murty N
2026-07-03 3:28 ` [RFC PATCH 1/6] selftests/vfio: allow selecting IOMMU backend from environment Narayana Murty N
2026-07-03 8:06 ` sashiko-bot
2026-07-06 21:49 ` David Matlack
2026-07-03 3:28 ` Narayana Murty N [this message]
2026-07-03 8:09 ` [RFC PATCH 2/6] selftests/vfio: add sPAPR TCE v2 IOMMU mode sashiko-bot
2026-07-03 3:28 ` [RFC PATCH 3/6] selftests/vfio: add sPAPR TCE v2 DMA window helpers Narayana Murty N
2026-07-03 8:05 ` sashiko-bot
2026-07-06 22:04 ` David Matlack
2026-07-06 22:17 ` David Matlack
2026-07-03 3:28 ` [RFC PATCH 4/6] selftests/vfio: Exercise sPAPR DDW path for hugepage DMA mappings Narayana Murty N
2026-07-03 8:11 ` sashiko-bot
2026-07-06 22:33 ` David Matlack
2026-07-06 22:41 ` David Matlack
2026-07-03 3:28 ` [RFC PATCH 5/6] selftests/vfio: Accept sPAPR errno for DMA range overflow Narayana Murty N
2026-07-03 8:08 ` sashiko-bot
2026-07-06 22:47 ` David Matlack
2026-07-03 3:28 ` [RFC PATCH 6/6] selftests/vfio: Enable VFIO selftests on ppc64 and ppc64le Narayana Murty N
2026-07-03 8:14 ` sashiko-bot
2026-07-03 8:28 ` [RFC PATCH 0/6] selftests/vfio: Add sPAPR TCE v2 coverage Harsh Prateek Bora
2026-07-06 22:55 ` 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=20260703032806.40946-3-nnmlinux@linux.ibm.com \
--to=nnmlinux@linux.ibm.com \
--cc=alex@shazbot.org \
--cc=amastro@fb.com \
--cc=dmatlack@google.com \
--cc=harshpb@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=rananta@google.com \
--cc=sbhat@linux.ibm.com \
--cc=shuah@kernel.org \
--cc=vaibhav@linux.ibm.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 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.