Re: [PATCH v4 4/8] iommufd/selftest: Put iopf enablement in domain attach path
From: Nicolin Chen
Date: Tue Mar 18 2025 - 15:51:03 EST
On Thu, Mar 13, 2025 at 01:19:49PM +0800, Lu Baolu wrote:
> @@ -164,6 +167,8 @@ struct mock_dev {
> unsigned long flags;
> int id;
> u32 cache[MOCK_DEV_CACHE_NUM];
> + unsigned int iopf_refcount;
> + struct iommu_domain *domain;
Assuming both are protected by the core group->mutex, maybe add
lockdep_assert_held() in mock_dev_enable/disable_iopf()?
> +static int mock_domain_blocking_attach(struct iommu_domain *domain,
> + struct device *dev)
> +{
> + struct mock_dev *mdev = to_mock_dev(dev);
> +
> + mock_dev_disable_iopf(dev, mdev->domain);
> + mdev->domain = NULL;
The input domain is valid. Maybe better to rename mdev->domain
to mdev->iopf_domain?
With that,
Reviewed-by: Nicolin Chen <nicolinc@xxxxxxxxxx>