summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/iommufd/iommufd_test.h
diff options
context:
space:
mode:
authorNicolin Chen <nicolinc@nvidia.com>2023-08-18 03:10:32 -0700
committerJason Gunthorpe <jgg@nvidia.com>2023-08-18 12:52:15 -0300
commitaf4fde93c3196ed2cd4e64109a9307a7bc471c5a (patch)
treea516c6354b4e9a6383051732048fd027d4137742 /drivers/iommu/iommufd/iommufd_test.h
parent55dd4023cead250c89decf1a7a882c94cbf5765a (diff)
downloadlinux-stable-af4fde93c3196ed2cd4e64109a9307a7bc471c5a.tar.gz
linux-stable-af4fde93c3196ed2cd4e64109a9307a7bc471c5a.tar.bz2
linux-stable-af4fde93c3196ed2cd4e64109a9307a7bc471c5a.zip
iommufd/selftest: Add coverage for IOMMU_GET_HW_INFO ioctl
Add a mock_domain_hw_info function and an iommu_test_hw_info data structure. This allows to test the IOMMU_GET_HW_INFO ioctl passing the test_reg value for the mock_dev. Link: https://lore.kernel.org/r/20230818101033.4100-5-yi.l.liu@intel.com Signed-off-by: Nicolin Chen <nicolinc@nvidia.com> Signed-off-by: Yi Liu <yi.l.liu@intel.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/iommu/iommufd/iommufd_test.h')
-rw-r--r--drivers/iommu/iommufd/iommufd_test.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/iommu/iommufd/iommufd_test.h b/drivers/iommu/iommufd/iommufd_test.h
index 258de2253b61..3f3644375bf1 100644
--- a/drivers/iommu/iommufd/iommufd_test.h
+++ b/drivers/iommu/iommufd/iommufd_test.h
@@ -100,4 +100,13 @@ struct iommu_test_cmd {
};
#define IOMMU_TEST_CMD _IO(IOMMUFD_TYPE, IOMMUFD_CMD_BASE + 32)
+/* Mock structs for IOMMU_DEVICE_GET_HW_INFO ioctl */
+#define IOMMU_HW_INFO_TYPE_SELFTEST 0xfeedbeef
+#define IOMMU_HW_INFO_SELFTEST_REGVAL 0xdeadbeef
+
+struct iommu_test_hw_info {
+ __u32 flags;
+ __u32 test_reg;
+};
+
#endif