diff options
author | Leo Yan <leo.yan@linaro.org> | 2017-03-27 22:38:31 +0800 |
---|---|---|
committer | Leo Yan <leo.yan@linaro.org> | 2018-03-01 20:02:50 +0800 |
commit | 731ba98c177e30736fc946fc57ac65e6297380a5 (patch) | |
tree | 6a35ff19c35041150b429417eb7300220404a02b | |
parent | 95381a21c2616fc695481c52386333df44ce921c (diff) |
driver: misc: add driver for CPU hard lockup
Signed-off-by: Leo Yan <leo.yan@linaro.org>
-rw-r--r-- | drivers/misc/Kconfig | 3 | ||||
-rw-r--r-- | drivers/misc/Makefile | 1 | ||||
-rw-r--r-- | drivers/misc/dbg_ws_cpu_lockup.c | 49 |
3 files changed, 53 insertions, 0 deletions
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 03605f8fc0dc9..a8e02900e494f 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -500,6 +500,9 @@ config MISC_RTSX tristate default MISC_RTSX_PCI || MISC_RTSX_USB +config DBG_WS_CPU_LOCKUP + bool "Debug workshop CPU lockup" + source "drivers/misc/c2port/Kconfig" source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig" diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index c3c8624f4d950..75cef988f31b2 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -57,6 +57,7 @@ obj-$(CONFIG_ASPEED_LPC_SNOOP) += aspeed-lpc-snoop.o obj-$(CONFIG_PCI_ENDPOINT_TEST) += pci_endpoint_test.o obj-$(CONFIG_OCXL) += ocxl/ obj-$(CONFIG_MISC_RTSX) += cardreader/ +obj-$(CONFIG_DBG_WS_CPU_LOCKUP) += dbg_ws_cpu_lockup.o lkdtm-$(CONFIG_LKDTM) += lkdtm_core.o lkdtm-$(CONFIG_LKDTM) += lkdtm_bugs.o diff --git a/drivers/misc/dbg_ws_cpu_lockup.c b/drivers/misc/dbg_ws_cpu_lockup.c new file mode 100644 index 0000000000000..6a374c5506bc6 --- /dev/null +++ b/drivers/misc/dbg_ws_cpu_lockup.c @@ -0,0 +1,49 @@ +#include <linux/fs.h> +#include <linux/init.h> +#include <linux/kernel.h> +#include <linux/mm.h> +#include <linux/hugetlb.h> +#include <linux/mman.h> +#include <linux/mmzone.h> +#include <linux/proc_fs.h> +#include <linux/quicklist.h> +#include <linux/seq_file.h> +#include <linux/swap.h> +#include <linux/kthread.h> + +static void cpu_lock(void *unused) +{ + trace_printk("%s: enter\n", __func__); + + preempt_disable(); + local_irq_disable(); + + __asm__ __volatile__("b .\n\r"); + + return; +} + +static int cpu_hard_lock_show(struct seq_file *m, void *v) +{ + smp_call_function_single(7, cpu_lock, NULL, 0); + return 0; +} + +static int cpu_hard_lock_open(struct inode *inode, struct file *file) +{ + return single_open(file, cpu_hard_lock_show, NULL); +} + +static const struct file_operations cpu_hard_lock_fops = { + .open = cpu_hard_lock_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static int __init cpu_hard_lock_init(void) +{ + proc_create("dbg_ws_cpu_hard_lock", 0, NULL, &cpu_hard_lock_fops); + return 0; +} +fs_initcall(cpu_hard_lock_init); |