From d60dfebd0b88bd7b20819cd4603791cd6dc98b3c Mon Sep 17 00:00:00 2001 From: Manikanta Pubbisetty Date: Mon, 19 Apr 2021 06:53:39 +0530 Subject: [PATCH] qcacld-3.0: enabled EXT GRP IRQs after power save exit Currently in the WoW design of Moselle, EXT GRP IRQs are enabled before sending SMP2P power save exit message is sent to the FW. Because of this, any pending IRQs in the GIC will immediately fire and could race with the SMP2P power save exit logic. Any access to the registers done before power save exit would result in system errors. Enable the EXT GRP IRQs after sending power save exit command will fix the problem. Change-Id: I16f580279b5aa24861ab5111b9c13db3e38063f4 CRs-Fixed: 2925554 --- components/pmo/core/src/wlan_pmo_suspend_resume.c | 14 +++++++++----- .../dispatcher/inc/wlan_pmo_wow_public_struct.h | 5 ++++- core/hdd/src/wlan_hdd_driver_ops.c | 14 +++++++------- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/components/pmo/core/src/wlan_pmo_suspend_resume.c b/components/pmo/core/src/wlan_pmo_suspend_resume.c index 2904d891a1..40bf39779d 100644 --- a/components/pmo/core/src/wlan_pmo_suspend_resume.c +++ b/components/pmo/core/src/wlan_pmo_suspend_resume.c @@ -1003,6 +1003,7 @@ QDF_STATUS pmo_core_txrx_suspend(struct wlan_objmgr_psoc *psoc) goto out; cdp_drain_txrx(dp_soc); + pmo_ctx->wow.txrx_suspended = true; out: pmo_psoc_put_ref(psoc); return status; @@ -1022,7 +1023,7 @@ QDF_STATUS pmo_core_txrx_resume(struct wlan_objmgr_psoc *psoc) } pmo_ctx = pmo_psoc_get_priv(psoc); - if (pmo_core_get_wow_state(pmo_ctx) != pmo_wow_state_unified_d3) + if (!pmo_ctx->wow.txrx_suspended) goto out; hif_ctx = pmo_core_psoc_get_hif_handle(psoc); @@ -1036,7 +1037,10 @@ QDF_STATUS pmo_core_txrx_resume(struct wlan_objmgr_psoc *psoc) if (ret && ret != -EOPNOTSUPP) { pmo_err("Failed to enable grp irqs: %d", ret); status = qdf_status_from_os_return(ret); + goto out; } + + pmo_ctx->wow.txrx_suspended = false; out: pmo_psoc_put_ref(psoc); return status; @@ -1266,10 +1270,6 @@ QDF_STATUS pmo_core_psoc_bus_runtime_resume(struct wlan_objmgr_psoc *psoc, } } - status = pmo_core_txrx_resume(psoc); - if (QDF_IS_STATUS_ERROR(status)) - goto fail; - if (hif_runtime_resume(hif_ctx)) { status = QDF_STATUS_E_FAILURE; goto fail; @@ -1279,6 +1279,10 @@ QDF_STATUS pmo_core_psoc_bus_runtime_resume(struct wlan_objmgr_psoc *psoc, if (status != QDF_STATUS_SUCCESS) goto fail; + status = pmo_core_txrx_resume(psoc); + if (QDF_IS_STATUS_ERROR(status)) + goto fail; + hif_pm_set_link_state(hif_ctx, HIF_PM_LINK_STATE_UP); status = pmo_core_psoc_configure_resume(psoc, true); diff --git a/components/pmo/dispatcher/inc/wlan_pmo_wow_public_struct.h b/components/pmo/dispatcher/inc/wlan_pmo_wow_public_struct.h index 0731fa58d9..88b23b07ac 100644 --- a/components/pmo/dispatcher/inc/wlan_pmo_wow_public_struct.h +++ b/components/pmo/dispatcher/inc/wlan_pmo_wow_public_struct.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -227,6 +227,8 @@ enum pmo_wow_state { * @pmo_lphb_callback: registered os if calllback function * @ptrn_id_def: default pattern id counter for legacy firmware * @ptrn_id_usr: user pattern id counter for legacy firmware + * @txrx_suspended: flag to determine if TX/RX is suspended + * during WoW * * This structure stores wow patterns and * wow related parameters in host. @@ -251,6 +253,7 @@ struct pmo_wow { uint8_t ptrn_id_def; uint8_t ptrn_id_usr; + bool txrx_suspended; }; /* WOW related structures */ diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c index 6281e0a6a4..ef9d75bbc3 100644 --- a/core/hdd/src/wlan_hdd_driver_ops.c +++ b/core/hdd/src/wlan_hdd_driver_ops.c @@ -1405,13 +1405,6 @@ int wlan_hdd_bus_resume(enum qdf_suspend_type type) param.policy_info.flag = BBM_APPS_RESUME; hdd_bbm_apply_independent_policy(hdd_ctx, ¶m); - qdf_status = ucfg_pmo_core_txrx_resume(hdd_ctx->psoc); - status = qdf_status_to_os_return(qdf_status); - if (status) { - hdd_err("Failed to resume TXRX"); - goto out; - } - status = hif_bus_resume(hif_ctx); if (status) { hdd_err("Failed hif bus resume"); @@ -1428,6 +1421,13 @@ int wlan_hdd_bus_resume(enum qdf_suspend_type type) goto out; } + qdf_status = ucfg_pmo_core_txrx_resume(hdd_ctx->psoc); + status = qdf_status_to_os_return(qdf_status); + if (status) { + hdd_err("Failed to resume TXRX"); + goto out; + } + hif_system_pm_set_state_on(hif_ctx); status = hif_bus_late_resume(hif_ctx);