Print this page
10597 would like a way to set NMI behavior at boot
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Andy Fiddaman <andy@omniosce.org>
@@ -21,11 +21,11 @@
/*
* Copyright (c) 2012 Gary Mills
*
* Copyright (c) 1993, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011 by Delphix. All rights reserved.
- * Copyright 2018 Joyent, Inc.
+ * Copyright 2019, Joyent, Inc.
*/
/*
* Copyright (c) 2010, Intel Corporation.
* All rights reserved.
*/
@@ -59,10 +59,12 @@
#include <sys/boot_console.h>
#include <sys/kdi_machimpl.h>
#include <sys/archsystm.h>
#include <sys/promif.h>
#include <sys/pci_cfgspace.h>
+#include <sys/apic.h>
+#include <sys/apic_common.h>
#include <sys/bootvfs.h>
#include <sys/tsc.h>
#ifdef __xpv
#include <sys/hypervisor.h>
#else
@@ -77,10 +79,12 @@
extern uint32_t cpuid_feature_ecx_include;
extern uint32_t cpuid_feature_ecx_exclude;
extern uint32_t cpuid_feature_edx_include;
extern uint32_t cpuid_feature_edx_exclude;
+nmi_action_t nmi_action = NMI_ACTION_UNSET;
+
/*
* Set console mode
*/
static void
set_console_mode(uint8_t val)
@@ -101,10 +105,11 @@
*/
void
mlsetup(struct regs *rp)
{
u_longlong_t prop_value;
+ char prop_str[BP_MAX_STRLEN];
extern struct classfuncs sys_classfuncs;
extern disp_t cpu0_disp;
extern char t0stack[];
extern int post_fastreboot;
extern uint64_t plat_dr_options;
@@ -147,10 +152,23 @@
cpuid_feature_edx_exclude = 0;
else
cpuid_feature_edx_exclude = (uint32_t)prop_value;
#if !defined(__xpv)
+ if (bootprop_getstr("nmi", prop_str, sizeof (prop_str)) == 0) {
+ if (strcmp(prop_str, "ignore") == 0) {
+ nmi_action = NMI_ACTION_IGNORE;
+ } else if (strcmp(prop_str, "panic") == 0) {
+ nmi_action = NMI_ACTION_PANIC;
+ } else if (strcmp(prop_str, "kmdb") == 0) {
+ nmi_action = NMI_ACTION_KMDB;
+ } else {
+ prom_printf("unix: ignoring unknown nmi=%s\n",
+ prop_str);
+ }
+ }
+
/*
* Check to see if KPTI has been explicitly enabled or disabled.
* We have to check this before init_desctbls().
*/
if (bootprop_getval("kpti", &prop_value) == 0) {