diff --git a/core/hdd/inc/wlan_hdd_ipa.h b/core/hdd/inc/wlan_hdd_ipa.h index a18cc72bb7ef..c07b77fe9bf0 100644 --- a/core/hdd/inc/wlan_hdd_ipa.h +++ b/core/hdd/inc/wlan_hdd_ipa.h @@ -116,6 +116,7 @@ struct sk_buff *hdd_ipa_tx_packet_ipa(hdd_context_t *hdd_ctx, struct sk_buff *skb, uint8_t session_id); bool hdd_ipa_is_present(hdd_context_t *hdd_ctx); void hdd_ipa_dump_info(hdd_context_t *hdd_ctx); +QDF_STATUS hdd_ipa_uc_ol_init(hdd_context_t *hdd_ctx); #else static inline QDF_STATUS hdd_ipa_init(hdd_context_t *hdd_ctx) { @@ -244,5 +245,16 @@ static inline bool hdd_ipa_is_present(hdd_context_t *hdd_ctx) { return false; } + +/** + * hdd_ipa_uc_ol_init() - Initialize IPA uC offload + * @hdd_ctx: Global HDD context + * + * Return: QDF_STATUS + */ +QDF_STATUS hdd_ipa_uc_ol_init(hdd_context_t *hdd_ctx) +{ + return QDF_STATUS_SUCCESS; +} #endif /* IPA_OFFLOAD */ #endif /* #ifndef HDD_IPA_H__ */ diff --git a/core/hdd/src/wlan_hdd_ipa.c b/core/hdd/src/wlan_hdd_ipa.c index ffde0d669afe..2557ad540252 100644 --- a/core/hdd/src/wlan_hdd_ipa.c +++ b/core/hdd/src/wlan_hdd_ipa.c @@ -2318,7 +2318,7 @@ static void hdd_ipa_init_uc_op_work(struct work_struct *work, * * Return: QDF_STATUS */ -static QDF_STATUS hdd_ipa_uc_ol_init(hdd_context_t *hdd_ctx) +QDF_STATUS hdd_ipa_uc_ol_init(hdd_context_t *hdd_ctx) { struct ipa_wdi_in_params pipe_in; struct ipa_wdi_out_params pipe_out; @@ -2326,7 +2326,23 @@ static QDF_STATUS hdd_ipa_uc_ol_init(hdd_context_t *hdd_ctx) p_cds_contextType cds_ctx = hdd_ctx->pcds_context; uint8_t i; void *soc = cds_get_context(QDF_MODULE_ID_SOC); + void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); + ENTER(); + + if (!pdev || !soc) { + HDD_IPA_LOG(QDF_TRACE_LEVEL_FATAL, "DP context is NULL"); + return QDF_STATUS_E_FAILURE; + } + cdp_ipa_get_resource(soc, pdev, &ipa_ctxt->ipa_resource); + if ((ipa_ctxt->ipa_resource.ce_sr_base_paddr == 0) || + (ipa_ctxt->ipa_resource.tx_comp_ring_base_paddr == 0) || + (ipa_ctxt->ipa_resource.rx_rdy_ring_base_paddr == 0) || + (ipa_ctxt->ipa_resource.rx2_rdy_ring_base_paddr == 0)) { + HDD_IPA_LOG(QDF_TRACE_LEVEL_FATAL, + "IPA UC resource alloc fail"); + return QDF_STATUS_E_FAILURE; + } qdf_mem_zero(&ipa_ctxt->cons_pipe_in, sizeof(struct ipa_wdi_in_params)); qdf_mem_zero(&ipa_ctxt->prod_pipe_in, sizeof(struct ipa_wdi_in_params)); qdf_mem_zero(&pipe_in, sizeof(struct ipa_wdi_in_params)); @@ -2783,29 +2799,10 @@ static int __hdd_ipa_uc_ssr_reinit(hdd_context_t *hdd_ctx) struct hdd_ipa_priv *hdd_ipa = ghdd_ipa; int i; struct hdd_ipa_iface_context *iface_context = NULL; - struct ol_txrx_pdev_t *pdev = NULL; if (!hdd_ipa || !hdd_ipa_uc_is_enabled(hdd_ctx)) return 0; - pdev = cds_get_context(QDF_MODULE_ID_TXRX); - if (!pdev) { - HDD_IPA_LOG(QDF_TRACE_LEVEL_FATAL, "pdev is NULL"); - return -EINVAL; - } - - cdp_ipa_get_resource(cds_get_context(QDF_MODULE_ID_SOC), - cds_get_context(QDF_MODULE_ID_TXRX), - &hdd_ipa->ipa_resource); - if ((hdd_ipa->ipa_resource.ce_sr_base_paddr == 0) || - (hdd_ipa->ipa_resource.tx_comp_ring_base_paddr == 0) || - (hdd_ipa->ipa_resource.rx_rdy_ring_base_paddr == 0) || - (hdd_ipa->ipa_resource.rx2_rdy_ring_base_paddr == 0)) { - HDD_IPA_LOG(QDF_TRACE_LEVEL_FATAL, - "IPA UC resource alloc fail"); - return -EINVAL; - } - /* Create the interface context */ for (i = 0; i < HDD_IPA_MAX_IFACE; i++) { iface_context = &hdd_ipa->iface_context[i]; @@ -2828,13 +2825,6 @@ static int __hdd_ipa_uc_ssr_reinit(hdd_context_t *hdd_ctx) hdd_ipa->sta_connected = 0; hdd_ipa->ipa_pipes_down = true; hdd_ipa->uc_loaded = true; - - if (hdd_ipa_uc_ol_init(hdd_ctx)) { - HDD_IPA_LOG(QDF_TRACE_LEVEL_FATAL, - "Failed to setup pipes"); - return -EINVAL; - } - } return 0; @@ -5344,17 +5334,6 @@ static QDF_STATUS __hdd_ipa_init(hdd_context_t *hdd_ctx) ghdd_ipa = hdd_ipa; hdd_ipa->hdd_ctx = hdd_ctx; hdd_ipa->num_iface = 0; - cdp_ipa_get_resource(cds_get_context(QDF_MODULE_ID_SOC), - (struct cdp_pdev *)cds_get_context(QDF_MODULE_ID_TXRX), - &hdd_ipa->ipa_resource); - if ((0 == hdd_ipa->ipa_resource.ce_sr_base_paddr) || - (0 == hdd_ipa->ipa_resource.tx_comp_ring_base_paddr) || - (0 == hdd_ipa->ipa_resource.rx_rdy_ring_base_paddr) || - (0 == hdd_ipa->ipa_resource.rx2_rdy_ring_base_paddr)) { - HDD_IPA_LOG(QDF_TRACE_LEVEL_FATAL, - "IPA UC resource alloc fail"); - goto fail_get_resource; - } /* Create the interface context */ for (i = 0; i < HDD_IPA_MAX_IFACE; i++) { @@ -5402,7 +5381,6 @@ static QDF_STATUS __hdd_ipa_init(hdd_context_t *hdd_ctx) if (hdd_ipa_uc_register_uc_ready(hdd_ipa)) goto fail_create_sys_pipe; - hdd_ipa_uc_ol_init(hdd_ctx); } else { ret = hdd_ipa_setup_sys_pipe(hdd_ipa); if (ret) @@ -5415,7 +5393,6 @@ fail_create_sys_pipe: hdd_ipa_destroy_rm_resource(hdd_ipa); fail_setup_rm: qdf_spinlock_destroy(&hdd_ipa->pm_lock); -fail_get_resource: qdf_mem_free(hdd_ipa); hdd_ctx->hdd_ipa = NULL; ghdd_ipa = NULL; diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index dc056ea3954c..63721ea80a90 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -1867,8 +1867,10 @@ int hdd_wlan_start_modules(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter, } if (reinit) { - if (hdd_ipa_uc_ssr_reinit(hdd_ctx)) - hdd_err("HDD IPA UC reinit failed"); + if (hdd_ipa_uc_ssr_reinit(hdd_ctx)) { + hdd_err("HDD IPA UC reinit failed"); + goto close; + } } /* Fall through dont add break here */ @@ -8118,6 +8120,17 @@ int hdd_configure_cds(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter) goto out; } + /* Always get latest IPA resources allocated from cds_open and configure + * IPA module before configuring them to FW. Sequence required as crash + * observed otherwise. + */ + if (hdd_ipa_uc_is_enabled(hdd_ctx)) { + if (hdd_ipa_uc_ol_init(hdd_ctx)) { + hdd_err("Failed to setup pipes"); + goto out; + } + } + /* * Start CDS which starts up the SME/MAC/HAL modules and everything * else