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

From: Christoph Hellwig
Date: Thu Jul 25 2019 - 11:02:34 EST


> /* Check if the dev needs to go through non-identity map and unmap process.*/
> static bool iommu_need_mapping(struct device *dev)
> {
> - int ret;
> -
> if (iommu_dummy(dev))
> return false;
>
> - ret = identity_mapping(dev);
> - if (ret) {
> - u64 dma_mask = *dev->dma_mask;
> -
> - if (dev->coherent_dma_mask && dev->coherent_dma_mask < dma_mask)
> - dma_mask = dev->coherent_dma_mask;
> -
> - if (dma_mask >= dma_get_required_mask(dev))
> - return false;

Don't we need to keep this bit so that we still allow the IOMMU
to act if the device has a too small DMA mask to address all memory in
the system, even if if it should otherwise be identity mapped?