From e548f7098581581ee381e8627e3ef24bf7735af9 Mon Sep 17 00:00:00 2001 From: Palak Joshi Date: Mon, 9 Jun 2025 15:47:55 +0530 Subject: [PATCH] msm: eva: CMA Allocation retry for DSP Added CMA allocation retry for 10times with 100ms delay for dsp region. Change-Id: Ib2f74d5fa9820b8fb2fac1788d062377209c70b5 Signed-off-by: Palak Joshi --- msm/eva/cvp_hfi.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/msm/eva/cvp_hfi.c b/msm/eva/cvp_hfi.c index 8ebd19167c..5bbabe8f81 100644 --- a/msm/eva/cvp_hfi.c +++ b/msm/eva/cvp_hfi.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved. - * Copyright (c) 2023-2025, Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. */ #include @@ -1755,6 +1755,8 @@ static int __interface_dsp_queues_init(struct iris_hfi_device *dev) dma_addr_t dma_handle; dma_addr_t iova; struct context_bank_info *cb; + int count = 0; + const int max_retries = 10; q_size = ALIGN(QUEUE_SIZE, SZ_1M); mem_data = &dev->dsp_iface_q_table.mem_data; @@ -1764,9 +1766,21 @@ static int __interface_dsp_queues_init(struct iris_hfi_device *dev) cvp_dsp_init_hfi_queue_hdr(dev); return 0; } - /* Allocate dsp queues from CDSP device memory */ - kvaddr = dma_alloc_coherent(dev->res->mem_cdsp.dev, q_size, + + while (count < max_retries) { + /* Allocate dsp queues from CDSP device memory */ + kvaddr = dma_alloc_coherent(dev->res->mem_cdsp.dev, q_size, &dma_handle, GFP_KERNEL); + if (IS_ERR_OR_NULL(kvaddr)) { + dprintk(CVP_ERR, "%s: failed dma allocation, retry %d\n", + __func__, count); + usleep_range(100000, 105000); + count++; + } else { + dprintk(CVP_INFO, "%s: DMA Allocation success\n", __func__); + break; + } + } if (IS_ERR_OR_NULL(kvaddr)) { dprintk(CVP_ERR, "%s: failed dma allocation\n", __func__); goto fail_dma_alloc;