| @@ -852,7 +852,6 @@ out_unmap: · 851 unmodified lines |
| 852 | return NULL; | 852 | return NULL; |
| 853 | } | 853 | } |
| 854 | | 854 | |
| 855 | #ifdef CONFIG_DMA_REMAP | | |
| 856 | static struct sg_table *iommu_dma_alloc_noncontiguous(struct device *dev, | 855 | static struct sg_table *iommu_dma_alloc_noncontiguous(struct device *dev, |
| 857 | size_t size, enum dma_data_direction dir, gfp_t gfp, | 856 | size_t size, enum dma_data_direction dir, gfp_t gfp, |
| 858 | unsigned long attrs) | 857 | unsigned long attrs) |
| @@ -882,7 +881,6 @@ static void iommu_dma_free_noncontiguous(struct device *dev, size_t size, · 23 unmodified lines |
| 882 | sg_free_table(&sh->sgt); | 881 | sg_free_table(&sh->sgt); |
| 883 | kfree(sh); | 882 | kfree(sh); |
| 884 | } | 883 | } |
| 885 | #endif /* CONFIG_DMA_REMAP */ | | |
| 886 | | 884 | |
| 887 | static void iommu_dma_sync_single_for_cpu(struct device *dev, | 885 | static void iommu_dma_sync_single_for_cpu(struct device *dev, |
| 888 | dma_addr_t dma_handle, size_t size, enum dma_data_direction dir) | 886 | dma_addr_t dma_handle, size_t size, enum dma_data_direction dir) |
| @@ -1276,7 +1274,7 @@ static void __iommu_dma_free(struct device *dev, size_t size, void *cpu_addr) · 387 unmodified lines |
| 1276 | dma_free_from_pool(dev, cpu_addr, alloc_size)) | 1274 | dma_free_from_pool(dev, cpu_addr, alloc_size)) |
| 1277 | return; | 1275 | return; |
| 1278 | | 1276 | |
| 1279 | if (IS_ENABLED(CONFIG_DMA_REMAP) && is_vmalloc_addr(cpu_addr)) { | 1277 | if (is_vmalloc_addr(cpu_addr)) { |
| 1280 | /* | 1278 | /* |
| 1281 | * If it the address is remapped, then it's either non-coherent | 1279 | * If it the address is remapped, then it's either non-coherent |
| 1282 | * or highmem CMA, or an iommu_dma_alloc_remap() construction. | 1280 | * or highmem CMA, or an iommu_dma_alloc_remap() construction. |
| @@ -1318,7 +1316,7 @@ static void *iommu_dma_alloc_pages(struct device *dev, size_t size, · 35 unmodified lines |
| 1318 | if (!page) | 1316 | if (!page) |
| 1319 | return NULL; | 1317 | return NULL; |
| 1320 | | 1318 | |
| 1321 | if (IS_ENABLED(CONFIG_DMA_REMAP) && (!coherent || PageHighMem(page))) { | 1319 | if (!coherent || PageHighMem(page)) { |
| 1322 | pgprot_t prot = dma_pgprot(dev, PAGE_KERNEL, attrs); | 1320 | pgprot_t prot = dma_pgprot(dev, PAGE_KERNEL, attrs); |
| 1323 | | 1321 | |
| 1324 | cpu_addr = dma_common_contiguous_remap(page, alloc_size, | 1322 | cpu_addr = dma_common_contiguous_remap(page, alloc_size, |
| @@ -1350,7 +1348,7 @@ static void *iommu_dma_alloc(struct device *dev, size_t size, · 25 unmodified lines |
| 1350 | | 1348 | |
| 1351 | gfp |= __GFP_ZERO; | 1349 | gfp |= __GFP_ZERO; |
| 1352 | | 1350 | |
| 1353 | if (IS_ENABLED(CONFIG_DMA_REMAP) && gfpflags_allow_blocking(gfp) && | 1351 | if (gfpflags_allow_blocking(gfp) && |
| 1354 | !(attrs & DMA_ATTR_FORCE_CONTIGUOUS)) { | 1352 | !(attrs & DMA_ATTR_FORCE_CONTIGUOUS)) { |
| 1355 | return iommu_dma_alloc_remap(dev, size, handle, gfp, | 1353 | return iommu_dma_alloc_remap(dev, size, handle, gfp, |
| 1356 | dma_pgprot(dev, PAGE_KERNEL, attrs), attrs); | 1354 | dma_pgprot(dev, PAGE_KERNEL, attrs), attrs); |
| @@ -1391,7 +1389,7 @@ static int iommu_dma_mmap(struct device *dev, struct vm_area_struct *vma, · 34 unmodified lines |
| 1391 | if (off >= nr_pages || vma_pages(vma) > nr_pages - off) | 1389 | if (off >= nr_pages || vma_pages(vma) > nr_pages - off) |
| 1392 | return -ENXIO; | 1390 | return -ENXIO; |
| 1393 | | 1391 | |
| 1394 | if (IS_ENABLED(CONFIG_DMA_REMAP) && is_vmalloc_addr(cpu_addr)) { | 1392 | if (is_vmalloc_addr(cpu_addr)) { |
| 1395 | struct page **pages = dma_common_find_pages(cpu_addr); | 1393 | struct page **pages = dma_common_find_pages(cpu_addr); |
| 1396 | | 1394 | |
| 1397 | if (pages) | 1395 | if (pages) |
| @@ -1413,7 +1411,7 @@ static int iommu_dma_get_sgtable(struct device *dev, struct sg_table *sgt, · 15 unmodified lines |
| 1413 | struct page *page; | 1411 | struct page *page; |
| 1414 | int ret; | 1412 | int ret; |
| 1415 | | 1413 | |
| 1416 | if (IS_ENABLED(CONFIG_DMA_REMAP) && is_vmalloc_addr(cpu_addr)) { | 1414 | if (is_vmalloc_addr(cpu_addr)) { |
| 1417 | struct page **pages = dma_common_find_pages(cpu_addr); | 1415 | struct page **pages = dma_common_find_pages(cpu_addr); |
| 1418 | | 1416 | |
| 1419 | if (pages) { | 1417 | if (pages) { |
| @@ -1445,10 +1443,8 @@ static const struct dma_map_ops iommu_dma_ops = { · 25 unmodified lines |
| 1445 | .free = iommu_dma_free, | 1443 | .free = iommu_dma_free, |
| 1446 | .alloc_pages = dma_common_alloc_pages, | 1444 | .alloc_pages = dma_common_alloc_pages, |
| 1447 | .free_pages = dma_common_free_pages, | 1445 | .free_pages = dma_common_free_pages, |
| 1448 | #ifdef CONFIG_DMA_REMAP | | |
| 1449 | .alloc_noncontiguous = iommu_dma_alloc_noncontiguous, | 1446 | .alloc_noncontiguous = iommu_dma_alloc_noncontiguous, |
| 1450 | .free_noncontiguous = iommu_dma_free_noncontiguous, | 1447 | .free_noncontiguous = iommu_dma_free_noncontiguous, |
| 1451 | #endif | | |
| 1452 | .mmap = iommu_dma_mmap, | 1448 | .mmap = iommu_dma_mmap, |
| 1453 | .get_sgtable = iommu_dma_get_sgtable, | 1449 | .get_sgtable = iommu_dma_get_sgtable, |
| 1454 | .map_page = iommu_dma_map_page, | 1450 | .map_page = iommu_dma_map_page, |