msm: ipa: fix to clean up memory
In case of pipe setup failure, make sure to free up the DMA mappings along with freeing up memory. In case of tag process, make sure to free up the dummy memory allocated for ULSO WA. Change-Id: I70a2ef484c7e2a9ac871dfce95bf63c9f3dc9755 Signed-off-by: Chaitanya Pratapa <quic_cpratapa@quicinc.com>
此提交包含在:

提交者
Gerrit - the friendly Code Review server

父節點
64d1ea146e
當前提交
1c90691b31
@@ -1560,7 +1560,8 @@ static ssize_t ipa3_read_stats(struct file *file, char __user *ubuf,
|
||||
"num_buff_above_thresh_for_def_pipe_notified=%u\n"
|
||||
"num_buff_below_thresh_for_def_pipe_notified=%u\n"
|
||||
"num_buff_above_thresh_for_coal_pipe_notified=%u\n"
|
||||
"num_buff_below_thresh_for_coal_pipe_notified=%u\n",
|
||||
"num_buff_below_thresh_for_coal_pipe_notified=%u\n"
|
||||
"pipe_setup_fail_cnt=%u\n",
|
||||
ipa3_ctx->stats.tx_sw_pkts,
|
||||
ipa3_ctx->stats.tx_hw_pkts,
|
||||
ipa3_ctx->stats.tx_non_linear,
|
||||
@@ -1586,7 +1587,9 @@ static ssize_t ipa3_read_stats(struct file *file, char __user *ubuf,
|
||||
atomic_read(&ipa3_ctx->stats.num_buff_above_thresh_for_def_pipe_notified),
|
||||
atomic_read(&ipa3_ctx->stats.num_buff_below_thresh_for_def_pipe_notified),
|
||||
atomic_read(&ipa3_ctx->stats.num_buff_above_thresh_for_coal_pipe_notified),
|
||||
atomic_read(&ipa3_ctx->stats.num_buff_below_thresh_for_coal_pipe_notified));
|
||||
atomic_read(&ipa3_ctx->stats.num_buff_below_thresh_for_coal_pipe_notified),
|
||||
ipa3_ctx->stats.pipe_setup_fail_cnt
|
||||
);
|
||||
cnt += nbytes;
|
||||
|
||||
for (i = 0; i < IPAHAL_PKT_STATUS_EXCEPTION_MAX; i++) {
|
||||
|
@@ -1589,6 +1589,9 @@ int ipa3_setup_sys_pipe(struct ipa_sys_connect_params *sys_in, u32 *clnt_hdl)
|
||||
fail_gen3:
|
||||
ipa3_disable_data_path(ipa_ep_idx);
|
||||
fail_repl:
|
||||
if (IPA_CLIENT_IS_CONS(ep->client) && !ep->sys->common_buff_pool)
|
||||
ipa3_cleanup_rx(ep->sys);
|
||||
|
||||
ep->sys->repl_hdlr = ipa3_replenish_rx_cache;
|
||||
if (ep->sys->repl && !ep->sys->common_buff_pool) {
|
||||
kfree(ep->sys->repl);
|
||||
@@ -1620,6 +1623,7 @@ fail_wq:
|
||||
fail_and_disable_clocks:
|
||||
IPA_ACTIVE_CLIENTS_DEC_EP(sys_in->client);
|
||||
fail_gen:
|
||||
IPA_STATS_INC_CNT(ipa3_ctx->stats.pipe_setup_fail_cnt);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@@ -1550,6 +1550,7 @@ struct ipa3_stats {
|
||||
u32 tx_non_linear;
|
||||
u32 rx_page_drop_cnt;
|
||||
u64 lower_order;
|
||||
u32 pipe_setup_fail_cnt;
|
||||
struct ipa3_page_recycle_stats page_recycle_stats[3];
|
||||
u64 page_recycle_cnt[3][IPA_PAGE_POLL_THRESHOLD_MAX];
|
||||
atomic_t num_buff_above_thresh_for_def_pipe_notified;
|
||||
|
@@ -9821,6 +9821,10 @@ retry_alloc:
|
||||
WARN_ON(1);
|
||||
if (atomic_dec_return(&comp->cnt) == 0)
|
||||
kfree(comp);
|
||||
if (cmd.base) {
|
||||
dma_free_coherent(ipa3_ctx->pdev, cmd.size,
|
||||
cmd.base, cmd.phys_base);
|
||||
}
|
||||
return -ETIME;
|
||||
}
|
||||
|
||||
@@ -9828,6 +9832,11 @@ retry_alloc:
|
||||
if (atomic_dec_return(&comp->cnt) == 0)
|
||||
kfree(comp);
|
||||
|
||||
if (cmd.base) {
|
||||
dma_free_coherent(ipa3_ctx->pdev, cmd.size,
|
||||
cmd.base, cmd.phys_base);
|
||||
}
|
||||
|
||||
/*
|
||||
* sleep for short period to ensure IPA wrote all packets to
|
||||
* the transport
|
||||
@@ -9855,7 +9864,7 @@ fail_free_desc:
|
||||
tag_desc[i].callback(tag_desc[i].user1,
|
||||
tag_desc[i].user2);
|
||||
if (cmd.base) {
|
||||
dma_free_coherent(ipa3_ctx->uc_pdev, cmd.size,
|
||||
dma_free_coherent(ipa3_ctx->pdev, cmd.size,
|
||||
cmd.base, cmd.phys_base);
|
||||
}
|
||||
fail_free_tag_desc:
|
||||
|
新增問題並參考
封鎖使用者