Re: [PATCH v5 02/10] iommu/vt-d: Use per-device dma_ops

From: Christoph Hellwig
Date: Wed Nov 20 2019 - 05:44:43 EST


On Fri, Nov 15, 2019 at 08:57:32AM +0800, Lu Baolu wrote:
> Hi,
>
> On 11/14/19 4:14 PM, Christoph Hellwig wrote:
>> On Thu, Nov 14, 2019 at 01:14:11PM +0800, Lu Baolu wrote:
>>> Could you please educate me what dma_supported() is exactly for? Will
>>> it always get called during boot? When will it be called?
>>
>> ->dma_supported is set when setting either the dma_mask or
>> dma_coherent_mask. These days it serves too primary purposes: reject
>> too small masks that can't be addressed, and provide any hooks needed
>> in the driver based on the mask.
>
> Thanks! So ->dma_supported might not be called before driver maps buffer
> and start DMA. Right?

It is supposed to, yes.