summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKomal Seelam <kseelam@qti.qualcomm.com>2015-08-17 17:21:53 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2015-08-19 04:01:54 -0700
commit06c44fc1a1aaba57c6f9bf955aba4e44b4cf1195 (patch)
tree5b6069dc08beb42de0761d7aa7609f5fb76b040a
parentb6180ef14d4cb9dfba5741567eec0991b279b952 (diff)
qcacld: Fix race condition between runtime/system PM
WMI_WOW_DEL_WAKE_PATTERN_CMDID is not properly tagged as runtime packet during some scenarios wherein runtime suspend coming immediately after runtime resume. Intially the design was not to tag the WOW_DEL commands as the FW won't operate on the wakeup patterns after wow is disabled. I5eae66e09d5fac4f913c0eaaf90ff600d8c7d626 added few optimizations not to delete the patterns if wow is not configured. But there can be cases where in few of WOW_DEL commands are getting tagged and few not due to changes in commit bbb44d9f23d868a2837c6b22b8dfb123d8e7800c in 3.18 kernel where runtime suspend is coming back to back after resume and when cfg80211 resume comes when device is runtime suspend, these WOW_DEL commands are going as runtime tagged and accessing the PCIe link which clocked down during runtime suspend. The commit Ibf7eca6c344d427e0ac05c1bd903bab1073236a5 fixes the synchronization issue between system PM and runtime PM, ensuring driver system suspend happens after device is runtime active till system resume completes. Ensure to tag all runtime PM control path commands by setting runtime_pm_inprogress flag to false after sending all the WOW_DEL commands. Since runtime/system suspend/resume all are serialized to MC thread, the packets will reach FW in the order we queued. Improve the logic in I5eae66e09d5fac4f913c0eaaf90ff600d8c7d626 to feed WoW config during system suspend by ensuring device runtime status is ACTIVE. Change-Id: I365a8a43e37278207a643058896913a2d60a4990 CRs-Fixed: 891485
-rw-r--r--CORE/SERVICES/WMA/wma.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/CORE/SERVICES/WMA/wma.c b/CORE/SERVICES/WMA/wma.c
index bc5ba2d29797..18cbc1bc5dfa 100644
--- a/CORE/SERVICES/WMA/wma.c
+++ b/CORE/SERVICES/WMA/wma.c
@@ -19782,7 +19782,7 @@ static void wma_unpause_vdev(tp_wma_handle wma) {
static VOS_STATUS wma_resume_req(tp_wma_handle wma, bool runtime_pm)
{
- VOS_STATUS ret = VOS_STATUS_SUCCESS;
+ VOS_STATUS ret = VOS_STATUS_E_AGAIN;
u_int8_t ptrn_id;
if (runtime_pm)
@@ -19801,16 +19801,18 @@ skip_vdev_suspend:
runtime_pm ? " for runtime PM" : "",
wma->wow.wow_enable, wma->wow.wow_enable_cmd_sent);
- if (!wma->wow.wow_enable) {
- WMA_LOGD("WoW pattern not configured in FW during suspend,"
- " skip delete!");
- goto end;
- }
-
if (wma->wow.wow_enable_cmd_sent) {
WMA_LOGD("Firmware is still in WoW mode, don't delete WoW"
" patterns");
- goto end;
+ VOS_ASSERT(0);
+ return ret;
+ }
+
+ if (!wma->wow.wow_enable) {
+ WMA_LOGD("WoW pattern not configured in FW during suspend,"
+ " skip delete!");
+ ret = VOS_STATUS_SUCCESS;
+ goto pdev_resume;
}
/* Clear existing wow patterns in FW. */
@@ -19821,14 +19823,17 @@ skip_vdev_suspend:
goto end;
}
- wma->wow.wow_enable = FALSE;
end:
+ wma->wow.wow_enable = FALSE;
/* Reset the DTIM Parameters */
wma_set_resume_dtim(wma);
+pdev_resume:
+ wmi_set_runtime_pm_inprogress(wma->wmi_handle, FALSE);
/* need to reset if hif_pci_suspend_fails */
wma_set_wow_bus_suspend(wma, 0);
/* unpause the vdev if left paused and hif_pci_suspend fails */
wma_unpause_vdev(wma);
+
return ret;
}
@@ -19852,9 +19857,10 @@ static VOS_STATUS wma_feed_wow_config_to_fw(tp_wma_handle wma,
bool wps_enable = false;
if (wma->wow.wow_enable) {
- WMA_LOGD("WoW config%s already fed to FW! skip it",
- runtime_pm ? " for runtime suspend" : " ");
- return ret;
+ WMA_LOGD("Already%s Fatal Error!",
+ runtime_pm ? " runtime suspended" : " cfg suspended");
+ VOS_BUG(0);
+ return VOS_STATUS_E_AGAIN;
}
/* Gather list of free ptrn id. This is needed while configuring
@@ -31511,7 +31517,6 @@ int wma_runtime_resume_req(WMA_HANDLE handle)
{
vos_msg_t vosMessage;
VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
- tp_wma_handle wma = (tp_wma_handle) handle;
int ret = 0;
vosMessage.bodyptr = NULL;
@@ -31521,7 +31526,6 @@ int wma_runtime_resume_req(WMA_HANDLE handle)
if (!VOS_IS_STATUS_SUCCESS(vosStatus))
ret = -EAGAIN;
- wmi_set_runtime_pm_inprogress(wma->wmi_handle, FALSE);
return ret;
}