Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 55c935b0 authored by Rama Aparna Mallavarapu's avatar Rama Aparna Mallavarapu
Browse files

soc: qcom: Add snapshot of watchdog_v2 driver



This is a snapshot of the watchdog_v2 driver as of msm-4.9
commit '1a00b60049366e3f717973040f5f97ed9b972c10'. ("Update
last_pet variable during resume") The last_pet variable is
set in suspend callback and during pet_watchdog() and is
printed when watchdog bark handler gets called. This variable
does not represent exact last pet time in cases where non secure
bark occurs before system could pet the watchdog upon wakeup
event from low power mode. Reset the watchdog during
msm_watchdog_resume() and update last_pet variable so that
watchdog bark messages will represent latest info.

This commit also adds memory barrier after resetting watchdog in
msm_watchdog_suspend(). This will make sure watchdog writes are
complete before proceeding further.

Change-Id: I50190aa37c06bac21e91450d33312139ee532109
Signed-off-by: default avatarRama Aparna Mallavarapu <aparnam@codeaurora.org>
parent 55e13622
Loading
Loading
Loading
Loading
+48 −0
Original line number Original line Diff line number Diff line
* Qualcomm MSM Watchdog

Watchdog timer is configured with a bark and a bite time.
If the watchdog is not "pet" at regular intervals, the system
is assumed to have become non responsive and needs to be reset.
A warning in the form of a bark timeout leads to a bark interrupt
and a kernel panic. If the watchdog timer is still not reset,
a bite timeout occurs, which is an interrupt in the secure mode,
which leads to a reset of the SOC via the secure watchdog. The
driver needs the petting time, and the bark timeout to be programmed
into the watchdog, as well as the bark and bite irqs.

The device tree parameters for the watchdog are:

Required properties:

- compatible : "qcom,msm-watchdog"
- reg : offset and length of the register set for the watchdog block.
- reg-names : names corresponding to each reg property value.
        "wdt-base" - physical base address of watchdog timer registers
        "wdt-absent-base" - physical base address of watchdog absent register
- interrupts : should contain bark and bite irq numbers
- qcom,pet-time : Non zero time interval at which watchdog should be pet in ms.
- qcom,bark-time : Non zero timeout value for a watchdog bark in ms.
- qcom,userspace-watchdog :
        (boolean) Allow enabling the userspace-watchdog feature. This feature
        requires userspace to pet the watchdog every qcom,pet-time interval
        in addition to the existing kernel-level checks.
        This feature is supported through device sysfs files.

Optional properties:

- qcom,ipi-ping : (boolean) send keep alive ping to other cpus if present
- qcom,wakeup-enable : (boolean) enable non secure watchdog to freeze / unfreeze
                        automatically across suspend / resume path.

Example:

        qcom,wdt@f9017000 {
                compatible = "qcom,msm-watchdog";
                reg = <0xf9017000 0x1000>;
                reg-names = "wdt-base";
                interrupts = <0 3 0>, <0 4 0>;
                qcom,bark-time = <11000>;
                qcom,pet-time = <10000>;
                qcom,ipi-ping;
                qcom,wakeup-enable;
        };
+9 −0
Original line number Original line Diff line number Diff line
@@ -100,6 +100,15 @@ config QCOM_MEMORY_DUMP_V2
	  of deadlocks or cpu hangs these dump regions are captured to
	  of deadlocks or cpu hangs these dump regions are captured to
	  give a snapshot of the system at the time of the crash.
	  give a snapshot of the system at the time of the crash.


config QCOM_WATCHDOG_V2
	bool "Qualcomm Watchdog Support"
	depends on ARCH_QCOM
	help
	  This enables the watchdog module. It causes kernel panic if the
	  watchdog times out. It allows for detection of cpu hangs and
	  deadlocks. It does not run during the bootup process, so it will
	  not catch any early lockups.

config QCOM_SMEM_STATE
config QCOM_SMEM_STATE
	bool
	bool


+1 −0
Original line number Original line Diff line number Diff line
@@ -18,6 +18,7 @@ obj-$(CONFIG_MSM_CORE_HANG_DETECT) += core_hang_detect.o
obj-$(CONFIG_MSM_GLADIATOR_HANG_DETECT) += gladiator_hang_detect.o
obj-$(CONFIG_MSM_GLADIATOR_HANG_DETECT) += gladiator_hang_detect.o
obj-$(CONFIG_QCOM_SECURE_BUFFER) += secure_buffer.o
obj-$(CONFIG_QCOM_SECURE_BUFFER) += secure_buffer.o
obj-$(CONFIG_QCOM_MEMORY_DUMP_V2) += memory_dump_v2.o
obj-$(CONFIG_QCOM_MEMORY_DUMP_V2) += memory_dump_v2.o
obj-$(CONFIG_QCOM_WATCHDOG_V2) += watchdog_v2.o
obj-$(CONFIG_ICNSS) += icnss.o wlan_firmware_service_v01.o icnss_utils.o
obj-$(CONFIG_ICNSS) += icnss.o wlan_firmware_service_v01.o icnss_utils.o
obj-$(CONFIG_MSM_SERVICE_NOTIFIER) += service-notifier.o
obj-$(CONFIG_MSM_SERVICE_NOTIFIER) += service-notifier.o
obj-$(CONFIG_MSM_SERVICE_LOCATOR) += service-locator.o
obj-$(CONFIG_MSM_SERVICE_LOCATOR) += service-locator.o
+849 −0

File added.

Preview size limit exceeded, changes collapsed.

+29 −0
Original line number Original line Diff line number Diff line
/* Copyright (c) 2017, 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

#ifdef CONFIG_QCOM_WATCHDOG_V2
void msm_trigger_wdog_bite(void);
#else
static inline void msm_trigger_wdog_bite(void) { }
#endif

#endif