msm: ipa3: Fix to memory allocation failure

During IPA shutdown the allocation for memory request fails.
Add changes in IPA to not sleep while memory allocation.

Change-Id: I0adb09e32970ff1d67c3249bb9d3c9dbdc970a8a
Signed-off-by: Praveen Kurapati <pkurapat@codeaurora.org>
This commit is contained in:
Praveen Kurapati 2019-10-25 00:09:33 +05:30
commit 59ed200680
2 changed files with 22 additions and 5 deletions

View file

@ -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;
}

View file

@ -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,
&params->nhash_bdy.phys_base, GFP_KERNEL);
&params->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,
&params->hash_bdy.phys_base, GFP_KERNEL);
&params->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;