From f3fcb9b56ef41dfe15c1ffbe6562d58a0c5525c2 Mon Sep 17 00:00:00 2001 From: Jia Ding Date: Tue, 18 Jul 2023 19:54:31 +0800 Subject: [PATCH] qcacmn: Initialize ipa_mapped to 1 in soc attach Two SMMU issues are seen on IPA domain with regard to RX. 1. map without unmap 2. Buffers not mapped into IPA. With If198a6c5f22af58fdaf9d9c020c74b1f76002e37, mapping RX buffers to IPA domain are deferred to IPA enable pipes phase with soc->ipa_mapped flag check added. This leads to a race window where RX packets are routed to WLAN Host first with soc->ipa_mapped still being 0. In such case, RX buffers handled by WLAN driver will neither unmap from IPA domain nor map into IPA domain. For !ipa_config_is_opt_wifi_dp_enabled(), fix is to set soc->ipa_mapped to 1 earlier in soc attach phase instead of IPA enable pipes phase. With this fix, RX buffers can be unmapped from IPA domain and mapped to IPA domain in dp_pdev_rx_buffers_attach() and dp_pdev_nbuf_alloc_and_map_replenish() in WLAN host RX path so as to avoid above two SMMU issues. Change-Id: Idcb86db99f522959b639865f77178cd47a234277 CRs-Fixed: 3560191 --- dp/wifi3.0/dp_ipa.c | 4 +--- dp/wifi3.0/dp_main.c | 3 +++ ipa/core/src/wlan_ipa_core.c | 2 -- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/dp/wifi3.0/dp_ipa.c b/dp/wifi3.0/dp_ipa.c index 57ccf1f80c..eda7467635 100644 --- a/dp/wifi3.0/dp_ipa.c +++ b/dp/wifi3.0/dp_ipa.c @@ -3466,11 +3466,9 @@ QDF_STATUS dp_ipa_enable_pipes(struct cdp_soc_t *soc_hdl, uint8_t pdev_id, qdf_atomic_set(&soc->ipa_pipes_enabled, 1); DP_IPA_EP_SET_TX_DB_PA(soc, ipa_res); - if (!ipa_config_is_opt_wifi_dp_enabled()) { + if (!ipa_config_is_opt_wifi_dp_enabled()) dp_ipa_handle_rx_buf_pool_smmu_mapping(soc, pdev, true, __func__, __LINE__); - qdf_atomic_set(&soc->ipa_mapped, 1); - } result = qdf_ipa_wdi_enable_pipes(hdl); if (result) { diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 96b5d0aa12..09cb19c148 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -12620,6 +12620,9 @@ dp_soc_attach(struct cdp_ctrl_objmgr_psoc *ctrl_psoc, dp_soc_set_def_pdev(soc); dp_soc_set_qref_debug_list(soc); + if (!ipa_config_is_opt_wifi_dp_enabled()) + qdf_atomic_set(&soc->ipa_mapped, 1); + dp_info("Mem stats: DMA = %u HEAP = %u SKB = %u", qdf_dma_mem_stats_read(), qdf_heap_mem_stats_read(), diff --git a/ipa/core/src/wlan_ipa_core.c b/ipa/core/src/wlan_ipa_core.c index 96727ecc93..6584356379 100644 --- a/ipa/core/src/wlan_ipa_core.c +++ b/ipa/core/src/wlan_ipa_core.c @@ -4353,8 +4353,6 @@ QDF_STATUS wlan_ipa_setup(struct wlan_ipa_priv *ipa_ctx, qdf_mutex_create(&ipa_ctx->ipa_lock); qdf_atomic_init(&ipa_ctx->deinit_in_prog); - cdp_ipa_set_smmu_mapped(ipa_ctx->dp_soc, 0); - status = wlan_ipa_wdi_setup_rm(ipa_ctx); if (status != QDF_STATUS_SUCCESS) goto fail_setup_rm;