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

Lu Baolu
2021-09-27T11:34:23Z

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?

Best regards,
baolu