summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@nvidia.com>2023-07-17 20:12:15 +0200
committerJason Gunthorpe <jgg@nvidia.com>2023-07-26 15:20:41 +0200
commit6583c865dec5493beb4c72fd724eb9d43d8d7ebb (patch)
treebd59bd6893b066879bd10b58d8ced989a8fd97a0 /drivers
parentiommufd/selftest: Return the real idev id from selftest mock_domain (diff)
downloadlinux-6583c865dec5493beb4c72fd724eb9d43d8d7ebb.tar.xz
linux-6583c865dec5493beb4c72fd724eb9d43d8d7ebb.zip
iommufd/selftest: Add a selftest for IOMMU_HWPT_ALLOC
Test the basic flow. Link: https://lore.kernel.org/r/19-v8-6659224517ea+532-iommufd_alloc_jgg@nvidia.com Reviewed-by: Kevin Tian <kevin.tian@intel.com> Tested-by: Nicolin Chen <nicolinc@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/iommu/iommufd/io_pagetable.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/iommu/iommufd/io_pagetable.c b/drivers/iommu/iommufd/io_pagetable.c
index 112bea5a84e4..4d095115c2d0 100644
--- a/drivers/iommu/iommufd/io_pagetable.c
+++ b/drivers/iommu/iommufd/io_pagetable.c
@@ -1180,6 +1180,9 @@ int iopt_table_enforce_dev_resv_regions(struct io_pagetable *iopt,
unsigned int num_sw_msi = 0;
int rc;
+ if (iommufd_should_fail())
+ return -EINVAL;
+
down_write(&iopt->iova_rwsem);
/* FIXME: drivers allocate memory but there is no failure propogated */
iommu_get_resv_regions(dev, &resv_regions);