aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/xen/enlighten.c22
-rw-r--r--include/xen/interface/nmi.h51
2 files changed, 72 insertions, 1 deletions
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index fac5e4f9607c..115016347806 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -40,6 +40,7 @@
40#include <xen/interface/physdev.h> 40#include <xen/interface/physdev.h>
41#include <xen/interface/vcpu.h> 41#include <xen/interface/vcpu.h>
42#include <xen/interface/memory.h> 42#include <xen/interface/memory.h>
43#include <xen/interface/nmi.h>
43#include <xen/interface/xen-mca.h> 44#include <xen/interface/xen-mca.h>
44#include <xen/features.h> 45#include <xen/features.h>
45#include <xen/page.h> 46#include <xen/page.h>
@@ -66,6 +67,7 @@
66#include <asm/reboot.h> 67#include <asm/reboot.h>
67#include <asm/stackprotector.h> 68#include <asm/stackprotector.h>
68#include <asm/hypervisor.h> 69#include <asm/hypervisor.h>
70#include <asm/mach_traps.h>
69#include <asm/mwait.h> 71#include <asm/mwait.h>
70#include <asm/pci_x86.h> 72#include <asm/pci_x86.h>
71#include <asm/pat.h> 73#include <asm/pat.h>
@@ -1357,6 +1359,21 @@ static const struct machine_ops xen_machine_ops __initconst = {
1357 .emergency_restart = xen_emergency_restart, 1359 .emergency_restart = xen_emergency_restart,
1358}; 1360};
1359 1361
1362static unsigned char xen_get_nmi_reason(void)
1363{
1364 unsigned char reason = 0;
1365
1366 /* Construct a value which looks like it came from port 0x61. */
1367 if (test_bit(_XEN_NMIREASON_io_error,
1368 &HYPERVISOR_shared_info->arch.nmi_reason))
1369 reason |= NMI_REASON_IOCHK;
1370 if (test_bit(_XEN_NMIREASON_pci_serr,
1371 &HYPERVISOR_shared_info->arch.nmi_reason))
1372 reason |= NMI_REASON_SERR;
1373
1374 return reason;
1375}
1376
1360static void __init xen_boot_params_init_edd(void) 1377static void __init xen_boot_params_init_edd(void)
1361{ 1378{
1362#if IS_ENABLED(CONFIG_EDD) 1379#if IS_ENABLED(CONFIG_EDD)
@@ -1541,9 +1558,12 @@ asmlinkage __visible void __init xen_start_kernel(void)
1541 pv_info = xen_info; 1558 pv_info = xen_info;
1542 pv_init_ops = xen_init_ops; 1559 pv_init_ops = xen_init_ops;
1543 pv_apic_ops = xen_apic_ops; 1560 pv_apic_ops = xen_apic_ops;
1544 if (!xen_pvh_domain()) 1561 if (!xen_pvh_domain()) {
1545 pv_cpu_ops = xen_cpu_ops; 1562 pv_cpu_ops = xen_cpu_ops;
1546 1563
1564 x86_platform.get_nmi_reason = xen_get_nmi_reason;
1565 }
1566
1547 if (xen_feature(XENFEAT_auto_translated_physmap)) 1567 if (xen_feature(XENFEAT_auto_translated_physmap))
1548 x86_init.resources.memory_setup = xen_auto_xlated_memory_setup; 1568 x86_init.resources.memory_setup = xen_auto_xlated_memory_setup;
1549 else 1569 else
diff --git a/include/xen/interface/nmi.h b/include/xen/interface/nmi.h
new file mode 100644
index 000000000000..b47d9d06fade
--- /dev/null
+++ b/include/xen/interface/nmi.h
@@ -0,0 +1,51 @@
1/******************************************************************************
2 * nmi.h
3 *
4 * NMI callback registration and reason codes.
5 *
6 * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
7 */
8
9#ifndef __XEN_PUBLIC_NMI_H__
10#define __XEN_PUBLIC_NMI_H__
11
12#include <xen/interface/xen.h>
13
14/*
15 * NMI reason codes:
16 * Currently these are x86-specific, stored in arch_shared_info.nmi_reason.
17 */
18 /* I/O-check error reported via ISA port 0x61, bit 6. */
19#define _XEN_NMIREASON_io_error 0
20#define XEN_NMIREASON_io_error (1UL << _XEN_NMIREASON_io_error)
21 /* PCI SERR reported via ISA port 0x61, bit 7. */
22#define _XEN_NMIREASON_pci_serr 1
23#define XEN_NMIREASON_pci_serr (1UL << _XEN_NMIREASON_pci_serr)
24 /* Unknown hardware-generated NMI. */
25#define _XEN_NMIREASON_unknown 2
26#define XEN_NMIREASON_unknown (1UL << _XEN_NMIREASON_unknown)
27
28/*
29 * long nmi_op(unsigned int cmd, void *arg)
30 * NB. All ops return zero on success, else a negative error code.
31 */
32
33/*
34 * Register NMI callback for this (calling) VCPU. Currently this only makes
35 * sense for domain 0, vcpu 0. All other callers will be returned EINVAL.
36 * arg == pointer to xennmi_callback structure.
37 */
38#define XENNMI_register_callback 0
39struct xennmi_callback {
40 unsigned long handler_address;
41 unsigned long pad;
42};
43DEFINE_GUEST_HANDLE_STRUCT(xennmi_callback);
44
45/*
46 * Deregister NMI callback for this (calling) VCPU.
47 * arg == NULL.
48 */
49#define XENNMI_unregister_callback 1
50
51#endif /* __XEN_PUBLIC_NMI_H__ */