diff options
author | Christoph Hellwig <hch@lst.de> | 2019-06-03 08:55:13 +0200 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2019-09-04 11:13:19 +0200 |
commit | fe9041c245196c6c61091ccc2c74b73ab9a5fc50 (patch) | |
tree | 0af220ef01c93e8f1fc70e2681acdb7b204445df /arch | |
parent | 249baa54790171438524ba97e8e0485dd6aa2762 (diff) |
vmalloc: lift the arm flag for coherent mappings to common code
The arm architecture had a VM_ARM_DMA_CONSISTENT flag to mark DMA
coherent remapping for a while. Lift this flag to common code so
that we can use it generically. We also check it in the only place
VM_USERMAP is directly check so that we can entirely replace that
flag as well (although I'm not even sure why we'd want to allow
remapping DMA appings, but I'd rather not change behavior).
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mm/dma-mapping.c | 22 | ||||
-rw-r--r-- | arch/arm/mm/mm.h | 3 |
2 files changed, 7 insertions, 18 deletions
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index eb903beef2ff..aec31f9b918b 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -343,19 +343,13 @@ static void * __dma_alloc_remap(struct page *page, size_t size, gfp_t gfp, pgprot_t prot, const void *caller) { - /* - * DMA allocation can be mapped to user space, so lets - * set VM_USERMAP flags too. - */ - return dma_common_contiguous_remap(page, size, - VM_ARM_DMA_CONSISTENT | VM_USERMAP, + return dma_common_contiguous_remap(page, size, VM_DMA_COHERENT, prot, caller); } static void __dma_free_remap(void *cpu_addr, size_t size) { - dma_common_free_remap(cpu_addr, size, - VM_ARM_DMA_CONSISTENT | VM_USERMAP); + dma_common_free_remap(cpu_addr, size, VM_DMA_COHERENT); } #define DEFAULT_DMA_COHERENT_POOL_SIZE SZ_256K @@ -1371,8 +1365,8 @@ static void * __iommu_alloc_remap(struct page **pages, size_t size, gfp_t gfp, pgprot_t prot, const void *caller) { - return dma_common_pages_remap(pages, size, - VM_ARM_DMA_CONSISTENT | VM_USERMAP, prot, caller); + return dma_common_pages_remap(pages, size, VM_DMA_COHERENT, prot, + caller); } /* @@ -1456,7 +1450,7 @@ static struct page **__iommu_get_pages(void *cpu_addr, unsigned long attrs) return cpu_addr; area = find_vm_area(cpu_addr); - if (area && (area->flags & VM_ARM_DMA_CONSISTENT)) + if (area && (area->flags & VM_DMA_COHERENT)) return area->pages; return NULL; } @@ -1614,10 +1608,8 @@ void __arm_iommu_free_attrs(struct device *dev, size_t size, void *cpu_addr, return; } - if ((attrs & DMA_ATTR_NO_KERNEL_MAPPING) == 0) { - dma_common_free_remap(cpu_addr, size, - VM_ARM_DMA_CONSISTENT | VM_USERMAP); - } + if ((attrs & DMA_ATTR_NO_KERNEL_MAPPING) == 0) + dma_common_free_remap(cpu_addr, size, VM_DMA_COHERENT); __iommu_remove_mapping(dev, handle, size); __iommu_free_buffer(dev, pages, size, attrs); diff --git a/arch/arm/mm/mm.h b/arch/arm/mm/mm.h index 941356d95a67..88c121ac14b3 100644 --- a/arch/arm/mm/mm.h +++ b/arch/arm/mm/mm.h @@ -70,9 +70,6 @@ extern void __flush_dcache_page(struct address_space *mapping, struct page *page #define VM_ARM_MTYPE(mt) ((mt) << 20) #define VM_ARM_MTYPE_MASK (0x1f << 20) -/* consistent regions used by dma_alloc_attrs() */ -#define VM_ARM_DMA_CONSISTENT 0x20000000 - struct static_vm { struct vm_struct vm; |