From: Zhenzhong Duan <zhenzhong.duan@intel.com>
To: linux-kernel@vger.kernel.org, iommu@lists.linux.dev
Cc: dwmw2@infradead.org, baolu.lu@linux.intel.com, joro@8bytes.org,
will@kernel.org, robin.murphy@arm.com, jgg@ziepe.ca,
kevin.tian@intel.com, Zhenzhong Duan <zhenzhong.duan@intel.com>,
linux-kselftest@vger.kernel.org
Subject: [PATCH 3/3] iommufd/selftest: Test dirty tracking on PASID
Date: Wed, 4 Feb 2026 21:34:04 -0500 [thread overview]
Message-ID: <20260205023405.41583-4-zhenzhong.duan@intel.com> (raw)
In-Reply-To: <20260205023405.41583-1-zhenzhong.duan@intel.com>
Add test case for dirty tracking on a domain attached to PASID, also
confirm attachment to PASID fail if device doesn't support dirty tracking.
Suggested-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
tools/testing/selftests/iommu/iommufd.c | 27 +++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/tools/testing/selftests/iommu/iommufd.c b/tools/testing/selftests/iommu/iommufd.c
index dadad277f4eb..d1fe5dbc2813 100644
--- a/tools/testing/selftests/iommu/iommufd.c
+++ b/tools/testing/selftests/iommu/iommufd.c
@@ -2275,6 +2275,33 @@ TEST_F(iommufd_dirty_tracking, set_dirty_tracking)
test_ioctl_destroy(hwpt_id);
}
+TEST_F(iommufd_dirty_tracking, pasid_set_dirty_tracking)
+{
+ uint32_t stddev_id, ioas_id, hwpt_id, pasid = 100;
+ uint32_t dev_flags = MOCK_FLAGS_DEVICE_PASID;
+
+ /* Regular case */
+ test_cmd_hwpt_alloc(self->idev_id, self->ioas_id,
+ IOMMU_HWPT_ALLOC_PASID | IOMMU_HWPT_ALLOC_DIRTY_TRACKING,
+ &hwpt_id);
+ test_cmd_mock_domain_flags(hwpt_id, dev_flags, &stddev_id, NULL, NULL);
+ ASSERT_EQ(0, _test_cmd_pasid_attach(self->fd, stddev_id, pasid, hwpt_id));
+ test_cmd_set_dirty_tracking(hwpt_id, true);
+ test_cmd_set_dirty_tracking(hwpt_id, false);
+ ASSERT_EQ(0, _test_cmd_pasid_detach(self->fd, stddev_id, pasid));
+
+ test_ioctl_destroy(stddev_id);
+
+ /* IOMMU device does not support dirty tracking */
+ dev_flags |= MOCK_FLAGS_DEVICE_NO_DIRTY;
+ test_ioctl_ioas_alloc(&ioas_id);
+ test_cmd_mock_domain_flags(ioas_id, dev_flags, &stddev_id, NULL, NULL);
+ EXPECT_ERRNO(EINVAL, _test_cmd_pasid_attach(self->fd, stddev_id, pasid, hwpt_id));
+
+ test_ioctl_destroy(stddev_id);
+ test_ioctl_destroy(hwpt_id);
+}
+
TEST_F(iommufd_dirty_tracking, device_dirty_capability)
{
uint32_t caps = 0;
--
2.47.3
next prev parent reply other threads:[~2026-02-05 2:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-05 2:34 [PATCH 0/3] iommupt/vtd: Support " Zhenzhong Duan
2026-02-05 2:34 ` [PATCH 1/3] iommupt/vtd: Pass dmar_domain pointer to device_set_dirty_tracking() Zhenzhong Duan
2026-02-05 2:34 ` [PATCH 2/3] iommupt/vtd: Support dirty tracking on PASID Zhenzhong Duan
2026-03-27 7:51 ` Tian, Kevin
2026-03-27 9:12 ` Duan, Zhenzhong
2026-02-05 2:34 ` Zhenzhong Duan [this message]
2026-02-06 0:43 ` [PATCH 0/3] " Jason Gunthorpe
2026-02-06 3:44 ` Duan, Zhenzhong
2026-03-23 1:51 ` Duan, Zhenzhong
2026-03-23 2:54 ` Baolu Lu
2026-03-26 10:54 ` Yi Liu
2026-03-30 2:04 ` Duan, Zhenzhong
2026-03-30 7:57 ` Baolu Lu
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=20260205023405.41583-4-zhenzhong.duan@intel.com \
--to=zhenzhong.duan@intel.com \
--cc=baolu.lu@linux.intel.com \
--cc=dwmw2@infradead.org \
--cc=iommu@lists.linux.dev \
--cc=jgg@ziepe.ca \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=will@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®