Comments
Patch
@@ -2582,7 +2582,7 @@ static dma_addr_t __intel_map_single(struct device *hwdev, phys_addr_t paddr,
BUG_ON(dir == DMA_NONE);
if (iommu_no_mapping(hwdev))
- return paddr;
+ return paddr + size > dma_mask ? 0 : paddr;
domain = get_valid_domain_for_dev(pdev);
if (!domain)
@@ -2767,7 +2767,11 @@ static void *intel_alloc_coherent(struct device *hwdev, size_t size,
size = PAGE_ALIGN(size);
order = get_order(size);
- flags &= ~(GFP_DMA | GFP_DMA32);
+
+ if (!iommu_no_mapping(hwdev))
+ flags &= ~(GFP_DMA | GFP_DMA32);
+ else if (hwdev->coherent_dma_mask != DMA_BIT_MASK(64))
+ flags |= GFP_DMA;
vaddr = (void *)__get_free_pages(flags, order);
if (!vaddr)
intel_alloc_coherent() needs to follow DMA mapping convention and make use of the coherent_dma_mask of the device for identity mappings. Without this, devices may get buffers they can't use. Signed-off-by: Alex Williamson <alex.williamson@hp.com> --- v2: Abandon attempt to create a common dma_generic_alloc_coherent, patch 1/5 is now defunct. Patches 3-5 are unchanged. drivers/pci/intel-iommu.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html