RE: [PATCH v2 6/7] iommufd/selftest: Make selftest create a more complete mock device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: Jason Gunthorpe <jgg@xxxxxxxxxx>
> Sent: Thursday, February 23, 2023 5:03 AM
> 
> iommufd wants to use more infrastructure, like the iommu_group, that the
> mock device does not support. Create a more complete mock device that can
> go through the whole cycle of ownership, blocking domain, and has an
> iommu_group.

this is a nice move! Presumable with a real struct device we can further
extend the mock device to test nested, pasid attach/alloc, etc. in the
future.

> +
> +	/*
> +	 * The iommu core has no way to associate a single device with an
> iommu
> +	 * driver (heck currently it can't even support two iommu_drivers
> +	 * registering). Hack it together with an open coded dev_iommu_get().
> +	 * Notice that the normal notifier triggered iommu release process
> also
> +	 * does not work here because this bus is not in iommu_buses.
> +	 */
> +	mdev->dev.iommu = kzalloc(sizeof(*dev_iommu), GFP_KERNEL);
> +	if (!mdev->dev.iommu) {
> +		rc = -ENOMEM;
> +		goto err_group;
> +	}
> +	mutex_init(&mdev->dev.iommu->lock);
> +	mdev->dev.iommu->iommu_dev = &mock_iommu_device;

I understand how this hack works but didn't get why in this case
dev_iommu_get() cannot be reused...

but this is minor.

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




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux