ath10k: support firmware crash-by-assert
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. kvalo: move the wmi command creation to debug.c, modify the info print Signed-off-by: Ben Greear <greearb@candelatech.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
This commit is contained in:
parent
43d2a30fa8
commit
d5aebc77b4
|
@ -565,6 +565,26 @@ static const struct file_operations fops_fw_stats = {
|
||||||
.llseek = default_llseek,
|
.llseek = default_llseek,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* This is a clean assert crash in firmware. */
|
||||||
|
static int ath10k_debug_fw_assert(struct ath10k *ar)
|
||||||
|
{
|
||||||
|
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));
|
||||||
|
|
||||||
|
/* big enough number so that firmware asserts */
|
||||||
|
cmd->vdev_id = __cpu_to_le32(0x7ffe);
|
||||||
|
|
||||||
|
return ath10k_wmi_cmd_send(ar, skb,
|
||||||
|
ar->wmi.cmd->vdev_install_key_cmdid);
|
||||||
|
}
|
||||||
|
|
||||||
static ssize_t ath10k_read_simulate_fw_crash(struct file *file,
|
static ssize_t ath10k_read_simulate_fw_crash(struct file *file,
|
||||||
char __user *user_buf,
|
char __user *user_buf,
|
||||||
size_t count, loff_t *ppos)
|
size_t count, loff_t *ppos)
|
||||||
|
@ -574,7 +594,10 @@ static ssize_t ath10k_read_simulate_fw_crash(struct file *file,
|
||||||
" WMI_FORCE_FW_HANG_ASSERT to firmware if FW"
|
" WMI_FORCE_FW_HANG_ASSERT to firmware if FW"
|
||||||
" supports that command.\n `hard` - this will send"
|
" supports that command.\n `hard` - this will send"
|
||||||
" to firmware command with illegal parameters"
|
" 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));
|
return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));
|
||||||
}
|
}
|
||||||
|
@ -623,6 +646,9 @@ static ssize_t ath10k_write_simulate_fw_crash(struct file *file,
|
||||||
*/
|
*/
|
||||||
ret = ath10k_wmi_vdev_set_param(ar, 0x7fff,
|
ret = ath10k_wmi_vdev_set_param(ar, 0x7fff,
|
||||||
ar->wmi.vdev_param->rts_threshold, 0);
|
ar->wmi.vdev_param->rts_threshold, 0);
|
||||||
|
} else if (!strcmp(buf, "assert")) {
|
||||||
|
ath10k_info(ar, "simulating firmware assert crash\n");
|
||||||
|
ret = ath10k_debug_fw_assert(ar);
|
||||||
} else {
|
} else {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
Loading…
Reference in New Issue