diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c b/drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c index 1834bdadf3bd..a8eb07080bc7 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c @@ -121,6 +121,7 @@ static int ipa3_generate_hdr_proc_ctx_hw_tbl(u64 hdr_sys_addr, struct ipa_mem_buffer *mem, struct ipa_mem_buffer *aligned_mem) { u64 hdr_base_addr; + gfp_t flag = GFP_KERNEL; mem->size = (ipa3_ctx->hdr_proc_ctx_tbl.end) ? : 4; @@ -129,9 +130,14 @@ static int ipa3_generate_hdr_proc_ctx_hw_tbl(u64 hdr_sys_addr, IPADBG_LOW("tbl_sz=%d\n", ipa3_ctx->hdr_proc_ctx_tbl.end); +alloc: mem->base = dma_alloc_coherent(ipa3_ctx->pdev, mem->size, - &mem->phys_base, GFP_KERNEL); + &mem->phys_base, flag); if (!mem->base) { + if (flag == GFP_KERNEL) { + flag = GFP_ATOMIC; + goto alloc; + } IPAERR("fail to alloc DMA buff of size %d\n", mem->size); return -ENOMEM; } diff --git a/drivers/platform/msm/ipa/ipa_v3/ipahal/ipahal_fltrt.c b/drivers/platform/msm/ipa/ipa_v3/ipahal/ipahal_fltrt.c index 6b4c50abcef6..e3c984d67e04 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipahal/ipahal_fltrt.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipahal/ipahal_fltrt.c @@ -4009,6 +4009,7 @@ static int ipa_fltrt_alloc_lcl_bdy( struct ipahal_fltrt_alloc_imgs_params *params) { struct ipahal_fltrt_obj *obj; + gfp_t flag = GFP_KERNEL; obj = &ipahal_fltrt_objs[ipahal_ctx->hw_type]; @@ -4041,10 +4042,15 @@ static int ipa_fltrt_alloc_lcl_bdy( IPAHAL_DBG_LOW("nhash lcl tbl bdy total h/w size = %u\n", params->nhash_bdy.size); - params->nhash_bdy.base = dma_alloc_coherent( +alloc1: + params->nhash_bdy.base = dma_zalloc_coherent( ipahal_ctx->ipa_pdev, params->nhash_bdy.size, - ¶ms->nhash_bdy.phys_base, GFP_KERNEL); + ¶ms->nhash_bdy.phys_base, flag); if (!params->nhash_bdy.base) { + if (flag == GFP_KERNEL) { + flag = GFP_ATOMIC; + goto alloc1; + } IPAHAL_ERR("fail to alloc DMA buff of size %d\n", params->nhash_bdy.size); return -ENOMEM; @@ -4071,10 +4077,15 @@ static int ipa_fltrt_alloc_lcl_bdy( IPAHAL_DBG_LOW("hash lcl tbl bdy total h/w size = %u\n", params->hash_bdy.size); - params->hash_bdy.base = dma_alloc_coherent( +alloc2: + params->hash_bdy.base = dma_zalloc_coherent( ipahal_ctx->ipa_pdev, params->hash_bdy.size, - ¶ms->hash_bdy.phys_base, GFP_KERNEL); + ¶ms->hash_bdy.phys_base, flag); if (!params->hash_bdy.base) { + if (flag == GFP_KERNEL) { + flag = GFP_ATOMIC; + goto alloc2; + } IPAHAL_ERR("fail to alloc DMA buff of size %d\n", params->hash_bdy.size); goto hash_bdy_fail;