On Thu, Jul 25, 2019 at 03:18:03PM +0800, Lu Baolu wrote: >> 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? >> > > This checking happens only when device is using an identity mapped > domain. If the device has a small DMA mask, swiotlb will be used for > high memory access. > > This is supposed to be handled in dma_direct_map_page(): > > if (unlikely(!dma_direct_possible(dev, dma_addr, size)) && > !swiotlb_map(dev, &phys, &dma_addr, size, dir, attrs)) { > report_addr(dev, dma_addr, size); > return DMA_MAPPING_ERROR; > }
Well, yes. But the point is that the current code uses dynamic iommu mappings even if the devices is in the identity mapped domain when the dma mask іs too small to map all memory directly. Your change means it will now use swiotlb which is most likely going to be a lot more expensive. I don't think that this change is a good idea, and even if we decide that this is a good idea after all that should be done in a separate prep patch that explains the rationale. > Best regards, > Baolu ---end quoted text---