dma: removed: Merge dma removed changes from 4.14 to msm-kona

This patch is to merge dma removed changes from msm-4.14 to
msm-kona. This includes changes available as a part of the
following commit ids in 4.14:

a.372f0b5a96de76bdae4f716cec1e0bbf7a461b2f
("drivers: dma-removed: fix data type to hold base address")

b.9e8dd5f0495dddb7ca45d6a8a69395ccff17e2bf
("drivers: dma-removed: align size first")

c.2a4c716787addb5cd7a2b979342df79ebed75f73
("drivers: dma-removed: use memset_io for ioremap region")

Conflicts:
	kernel/dma/removed.c

Change-Id: Id0b2a9409e4f7ce86367595cff35810b48bfb4fb
Signed-off-by: Swathi Sridhar <swatsrid@codeaurora.org>
This commit is contained in:
Swathi Sridhar
2018-07-23 14:13:57 -07:00
parent a478a8bf78
commit 8510985ae3

View File

@@ -22,7 +22,7 @@
#include <linux/spinlock.h>
struct removed_region {
dma_addr_t base;
phys_addr_t base;
int nr_pages;
unsigned long *bitmap;
struct mutex lock;
@@ -74,17 +74,19 @@ void *removed_alloc(struct device *dev, size_t size, dma_addr_t *handle,
bool no_kernel_mapping = attrs & DMA_ATTR_NO_KERNEL_MAPPING;
bool skip_zeroing = attrs & DMA_ATTR_SKIP_ZEROING;
int pageno;
unsigned long order = get_order(size);
unsigned long order;
void *addr = NULL;
struct removed_region *dma_mem = dev->removed_mem;
int nbits = size >> PAGE_SHIFT;
int nbits;
unsigned int align;
size = PAGE_ALIGN(size);
if (!gfpflags_allow_blocking(gfp))
return NULL;
size = PAGE_ALIGN(size);
nbits = size >> PAGE_SHIFT;
order = get_order(size);
if (order > get_order(SZ_1M))
order = get_order(SZ_1M);
@@ -111,7 +113,7 @@ void *removed_alloc(struct device *dev, size_t size, dma_addr_t *handle,
bitmap_clear(dma_mem->bitmap, pageno, nbits);
} else {
if (!skip_zeroing)
memset(addr, 0, size);
memset_io(addr, 0, size);
if (no_kernel_mapping) {
iounmap(addr);
addr = (void *)NO_KERNEL_MAPPING_DUMMY;
@@ -139,6 +141,7 @@ void removed_free(struct device *dev, size_t size, void *cpu_addr,
bool no_kernel_mapping = attrs & DMA_ATTR_NO_KERNEL_MAPPING;
struct removed_region *dma_mem = dev->removed_mem;
size = PAGE_ALIGN(size);
if (!no_kernel_mapping)
iounmap(cpu_addr);
mutex_lock(&dma_mem->lock);