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

From: Jason Gunthorpe
Date: Tue Sep 28 2021 - 07:57:57 EST


On Tue, Sep 28, 2021 at 07:30:41AM +0000, Tian, Kevin wrote:

> > Also, don't call it "hint", there is nothing hinty about this, it has
> > definitive functional impacts.
>
> possibly dma_mode (too broad?) or dma_usage

You just need a flag to specify if the driver manages DMA ownership
itself, or if it requires the driver core to setup kernel ownership

DMA_OWNER_KERNEL
DMA_OWNER_DRIVER_CONTROLLED

?

There is a bool 'suprress_bind_attrs' already so it could be done like
this:

bool suppress_bind_attrs:1;

/* If set the driver must call iommu_XX as the first action in probe() */
bool suppress_dma_owner:1;

Which is pretty low cost.

Jason