Re: [PATCH v7 6/9] iommufd/selftest: Add coverage for IOMMU_HWPT_INVALIDATE ioctl

From: Yi Liu
Date: Mon Dec 25 2023 - 22:59:20 EST


On 2023/12/22 12:09, Tian, Kevin wrote:
From: Liu, Yi L <yi.l.liu@xxxxxxxxx>
Sent: Thursday, December 21, 2023 11:40 PM

From: Nicolin Chen <nicolinc@xxxxxxxxxx>

Add test cases for the IOMMU_HWPT_INVALIDATE ioctl and verify it by using
the new IOMMU_TEST_OP_MD_CHECK_IOTLB.

Signed-off-by: Nicolin Chen <nicolinc@xxxxxxxxxx>
Co-developed-by: Yi Liu <yi.l.liu@xxxxxxxxx>
Signed-off-by: Yi Liu <yi.l.liu@xxxxxxxxx>

overall this look good:

Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>

with two nits:

+
+ num_inv = 1;
+ inv_reqs[0].flags = IOMMU_TEST_INVALIDATE_FLAG_ALL |
+
IOMMU_TEST_INVALIDATE_FLAG_TRIGGER_ERROR;
+ test_err_hwpt_invalidate(EINVAL, nested_hwpt_id[0],
inv_reqs,
+
IOMMU_HWPT_INVALIDATE_DATA_SELFTEST,
+ sizeof(*inv_reqs), &num_inv);
+ assert(!num_inv);

this may need adjustment upon whether we want to allow two flags together.

it was removed :)

and let's add a test for below code for completeness:

+ if (cmd->req_num && (!cmd->reqs_uptr || !cmd->req_len)) {
+ rc = -EINVAL;
+ goto out;
+ }

done.

--
Regards,
Yi Liu