From 2d4f3f55ff09efb0c5a21e4d3e5d7a4d5751688c Mon Sep 17 00:00:00 2001 From: Yu Wang Date: Thu, 26 Jan 2017 15:39:00 +0800 Subject: qcacld-2.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. Change-Id: I97a696a02dfd73aaca212ef1bca9f3597df1e382 CRs-Fixed: 1114509 --- CORE/SERVICES/HIF/PCIe/if_pci.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/CORE/SERVICES/HIF/PCIe/if_pci.c b/CORE/SERVICES/HIF/PCIe/if_pci.c index 7d28cc265b9a..94705707d4ee 100644 --- a/CORE/SERVICES/HIF/PCIe/if_pci.c +++ b/CORE/SERVICES/HIF/PCIe/if_pci.c @@ -46,6 +46,7 @@ #include "vos_api.h" #include "vos_sched.h" #include "wma_api.h" +#include "wma.h" #include "adf_os_atomic.h" #include "wlan_hdd_power.h" #include "wlan_hdd_main.h" @@ -2651,9 +2652,38 @@ static void hif_dump_crash_debug_info(struct hif_pci_softc *sc) struct HIF_CE_state *hif_state = (struct HIF_CE_state *)sc->hif_device; struct ol_softc *scn = sc->ol_sc; int ret; + tp_wma_handle wma_handle; + void *vos_context = vos_get_global_context(VOS_MODULE_ID_HIF, NULL); if (!hif_state) return; + if (vos_context == NULL) { + pr_err("%s: vos context is null\n", __func__); + return; + } + wma_handle = (tp_wma_handle) vos_get_context( + VOS_MODULE_ID_WDA, vos_context); + if (wma_handle == NULL) { + pr_err("%s: wma_handle is null\n", __func__); + 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, 1, 0); + if (ret) { + pr_err("%s: failed to send crash inject - %d\n", + __func__, ret); + return; + } adf_os_spin_lock_irqsave(&hif_state->suspend_lock); hif_irq_record(HIF_CRASH, sc); -- cgit v1.2.3