Takashi Iwai 39fe21
From 08d80e4cd27ba19f9bee9e5f788f9a9fc440a22f Mon Sep 17 00:00:00 2001
Takashi Iwai 39fe21
From: Miaoqing Pan <miaoqing@codeaurora.org>
Takashi Iwai 39fe21
Date: Fri, 24 May 2019 11:16:22 +0800
Takashi Iwai 39fe21
Subject: [PATCH] ath10k: fix fw crash by moving chip reset after napi disabled
Takashi Iwai 39fe21
Git-commit: 08d80e4cd27ba19f9bee9e5f788f9a9fc440a22f
Takashi Iwai 39fe21
Patch-mainline: v5.3-rc1
Takashi Iwai 39fe21
References: bsc#1051510
Takashi Iwai 39fe21
Takashi Iwai 39fe21
On SMP platform, when continuously running wifi up/down, the napi
Takashi Iwai 39fe21
poll can be scheduled during chip reset, which will call
Takashi Iwai 39fe21
ath10k_pci_has_fw_crashed() to check the fw status. But in the reset
Takashi Iwai 39fe21
period, the value from FW_INDICATOR_ADDRESS register will return
Takashi Iwai 39fe21
0xdeadbeef, which also be treated as fw crash. Fix the issue by
Takashi Iwai 39fe21
moving chip reset after napi disabled.
Takashi Iwai 39fe21
Takashi Iwai 39fe21
ath10k_pci 0000:01:00.0: firmware crashed! (guid 73b30611-5b1e-4bdd-90b4-64c81eb947b6)
Takashi Iwai 39fe21
ath10k_pci 0000:01:00.0: qca9984/qca9994 hw1.0 target 0x01000000 chip_id 0x00000000 sub 168c:cafe
Takashi Iwai 39fe21
ath10k_pci 0000:01:00.0: htt-ver 2.2 wmi-op 6 htt-op 4 cal otp max-sta 512 raw 0 hwcrypto 1
Takashi Iwai 39fe21
ath10k_pci 0000:01:00.0: failed to get memcpy hi address for firmware address 4: -16
Takashi Iwai 39fe21
ath10k_pci 0000:01:00.0: failed to read firmware dump area: -16
Takashi Iwai 39fe21
ath10k_pci 0000:01:00.0: Copy Engine register dump:
Takashi Iwai 39fe21
ath10k_pci 0000:01:00.0: [00]: 0x0004a000   0   0   0   0
Takashi Iwai 39fe21
ath10k_pci 0000:01:00.0: [01]: 0x0004a400   0   0   0   0
Takashi Iwai 39fe21
ath10k_pci 0000:01:00.0: [02]: 0x0004a800   0   0   0   0
Takashi Iwai 39fe21
ath10k_pci 0000:01:00.0: [03]: 0x0004ac00   0   0   0   0
Takashi Iwai 39fe21
ath10k_pci 0000:01:00.0: [04]: 0x0004b000   0   0   0   0
Takashi Iwai 39fe21
ath10k_pci 0000:01:00.0: [05]: 0x0004b400   0   0   0   0
Takashi Iwai 39fe21
ath10k_pci 0000:01:00.0: [06]: 0x0004b800   0   0   0   0
Takashi Iwai 39fe21
ath10k_pci 0000:01:00.0: [07]: 0x0004bc00   1   0   1   0
Takashi Iwai 39fe21
ath10k_pci 0000:01:00.0: [08]: 0x0004c000   0   0   0   0
Takashi Iwai 39fe21
ath10k_pci 0000:01:00.0: [09]: 0x0004c400   0   0   0   0
Takashi Iwai 39fe21
ath10k_pci 0000:01:00.0: [10]: 0x0004c800   0   0   0   0
Takashi Iwai 39fe21
ath10k_pci 0000:01:00.0: [11]: 0x0004cc00   0   0   0   0
Takashi Iwai 39fe21
Takashi Iwai 39fe21
Tested HW: QCA9984,QCA9887,WCN3990
Takashi Iwai 39fe21
Takashi Iwai 39fe21
Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
Takashi Iwai 39fe21
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Takashi Iwai 39fe21
Acked-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai 39fe21
Takashi Iwai 39fe21
---
Takashi Iwai 39fe21
 drivers/net/wireless/ath/ath10k/pci.c | 9 +++++----
Takashi Iwai 39fe21
 1 file changed, 5 insertions(+), 4 deletions(-)
Takashi Iwai 39fe21
Takashi Iwai 39fe21
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
Takashi Iwai 39fe21
index 2bd6cbad19e4..80bcb2ef5926 100644
Takashi Iwai 39fe21
--- a/drivers/net/wireless/ath/ath10k/pci.c
Takashi Iwai 39fe21
+++ b/drivers/net/wireless/ath/ath10k/pci.c
Takashi Iwai 39fe21
@@ -2059,6 +2059,11 @@ static void ath10k_pci_hif_stop(struct ath10k *ar)
Takashi Iwai 39fe21
 
Takashi Iwai 39fe21
 	ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot hif stop\n");
Takashi Iwai 39fe21
 
Takashi Iwai 39fe21
+	ath10k_pci_irq_disable(ar);
Takashi Iwai 39fe21
+	ath10k_pci_irq_sync(ar);
Takashi Iwai 39fe21
+	napi_synchronize(&ar->napi);
Takashi Iwai 39fe21
+	napi_disable(&ar->napi);
Takashi Iwai 39fe21
+
Takashi Iwai 39fe21
 	/* Most likely the device has HTT Rx ring configured. The only way to
Takashi Iwai 39fe21
 	 * prevent the device from accessing (and possible corrupting) host
Takashi Iwai 39fe21
 	 * memory is to reset the chip now.
Takashi Iwai 39fe21
@@ -2072,10 +2077,6 @@ static void ath10k_pci_hif_stop(struct ath10k *ar)
Takashi Iwai 39fe21
 	 */
Takashi Iwai 39fe21
 	ath10k_pci_safe_chip_reset(ar);
Takashi Iwai 39fe21
 
Takashi Iwai 39fe21
-	ath10k_pci_irq_disable(ar);
Takashi Iwai 39fe21
-	ath10k_pci_irq_sync(ar);
Takashi Iwai 39fe21
-	napi_synchronize(&ar->napi);
Takashi Iwai 39fe21
-	napi_disable(&ar->napi);
Takashi Iwai 39fe21
 	ath10k_pci_flush(ar);
Takashi Iwai 39fe21
 
Takashi Iwai 39fe21
 	spin_lock_irqsave(&ar_pci->ps_lock, flags);
Takashi Iwai 39fe21
-- 
Takashi Iwai 39fe21
2.16.4
Takashi Iwai 39fe21