ANDROID: GKI: common: dma-mapping: make dma_common_contiguous_remap more robust

Large allocations can result in the dma_common_contiguous_remap
call not being able to succeed because it can't find enough
contiguous memory to setup the mapping.
Make dma_common_contiguous_remap more robust by using vmalloc
as a fallback.

Change-Id: I12ca710b4c24f4ef24bc33a0d1d4922196fb7492
Signed-off-by: Liam Mark <lmark@codeaurora.org>
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
(cherry picked from commit b4c505ac103c032e8ff567c085f0bced4a9bf43c)
Bug: 155522481
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
[saravanak rolled in int to unsigned long conversion from another patch]
Signed-off-by: Saravana Kannan <saravanak@google.com>
This commit is contained in:
Liam Mark 2015-08-11 08:41:59 -07:00 committed by Saravana Kannan
parent a3c0807605
commit dfc0e46bcf

View File

@ -291,11 +291,12 @@ void *dma_common_contiguous_remap(struct page *page, size_t size,
unsigned long vm_flags,
pgprot_t prot, const void *caller)
{
int i;
unsigned long i;
struct page **pages;
struct vm_struct *area;
pages = kmalloc(sizeof(struct page *) << get_order(size), GFP_KERNEL);
pages = kvmalloc(sizeof(struct page *) << get_order(size), GFP_KERNEL);
if (!pages)
return NULL;
@ -304,7 +305,7 @@ void *dma_common_contiguous_remap(struct page *page, size_t size,
area = __dma_common_pages_remap(pages, size, vm_flags, prot, caller);
kfree(pages);
kvfree(pages);
if (!area)
return NULL;