summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Wang <yyuwang@codeaurora.org>2017-09-19 12:25:38 +0800
committersnandini <snandini@codeaurora.org>2017-09-21 13:17:19 -0700
commitd4a8db2614038ace11ada2fdec6a9ae6ad7bef37 (patch)
treede6ccbf8734219a73855bc8a9f3d14c9264961d2
parentc82e653f29c902a2eb4880bfa16a35c487d91f7f (diff)
qcacld-3.0: inject fw crash in crash-shutdown
When kernel panic happen, if WiFi FW is still active, it may cause NOC errors/memory corruption, to avoid this, inject a fw crash first. Propagated from qcacld-2.0 Change-Id: I97a696a02dfd73aaca212ef1bca9f3597df1e382 CRs-Fixed: 2052332
-rw-r--r--core/hdd/src/wlan_hdd_driver_ops.c24
-rw-r--r--core/wma/inc/wma.h2
-rw-r--r--core/wma/inc/wma_api.h3
-rw-r--r--core/wma/src/wma_main.c7
4 files changed, 31 insertions, 5 deletions
diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c
index f11753675dd1..e1335e475401 100644
--- a/core/hdd/src/wlan_hdd_driver_ops.c
+++ b/core/hdd/src/wlan_hdd_driver_ops.c
@@ -545,6 +545,30 @@ static void wlan_hdd_shutdown(void)
*/
static void wlan_hdd_crash_shutdown(void)
{
+ QDF_STATUS ret;
+ WMA_HANDLE wma_handle = cds_get_context(QDF_MODULE_ID_WMA);
+
+ if (!wma_handle) {
+ hdd_err("wma_handle is null");
+ return;
+ }
+
+ /*
+ * When kernel panic happen, if WiFi FW is still active
+ * it may cause NOC errors/memory corruption, to avoid
+ * this, inject a fw crash first.
+ * send crash_inject to FW directly, because we are now
+ * in an atomic context, and preempt has been disabled,
+ * MCThread won't be scheduled at the moment, at the same
+ * time, TargetFailure event wont't be received after inject
+ * crash due to the same reason.
+ */
+ ret = wma_crash_inject(wma_handle, RECOVERY_SIM_ASSERT, 0);
+ if (QDF_IS_STATUS_ERROR(ret)) {
+ hdd_err("Failed to send crash inject:%d", ret);
+ return;
+ }
+
hif_crash_shutdown(cds_get_context(QDF_MODULE_ID_HIF));
}
diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h
index 7e772340b0d1..f908e578e44f 100644
--- a/core/wma/inc/wma.h
+++ b/core/wma/inc/wma.h
@@ -2354,8 +2354,6 @@ QDF_STATUS wma_send_pdev_set_dual_mac_config(tp_wma_handle wma_handle,
struct sir_dual_mac_config *msg);
QDF_STATUS wma_send_pdev_set_antenna_mode(tp_wma_handle wma_handle,
struct sir_antenna_mode_param *msg);
-QDF_STATUS wma_crash_inject(tp_wma_handle wma_handle, uint32_t type,
- uint32_t delay_time_ms);
struct wma_target_req *wma_fill_vdev_req(tp_wma_handle wma,
uint8_t vdev_id,
diff --git a/core/wma/inc/wma_api.h b/core/wma/inc/wma_api.h
index d2f07c96dbaf..a2372ec99524 100644
--- a/core/wma/inc/wma_api.h
+++ b/core/wma/inc/wma_api.h
@@ -473,4 +473,7 @@ static inline void wma_spectral_scan_config(WMA_HANDLE wma_handle,
{
}
#endif
+
+QDF_STATUS wma_crash_inject(WMA_HANDLE wma_handle, uint32_t type,
+ uint32_t delay_time_ms);
#endif
diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c
index e3791268593f..6b9e1486bfde 100644
--- a/core/wma/src/wma_main.c
+++ b/core/wma/src/wma_main.c
@@ -8352,14 +8352,15 @@ resp:
*
* Return: QDF_STATUS_SUCCESS for success or error code
*/
-QDF_STATUS wma_crash_inject(tp_wma_handle wma_handle, uint32_t type,
- uint32_t delay_time_ms)
+QDF_STATUS wma_crash_inject(WMA_HANDLE wma_handle, uint32_t type,
+ uint32_t delay_time_ms)
{
struct crash_inject param;
+ tp_wma_handle wma = (tp_wma_handle)wma_handle;
param.type = type;
param.delay_time_ms = delay_time_ms;
- return wmi_crash_inject(wma_handle->wmi_handle, &param);
+ return wmi_crash_inject(wma->wmi_handle, &param);
}
/**