projects
/
firefly-linux-kernel-4.4.55.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge tag 'pinctrl-v4.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[firefly-linux-kernel-4.4.55.git]
/
arch
/
arm
/
mm
/
dma-mapping.c
diff --git
a/arch/arm/mm/dma-mapping.c
b/arch/arm/mm/dma-mapping.c
index cba12f34ff774ca08216c5d2b6061b07b68b1a99..bf35abcc7d598c6cf7c44e5e2e13fd044893cff0 100644
(file)
--- a/
arch/arm/mm/dma-mapping.c
+++ b/
arch/arm/mm/dma-mapping.c
@@
-39,6
+39,7
@@
#include <asm/system_info.h>
#include <asm/dma-contiguous.h>
#include <asm/system_info.h>
#include <asm/dma-contiguous.h>
+#include "dma.h"
#include "mm.h"
/*
#include "mm.h"
/*
@@
-648,14
+649,18
@@
static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
size = PAGE_ALIGN(size);
want_vaddr = !dma_get_attr(DMA_ATTR_NO_KERNEL_MAPPING, attrs);
size = PAGE_ALIGN(size);
want_vaddr = !dma_get_attr(DMA_ATTR_NO_KERNEL_MAPPING, attrs);
- if (is_coherent || nommu())
+ if (nommu())
+ addr = __alloc_simple_buffer(dev, size, gfp, &page);
+ else if (dev_get_cma_area(dev) && (gfp & __GFP_WAIT))
+ addr = __alloc_from_contiguous(dev, size, prot, &page,
+ caller, want_vaddr);
+ else if (is_coherent)
addr = __alloc_simple_buffer(dev, size, gfp, &page);
else if (!(gfp & __GFP_WAIT))
addr = __alloc_from_pool(size, &page);
addr = __alloc_simple_buffer(dev, size, gfp, &page);
else if (!(gfp & __GFP_WAIT))
addr = __alloc_from_pool(size, &page);
- else if (!dev_get_cma_area(dev))
- addr = __alloc_remap_buffer(dev, size, gfp, prot, &page, caller, want_vaddr);
else
else
- addr = __alloc_from_contiguous(dev, size, prot, &page, caller, want_vaddr);
+ addr = __alloc_remap_buffer(dev, size, gfp, prot, &page,
+ caller, want_vaddr);
if (page)
*handle = pfn_to_dma(dev, page_to_pfn(page));
if (page)
*handle = pfn_to_dma(dev, page_to_pfn(page));
@@
-683,13
+688,12
@@
void *arm_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
static void *arm_coherent_dma_alloc(struct device *dev, size_t size,
dma_addr_t *handle, gfp_t gfp, struct dma_attrs *attrs)
{
static void *arm_coherent_dma_alloc(struct device *dev, size_t size,
dma_addr_t *handle, gfp_t gfp, struct dma_attrs *attrs)
{
- pgprot_t prot = __get_dma_pgprot(attrs, PAGE_KERNEL);
void *memory;
if (dma_alloc_from_coherent(dev, size, handle, &memory))
return memory;
void *memory;
if (dma_alloc_from_coherent(dev, size, handle, &memory))
return memory;
- return __dma_alloc(dev, size, handle, gfp,
prot
, true,
+ return __dma_alloc(dev, size, handle, gfp,
PAGE_KERNEL
, true,
attrs, __builtin_return_address(0));
}
attrs, __builtin_return_address(0));
}
@@
-753,12
+757,12
@@
static void __arm_dma_free(struct device *dev, size_t size, void *cpu_addr,
size = PAGE_ALIGN(size);
size = PAGE_ALIGN(size);
- if (
is_coherent ||
nommu()) {
+ if (nommu()) {
__dma_free_buffer(page, size);
__dma_free_buffer(page, size);
- } else if (__free_from_pool(cpu_addr, size)) {
+ } else if (
!is_coherent &&
__free_from_pool(cpu_addr, size)) {
return;
} else if (!dev_get_cma_area(dev)) {
return;
} else if (!dev_get_cma_area(dev)) {
- if (want_vaddr)
+ if (want_vaddr
&& !is_coherent
)
__dma_free_remap(cpu_addr, size);
__dma_free_buffer(page, size);
} else {
__dma_free_remap(cpu_addr, size);
__dma_free_buffer(page, size);
} else {
@@
-1520,7
+1524,7
@@
static int __map_sg_chunk(struct device *dev, struct scatterlist *sg,
return -ENOMEM;
for (count = 0, s = sg; count < (size >> PAGE_SHIFT); s = sg_next(s)) {
return -ENOMEM;
for (count = 0, s = sg; count < (size >> PAGE_SHIFT); s = sg_next(s)) {
- phys_addr_t phys =
page_to_phys(sg_page(s))
;
+ phys_addr_t phys =
sg_phys(s) & PAGE_MASK
;
unsigned int len = PAGE_ALIGN(s->offset + s->length);
if (!is_coherent &&
unsigned int len = PAGE_ALIGN(s->offset + s->length);
if (!is_coherent &&