2 * Copyright (C) 2014 Google, Inc.
3 * Copyright (C) 2010-2015 NVIDIA Corporation. All rights reserved.
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
16 #include <linux/kernel.h>
17 #include <linux/spinlock.h>
18 #include <linux/pstore_ram.h>
20 #include "fiq_watchdog.h"
21 #include "fiq_debugger_priv.h"
23 static DEFINE_RAW_SPINLOCK(fiq_watchdog_lock);
25 static void fiq_watchdog_printf(struct fiq_debugger_output *output,
33 len = vscnprintf(buf, sizeof(buf), fmt, ap);
36 ramoops_console_write_buf(buf, len);
39 struct fiq_debugger_output fiq_watchdog_output = {
40 .printf = fiq_watchdog_printf,
43 void fiq_watchdog_triggered(const struct pt_regs *regs, void *svc_sp)
48 raw_spin_lock(&fiq_watchdog_lock);
50 len = scnprintf(msg, sizeof(msg), "watchdog fiq cpu %d\n",
51 THREAD_INFO(svc_sp)->cpu);
52 ramoops_console_write_buf(msg, len);
54 fiq_debugger_dump_stacktrace(&fiq_watchdog_output, regs, 100, svc_sp);
56 raw_spin_unlock(&fiq_watchdog_lock);