ath10k: Support firmware crash-by-assert.
PATCH 1/1 ath10k: Support firmware crash-by-assert.
From: Ben Greear <[email protected]>
10.1 firmware does not have an official way to cause assert on purpose, but it can be done with carefully crafted WMI command. This is a different kind of crash from the 'hard' crash, which is a bad memory dereference.
Different crashes decode in different manners, so this will help the crash-report testing as well as offer better ways to test firmware failure and recovery.
--- drivers/net/wireless/ath/ath10k/debug.c | 8 +++++++- drivers/net/wireless/ath/ath10k/wmi.c | 20 ++++++++++++++++++++ drivers/net/wireless/ath/ath10k/wmi.h | 1 + 3 files changed, 28 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/debug.c +7 -1
@@ -580,7 +580,10 @@ static ssize_t ath10k_read_simulate_fw_crash(struct file *file," WMI_FORCE_FW_HANG_ASSERT to firmware if FW" " supports that command.\n `hard` - this will send" " to firmware command with illegal parameters" -" causing firmware crash.\n" ; +" causing firmware crash.\n" +"`assert` - this will send special illegal parameter" +" to firmware to cause assert failure" +" and crash.\n" ;return simple_read_from_buffer (user_buf, count, ppos, buf,strlen (buf)); }
@@ -629,6 +632,9 @@ static ssize_t ath10k_write_simulate_fw_crash(struct file *file,*/ ret =ath10k_wmi_vdev_set_param (ar,0x7fff , ar->wmi.vdev_param->rts_threshold,0 ); + }else if (!strcmp (buf,"assert" )) { +/* This is a clean assert crash. */ + ret =ath10k_wmi_vdev_assert (ar,0x7ffe ); }else { ret = -EINVAL ; goto exit;
drivers/net/wireless/ath/ath10k/wmi.c +20 -0
@@ -3725,6 +3725,26 @@ int ath10k_wmi_vdev_install_key(struct ath10k *ar, ar->wmi.cmd->vdev_install_key_cmdid); } +int ath10k_wmi_vdev_assert (struct ath10k *ar,u32 crashme) +{ +struct wmi_vdev_install_key_cmd *cmd; +struct sk_buff *skb; + + skb =ath10k_wmi_alloc_skb (ar,sizeof (*cmd) +16 ); +if (!skb) +return -ENOMEM ; + + cmd = (struct wmi_vdev_install_key_cmd *)skb->data; +memset (cmd,0 ,sizeof (*cmd)); + cmd->vdev_id =__cpu_to_le32 (crashme); + +ath10k_info (ar, +"simulating firmware ASSERT with bad install_key vdev-id: 0x%x\n" , + cmd->vdev_id); +return ath10k_wmi_cmd_send (ar, skb, + ar->wmi.cmd->vdev_install_key_cmdid); +} +int ath10k_wmi_vdev_spectral_conf (struct ath10k *ar,const struct wmi_vdev_spectral_conf_arg *arg) {
drivers/net/wireless/ath/ath10k/wmi.h +1 -0
@@ -4774,6 +4774,7 @@ int ath10k_wmi_vdev_set_param(struct ath10k *ar, u32 vdev_id, u32 param_id, u32 param_value);int ath10k_wmi_vdev_install_key (struct ath10k *ar,const struct wmi_vdev_install_key_arg *arg); +int ath10k_wmi_vdev_assert (struct ath10k *ar,u32 crashme);int ath10k_wmi_vdev_spectral_conf (struct ath10k *ar,const struct wmi_vdev_spectral_conf_arg *arg); int ath10k_wmi_vdev_spectral_enable(struct ath10k *ar, u32 vdev_id, u32 trigger,
Signature · 1 line
1.7.11.7
Quoted 14 lines · [email protected] writes:
From: Ben Greear <[email protected]>
10.1 firmware does not have an official way to cause assert on purpose, but it can be done with carefully crafted WMI command. This is a different kind of crash from the 'hard' crash, which is a bad memory dereference.
Different crashes decode in different manners, so this will help the crash-report testing as well as offer better ways to test firmware failure and recovery.
Signed-off-by Ben Greear <[email protected]>
[...]
Quoted 12 lines
drivers/net/wireless/ath/ath10k/wmi.c +6
-0@@ -3725,6 +3725,26 @@ int ath10k_wmi_vdev_install_key(struct ath10k *ar, ar->wmi.cmd->vdev_install_key_cmdid); } +int ath10k_wmi_vdev_assert (struct ath10k *ar,u32 crashme) +{ +struct wmi_vdev_install_key_cmd *cmd; +struct sk_buff *skb; + + skb =ath10k_wmi_alloc_skb (ar,sizeof (*cmd) +16 );
drivers/net/wireless/ath/ath10k/wmi.c int ath10k_wmi_vdev_install_key(struct ath10k *ar, · line 3743
Quoted 10 lines
drivers/net/wireless/ath/ath10k/wmi.c +10
-0+if (!skb) +return -ENOMEM ; + + cmd = (struct wmi_vdev_install_key_cmd *)skb->data; +memset (cmd,0 ,sizeof (*cmd)); + cmd->vdev_id =__cpu_to_le32 (crashme); + +ath10k_info (ar, +"simulating firmware ASSERT with bad install_key vdev-id: 0x%x\n" , + cmd->vdev_id);
cmd->vdev_id is in little endian here.
drivers/net/wireless/ath/ath10k/wmi.c int ath10k_wmi_vdev_install_key(struct ath10k *ar, · line 3746
Quoted 3 lines
drivers/net/wireless/ath/ath10k/wmi.c +3
-0+return ath10k_wmi_cmd_send (ar, skb, + ar->wmi.cmd->vdev_install_key_cmdid); +}
As this is not a real WMI command, I would actually prefer to have this in debug.c. With my patch "ath10k: make ath10k_wmi_cmd_send() public" that's possible now.
I can do the changes and will send v2 shortly. Just need to test it first.
Signature · 1 line
Kalle Valo