diff options
| author | Subbaraman Narayanamurthy <subbaram@codeaurora.org> | 2014-08-06 14:06:33 -0700 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-22 11:02:15 -0700 |
| commit | aff6914761d2f449aaec92ebc43ad15499640d12 (patch) | |
| tree | 4b598547fa5668a595d12dfb877b0ac219483446 | |
| parent | 96864fd7edce57e2e3c06b0f1ee4a56a8eb8018f (diff) | |
soc: qcom: watchdog_v2: Add support to trigger watchdog bite on panic
In certain cases during a kernel panic,the interrupts on non-panicking
CPUs are disabled. Since CPU context cannot be collected by sending IPI
to those CPUs, we're limited to debug the problem. Forcing a watchdog
bite during kernel panic will ensure us getting the proper CPU context.
Hence adding support for the same.
Change-Id: Id06030d9bc46d94209da7f0ef8c47bfd3477baf6
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
[abhimany: resolve trivial merge conflicts]
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
| -rw-r--r-- | drivers/power/reset/msm-poweroff.c | 9 | ||||
| -rw-r--r-- | drivers/soc/qcom/Kconfig | 8 | ||||
| -rw-r--r-- | drivers/soc/qcom/watchdog_v2.c | 14 | ||||
| -rw-r--r-- | include/soc/qcom/watchdog.h | 25 |
4 files changed, 44 insertions, 12 deletions
diff --git a/drivers/power/reset/msm-poweroff.c b/drivers/power/reset/msm-poweroff.c index c7d8dd305312..2bcfb6c4e39a 100644 --- a/drivers/power/reset/msm-poweroff.c +++ b/drivers/power/reset/msm-poweroff.c @@ -31,6 +31,7 @@ #include <soc/qcom/scm.h> #include <soc/qcom/restart.h> +#include <soc/qcom/watchdog.h> #define EMERGENCY_DLOAD_MAGIC1 0x322A4F99 #define EMERGENCY_DLOAD_MAGIC2 0xC67E4350 @@ -267,6 +268,14 @@ static void do_msm_restart(enum reboot_mode reboot_mode, const char *cmd) msm_restart_prepare(cmd); + /* + * Trigger a watchdog bite here and if this fails, + * device will take the usual restart path. + */ + + if (WDOG_BITE_ON_PANIC && in_panic) + msm_trigger_wdog_bite(); + /* Needed to bypass debug image on some chips */ if (!is_scm_armv8()) ret = scm_call_atomic2(SCM_SVC_BOOT, diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig index 12ce797383e7..e25a37e7ecd5 100644 --- a/drivers/soc/qcom/Kconfig +++ b/drivers/soc/qcom/Kconfig @@ -230,3 +230,11 @@ config TRACER_PKT Tracer Packet helps in profiling the performance of inter- processor communication protocols. The profiling information can be logged into the tracer packet itself. + +config QCOM_FORCE_WDOG_BITE_ON_PANIC + bool "QCOM force watchdog bite" + depends on QCOM_WATCHDOG_V2 + help + This forces a watchdog bite when the device restarts due to a + kernel panic. On certain MSM SoCs, this provides us + additional debugging information. diff --git a/drivers/soc/qcom/watchdog_v2.c b/drivers/soc/qcom/watchdog_v2.c index 6bef39edc003..6ea51140da28 100644 --- a/drivers/soc/qcom/watchdog_v2.c +++ b/drivers/soc/qcom/watchdog_v2.c @@ -28,6 +28,7 @@ #include <linux/platform_device.h> #include <soc/qcom/scm.h> #include <soc/qcom/memory_dump.h> +#include <soc/qcom/watchdog.h> #define MODULE_NAME "msm_watchdog" #define WDT0_ACCSCSSNBARK_INT 0 @@ -406,18 +407,7 @@ static irqreturn_t wdog_bark_handler(int irq, void *dev_id) wdog_dd->last_pet, nanosec_rem / 1000); if (wdog_dd->do_ipi_ping) dump_cpu_alive_mask(wdog_dd); - printk(KERN_INFO "Causing a watchdog bite!"); - __raw_writel(1, wdog_dd->base + WDT0_BITE_TIME); - mb(); - __raw_writel(1, wdog_dd->base + WDT0_RST); - mb(); - /* Delay to make sure bite occurs */ - mdelay(1); - pr_err("Wdog - STS: 0x%x, CTL: 0x%x, BARK TIME: 0x%x, BITE TIME: 0x%x", - __raw_readl(wdog_dd->base + WDT0_STS), - __raw_readl(wdog_dd->base + WDT0_EN), - __raw_readl(wdog_dd->base + WDT0_BARK_TIME), - __raw_readl(wdog_dd->base + WDT0_BITE_TIME)); + msm_trigger_wdog_bite(); panic("Failed to cause a watchdog bite! - Falling back to kernel panic!"); return IRQ_HANDLED; } diff --git a/include/soc/qcom/watchdog.h b/include/soc/qcom/watchdog.h new file mode 100644 index 000000000000..d82858f30a55 --- /dev/null +++ b/include/soc/qcom/watchdog.h @@ -0,0 +1,25 @@ +/* Copyright (c) 2014, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef _ASM_ARCH_MSM_WATCHDOG_H_ +#define _ASM_ARCH_MSM_WATCHDOG_H_ + +#ifdef CONFIG_QCOM_FORCE_WDOG_BITE_ON_PANIC +#define WDOG_BITE_ON_PANIC 1 +#else +#define WDOG_BITE_ON_PANIC 0 +#endif + +void msm_trigger_wdog_bite(void); + +#endif |
