RE: [RFC 06/20] iommu: Add iommu_device_init[exit]_user_dma interfaces

From: Tian, Kevin
Date: Mon Sep 27 2021 - 09:08:42 EST


> From: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>
> Sent: Monday, September 27, 2021 7:34 PM
>
> On 2021/9/27 17:42, Tian, Kevin wrote:
> > +int iommu_device_set_dma_hint(struct device *dev, enum dma_hint hint)
> > +{
> > + struct iommu_group *group;
> > + int ret;
> > +
> > + group = iommu_group_get(dev);
> > + /* not an iommu-probed device */
> > + if (!group)
> > + return 0;
> > +
> > + mutex_lock(&group->mutex);
> > + ret = __iommu_group_viable(group, hint);
> > + mutex_unlock(&group->mutex);
> > +
> > + iommu_group_put(group);
> > + return ret;
> > +}
>
> Conceptually, we could also move iommu_deferred_attach() from
> iommu_dma_ops here to save unnecessary checks in the hot DMA API
> paths?
>

Yes, it's possible. But just be curious, why doesn't iommu core
manage deferred_attach when receiving BOUND_DRIVER event?
Is there other implication that deferred attach cannot be done
at driver binding time?

Thanks
Kevin