Skip to content

Commit 39a369c

Browse files
Xu Yilunjgunthorpe
authored andcommitted
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/[email protected] Reviewed-by: Nicolin Chen <[email protected]> Tested-by: Nicolin Chen <[email protected]> Signed-off-by: Xu Yilun <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent c4e496d commit 39a369c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tools/testing/selftests/iommu/iommufd.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3142,6 +3142,20 @@ TEST_F(iommufd_viommu, hw_queue)
31423142
test_ioctl_ioas_unmap(iova, PAGE_SIZE);
31433143
}
31443144

3145+
TEST_F(iommufd_viommu, vdevice_tombstone)
3146+
{
3147+
uint32_t viommu_id = self->viommu_id;
3148+
uint32_t dev_id = self->device_id;
3149+
uint32_t vdev_id = 0;
3150+
3151+
if (!dev_id)
3152+
SKIP(return, "Skipping test for variant no_viommu");
3153+
3154+
test_cmd_vdevice_alloc(viommu_id, dev_id, 0x99, &vdev_id);
3155+
test_ioctl_destroy(self->stdev_id);
3156+
EXPECT_ERRNO(ENOENT, _test_ioctl_destroy(self->fd, vdev_id));
3157+
}
3158+
31453159
FIXTURE(iommufd_device_pasid)
31463160
{
31473161
int fd;

0 commit comments

Comments
 (0)