Re: [PATCH 2/5] iommu: Add blocking_domain_ops field in iommu_ops

From: Baolu Lu
Date: Wed May 18 2022 - 02:43:48 EST


On 2022/5/17 21:13, Jason Gunthorpe wrote:
On Tue, May 17, 2022 at 01:43:03PM +0100, Robin Murphy wrote:

FWIW from my point of view I'm happy with having a .detach_dev_pasid op
meaning implicitly-blocked access for now.

If this is the path then lets not call it attach/detach
please. 'set_dev_pasid' and 'set_dev_blocking_pasid' are clearer
names.

Sure. And with the blocking domain implemented, the
set_dev_blocking_pasid could be deprecated.


On SMMUv3, PASIDs don't mix with our current notion of
IOMMU_DOMAIN_IDENTITY (nor the potential one for
IOMMU_DOMAIN_BLOCKED), so giving PASIDs functional symmetry with
devices would need significantly more work anyway.

There is no extra work in the driver, beyond SMMU having to implement
a blocking domain. The blocking domain's set_dev_pasid op simply is
whatever set_dev_blocking_pasid would have done on the unmanaged
domain.

identity doesn't come into this, identity domains should have a NULL
set_dev_pasid op if the driver can't support using it on a PASID.

IMHO blocking_domain->ops->set_dev_pasid() is just a more logical name
than domain->ops->set_dev_blocking_pasid() - especially since VFIO
would like drivers to implement blocking domain anyhow.

Perhaps implementing blocking domains for intel and smmuv3 iommu drivers
seem to be a more practical start.

Best regards,
baolu