#include <linux/cpu.h>
#include <linux/delay.h>
#include <linux/kdb.h>
#include <linux/kexec.h>
#include <linux/kgdb.h>
#include <linux/moduleparam.h>
#include <linux/nmi.h>
#include <linux/sched.h>
#include <linux/sched/debug.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/clocksource.h>
#include <asm/apic.h>
#include <asm/current.h>
#include <asm/kdebug.h>
#include <asm/local64.h>
#include <asm/nmi.h>
#include <asm/reboot.h>
#include <asm/traps.h>
#include <asm/uv/uv.h>
#include <asm/uv/uv_hub.h>
#include <asm/uv/uv_mmrs.h>
static struct uv_hub_nmi_s **uv_hub_nmi_list;
DEFINE_PER_CPU(struct uv_cpu_nmi_s, uv_cpu_nmi);
static unsigned long uvh_nmi_mmrx;
static unsigned long uvh_nmi_mmrx_clear;
static int uvh_nmi_mmrx_shift;
static char *uvh_nmi_mmrx_type;
static unsigned long uvh_nmi_mmrx_supported;
static unsigned long uvh_nmi_mmrx_req;
static int uvh_nmi_mmrx_req_shift;
#define NMI_CONTROL_PORT …
#define NMI_DUMMY_PORT …
#define PAD_OWN_GPP_D_0 …
#define GPI_NMI_STS_GPP_D_0 …
#define GPI_NMI_ENA_GPP_D_0 …
#define STS_GPP_D_0_MASK …
#define PAD_CFG_DW0_GPP_D_0 …
#define GPIROUTNMI …
#define PCH_PCR_GPIO_1_BASE …
#define PCH_PCR_GPIO_ADDRESS(offset) …
static u64 *pch_base;
static unsigned long nmi_mmr;
static unsigned long nmi_mmr_clear;
static unsigned long nmi_mmr_pending;
static atomic_t uv_in_nmi;
static atomic_t uv_nmi_cpu = …;
static atomic_t uv_nmi_cpus_in_nmi = …;
static atomic_t uv_nmi_slave_continue;
static cpumask_var_t uv_nmi_cpu_mask;
static atomic_t uv_nmi_kexec_failed;
#define SLAVE_CLEAR …
#define SLAVE_CONTINUE …
#define SLAVE_EXIT …
static int uv_nmi_loglevel = …;
module_param_named(dump_loglevel, uv_nmi_loglevel, int, 0644);
static int param_get_local64(char *buffer, const struct kernel_param *kp)
{ … }
static int param_set_local64(const char *val, const struct kernel_param *kp)
{ … }
static const struct kernel_param_ops param_ops_local64 = …;
#define param_check_local64(name, p) …
static local64_t uv_nmi_count;
module_param_named(nmi_count, uv_nmi_count, local64, 0644);
static local64_t uv_nmi_misses;
module_param_named(nmi_misses, uv_nmi_misses, local64, 0644);
static local64_t uv_nmi_ping_count;
module_param_named(ping_count, uv_nmi_ping_count, local64, 0644);
static local64_t uv_nmi_ping_misses;
module_param_named(ping_misses, uv_nmi_ping_misses, local64, 0644);
static int uv_nmi_initial_delay = …;
module_param_named(initial_delay, uv_nmi_initial_delay, int, 0644);
static int uv_nmi_slave_delay = …;
module_param_named(slave_delay, uv_nmi_slave_delay, int, 0644);
static int uv_nmi_loop_delay = …;
module_param_named(loop_delay, uv_nmi_loop_delay, int, 0644);
static int uv_nmi_trigger_delay = …;
module_param_named(trigger_delay, uv_nmi_trigger_delay, int, 0644);
static int uv_nmi_wait_count = …;
module_param_named(wait_count, uv_nmi_wait_count, int, 0644);
static int uv_nmi_retry_count = …;
module_param_named(retry_count, uv_nmi_retry_count, int, 0644);
static bool uv_pch_intr_enable = …;
static bool uv_pch_intr_now_enabled;
module_param_named(pch_intr_enable, uv_pch_intr_enable, bool, 0644);
static bool uv_pch_init_enable = …;
module_param_named(pch_init_enable, uv_pch_init_enable, bool, 0644);
static int uv_nmi_debug;
module_param_named(debug, uv_nmi_debug, int, 0644);
#define nmi_debug(fmt, ...) …
enum action_t { … };
static const char * const actions[nmi_act_max] = …;
static const char * const actions_desc[nmi_act_max] = …;
static enum action_t uv_nmi_action = …;
static int param_get_action(char *buffer, const struct kernel_param *kp)
{ … }
static int param_set_action(const char *val, const struct kernel_param *kp)
{ … }
static const struct kernel_param_ops param_ops_action = …;
#define param_check_action(name, p) …
module_param_named(action, uv_nmi_action, action, 0644);
static void uv_nmi_setup_mmrs(void)
{ … }
static inline int uv_nmi_test_mmr(struct uv_hub_nmi_s *hub_nmi)
{ … }
static inline void uv_local_mmr_clear_nmi(void)
{ … }
static inline void uv_reassert_nmi(void)
{ … }
static void uv_init_hubless_pch_io(int offset, int mask, int data)
{ … }
static void uv_nmi_setup_hubless_intr(void)
{ … }
static struct init_nmi { … } init_nmi[] = …;
static void uv_init_hubless_pch_d0(void)
{ … }
static int uv_nmi_test_hubless(struct uv_hub_nmi_s *hub_nmi)
{ … }
static int uv_test_nmi(struct uv_hub_nmi_s *hub_nmi)
{ … }
static int uv_set_in_nmi(int cpu, struct uv_hub_nmi_s *hub_nmi)
{ … }
static int uv_check_nmi(struct uv_hub_nmi_s *hub_nmi)
{ … }
static inline void uv_clear_nmi(int cpu)
{ … }
static void uv_nmi_nr_cpus_ping(void)
{ … }
static void uv_nmi_cleanup_mask(void)
{ … }
static int uv_nmi_wait_cpus(int first)
{ … }
static void uv_nmi_wait(int master)
{ … }
static void uv_nmi_dump_cpu_ip_hdr(void)
{ … }
static void uv_nmi_dump_cpu_ip(int cpu, struct pt_regs *regs)
{ … }
static void uv_nmi_dump_state_cpu(int cpu, struct pt_regs *regs)
{ … }
static void uv_nmi_trigger_dump(int cpu)
{ … }
static void uv_nmi_sync_exit(int master)
{ … }
static void uv_nmi_action_health(int cpu, struct pt_regs *regs, int master)
{ … }
static void uv_nmi_dump_state(int cpu, struct pt_regs *regs, int master)
{ … }
static void uv_nmi_touch_watchdogs(void)
{ … }
static void uv_nmi_kdump(int cpu, int main, struct pt_regs *regs)
{ … }
#ifdef CONFIG_KGDB
#ifdef CONFIG_KGDB_KDB
static inline int uv_nmi_kdb_reason(void)
{ … }
#else
static inline int uv_nmi_kdb_reason(void)
{
if (uv_nmi_action == nmi_act_kgdb)
return 0;
pr_err("UV: NMI error: KDB is not enabled in this kernel\n");
return -1;
}
#endif
static void uv_call_kgdb_kdb(int cpu, struct pt_regs *regs, int master)
{ … }
#else
static inline void uv_call_kgdb_kdb(int cpu, struct pt_regs *regs, int master)
{
pr_err("UV: NMI error: KGDB is not enabled in this kernel\n");
}
#endif
static int uv_handle_nmi(unsigned int reason, struct pt_regs *regs)
{ … }
static int uv_handle_nmi_ping(unsigned int reason, struct pt_regs *regs)
{ … }
static void uv_register_nmi_notifier(void)
{ … }
void uv_nmi_init(void)
{ … }
static void __init uv_nmi_setup_common(bool hubbed)
{ … }
void __init uv_nmi_setup(void)
{ … }
void __init uv_nmi_setup_hubless(void)
{ … }