diff options
| author | Xu Yilun <yilun.xu@linux.intel.com> | 2025-07-16 15:03:48 +0800 |
|---|---|---|
| committer | Jason Gunthorpe <jgg@nvidia.com> | 2025-07-18 17:33:08 -0300 |
| commit | 39a369c34152e1b76895fda37aa586dfb9b2cf38 (patch) | |
| tree | 0baafcb25cc670bb16e0623b5bfbe571759ae57f | |
| parent | c4e496d413686cbd717139cfd8c58f467eff9e08 (diff) | |
iommufd/selftest: Add coverage for vdevice tombstone
This tests the flow to tombstone vdevice when idevice is to be unbound
before vdevice destruction. The expected results of the tombstone are:
- The vdevice ID can't be reused anymore (not tested in this patch).
- Even ioctl(IOMMU_DESTROY) can't free the vdevice ID.
- iommufd_fops_release() can still free everything.
Link: https://patch.msgid.link/r/20250716070349.1807226-8-yilun.xu@linux.intel.com
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
Tested-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Xu Yilun <yilun.xu@linux.intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
| -rw-r--r-- | tools/testing/selftests/iommu/iommufd.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/testing/selftests/iommu/iommufd.c b/tools/testing/selftests/iommu/iommufd.c index d16fd9928b31..4de9ce066692 100644 --- a/tools/testing/selftests/iommu/iommufd.c +++ b/tools/testing/selftests/iommu/iommufd.c @@ -3142,6 +3142,20 @@ TEST_F(iommufd_viommu, hw_queue) test_ioctl_ioas_unmap(iova, PAGE_SIZE); } +TEST_F(iommufd_viommu, vdevice_tombstone) +{ + uint32_t viommu_id = self->viommu_id; + uint32_t dev_id = self->device_id; + uint32_t vdev_id = 0; + + if (!dev_id) + SKIP(return, "Skipping test for variant no_viommu"); + + test_cmd_vdevice_alloc(viommu_id, dev_id, 0x99, &vdev_id); + test_ioctl_destroy(self->stdev_id); + EXPECT_ERRNO(ENOENT, _test_ioctl_destroy(self->fd, vdev_id)); +} + FIXTURE(iommufd_device_pasid) { int fd; |
