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

From: Tian, Kevin
Date: Thu Dec 21 2023 - 23:10:10 EST


> 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.

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;
+ }