Skip to contentSkip to conversation

ath10k: add support for simulate crash on SDIO chip

PATCH Superseded Wen Gong 3 participants 3 messages Apr 16, 2019 – May 28, 2019 Qualcomm Atheros ATH10K wireless driver

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Wen Gong

author
#0 lore raw

PATCH 1/1 ath10k: add support for simulate crash on SDIO chip

The command to simulate firmware crash:
echo soft > /sys/kernel/debug/ieee80211/phy0/ath10k/simulate_fw_crash

It will send WMI_FORCE_FW_HANG_ASSERT to firmware, then it will trigger CPU interrupt status register for SDIO chip, ath10k driver need to configure it while enable SDIO interrupt, otherwise ath10k driver will not get the assert error info.

After this change, it will success for simulate firmware crash.

Tested with QCA6174 SDIO with firmware
WLAN.RMH.4.4.1-00007-QCARMSWP-1.

---
 drivers/net/wireless/ath/ath10k/hw.h   | 1 +
 drivers/net/wireless/ath/ath10k/sdio.c | 8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath10k/hw.h +1 -0
index 7131499..60521ed 100644
@@ -1095,6 +1095,7 @@ struct ath10k_hw_ops {
 #define MBOX_CPU_INT_STATUS_ENABLE_ADDRESS	0x00000819
 #define MBOX_CPU_INT_STATUS_ENABLE_BIT_LSB	0
 #define MBOX_CPU_INT_STATUS_ENABLE_BIT_MASK	0x000000ff
+#define MBOX_CPU_STATUS_ENABLE_ASSERT_MASK 0x00000001
 #define MBOX_ERROR_STATUS_ENABLE_ADDRESS	0x0000081a
 #define MBOX_ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB  1
 #define MBOX_ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK 0x00000002
drivers/net/wireless/ath/ath10k/sdio.c +6 -2
index fae56c6..78a2f3b 100644
@@ -850,6 +850,8 @@ static int ath10k_sdio_mbox_proc_cpu_intr(struct ath10k *ar)
 
 out:
 	mutex_unlock(&irq_data->mtx);
+	ath10k_err(ar, "firmware crashed!\n");
+	queue_work(ar->workqueue, &ar->restart_work);
 	return ret;
 }
 
@@ -1495,8 +1497,10 @@ static int ath10k_sdio_hif_enable_intrs(struct ath10k *ar)
 	regs->int_status_en |=
 		FIELD_PREP(MBOX_INT_STATUS_ENABLE_MBOX_DATA_MASK, 1);
 
-	/* Set up the CPU Interrupt status Register */
-	regs->cpu_int_status_en = 0;
+	/* Set up the CPU Interrupt Status Register, enable CPU sourced interrupt #0
+	 * #0 is used for report assertion from target
+	 */
+	regs->cpu_int_status_en = FIELD_PREP(MBOX_CPU_STATUS_ENABLE_ASSERT_MASK, 1);
 
 	/* Set up the Error Interrupt status Register */
 	regs->err_int_status_en =
Signature · 7 lines
1.9.1


_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
#1 lore raw
Quoted 37 lines · Wen Gong

The command to simulate firmware crash:
echo soft > /sys/kernel/debug/ieee80211/phy0/ath10k/simulate_fw_crash

It will send WMI_FORCE_FW_HANG_ASSERT to firmware, then it will trigger CPU interrupt status register for SDIO chip, ath10k driver need to configure it while enable SDIO interrupt, otherwise ath10k driver will not get the assert error info.

After this change, it will success for simulate firmware crash.

Tested with QCA6174 SDIO with firmware
WLAN.RMH.4.4.1-00007-QCARMSWP-1.

---
 drivers/net/wireless/ath/ath10k/hw.h   | 1 +
 drivers/net/wireless/ath/ath10k/sdio.c | 8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath10k/hw.h +1 -0
index 7131499..60521ed 100644
@@ -1095,6 +1095,7 @@ struct ath10k_hw_ops {
 #define MBOX_CPU_INT_STATUS_ENABLE_ADDRESS     0x00000819
 #define MBOX_CPU_INT_STATUS_ENABLE_BIT_LSB     0
 #define MBOX_CPU_INT_STATUS_ENABLE_BIT_MASK    0x000000ff
+#define MBOX_CPU_STATUS_ENABLE_ASSERT_MASK 0x00000001
 #define MBOX_ERROR_STATUS_ENABLE_ADDRESS       0x0000081a
 #define MBOX_ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB  1
 #define MBOX_ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK 0x00000002
drivers/net/wireless/ath/ath10k/sdio.c +0 -0
index fae56c6..78a2f3b 100644

drivers/net/wireless/ath/ath10k/sdio.c static int ath10k_sdio_mbox_proc_cpu_intr(struct ath10k *ar) · line 854

Quoted 5 lines
drivers/net/wireless/ath/ath10k/sdio.c +2 -0
@@ -850,6 +850,8 @@ static int ath10k_sdio_mbox_proc_cpu_intr(struct ath10k *ar)
 
 out:
        mutex_unlock(&irq_data->mtx);
+       ath10k_err(ar, "firmware crashed!\n");
+       queue_work(ar->workqueue, &ar->restart_work);

Err, so you consider _any_ CPU interrupt to be caused by the FW crashing? Is that correct? If so, please at least add a comment.

Otherwise, maybe you should run this only if MBOX_CPU_STATUS_ENABLE_ASSERT_MASK is set in cpu_int_status?

Quoted 19 lines
drivers/net/wireless/ath/ath10k/sdio.c +4 -3
        return ret;
 }
 
@@ -1495,8 +1497,10 @@ static int ath10k_sdio_hif_enable_intrs(struct ath10k *ar)
        regs->int_status_en |=
                FIELD_PREP(MBOX_INT_STATUS_ENABLE_MBOX_DATA_MASK, 1);
 
-       /* Set up the CPU Interrupt status Register */
-       regs->cpu_int_status_en = 0;
+       /* Set up the CPU Interrupt Status Register, enable CPU sourced interrupt #0
+        * #0 is used for report assertion from target
+        */
+       regs->cpu_int_status_en = FIELD_PREP(MBOX_CPU_STATUS_ENABLE_ASSERT_MASK, 1);
 
        /* Set up the Error Interrupt status Register */
        regs->err_int_status_en =
--

1.9.1

#2 lore raw
Quoted 10 lines

-----Original Message-----
From: ath10k <[email protected]> On Behalf Of Nicolas Boichat
Sent: Monday, April 29, 2019 1:21 PM
To: Wen Gong <[email protected]>
Cc: Claire Chang <[email protected]>; [email protected]; [email protected]
Subject: [EXT] Re: [PATCH] ath10k: add support for simulate crash on SDIO chip

Quoted 9 lines

Err, so you consider _any_ CPU interrupt to be caused by the FW crashing? Is that correct? If so, please at least add a comment.

Otherwise, maybe you should run this only if MBOX_CPU_STATUS_ENABLE_ASSERT_MASK is set in cpu_int_status?

Quoted 3 lines
        return ret;

}

Hi Nicolas,
New patch has uploaded for the change
https://patchwork.kernel.org/patch/10921341/
[v2] ath10k: add support for simulate crash on SDIO chip

https://patchwork.kernel.org/patch/10955189/
[v3] ath10k: add support for firmware crash recovery on SDIO chip