aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/xen
diff options
context:
space:
mode:
authorJan Beulich <JBeulich@suse.com>2015-01-13 02:40:05 -0500
committerDavid Vrabel <david.vrabel@citrix.com>2015-01-13 04:39:50 -0500
commitf221b04fe07eb56c39935e31bb8e9ddacc00612f (patch)
treea0ef5e1a8124bb0b5a85e81bdce67b108dc28ec6 /arch/x86/xen
parent9a17ad7f3db17db0c6375de96672f16ab1aa51ae (diff)
x86/xen: properly retrieve NMI reason
Using the native code here can't work properly, as the hypervisor would normally have cleared the two reason bits by the time Dom0 gets to see the NMI (if passed to it at all). There's a shared info field for this, and there's an existing hook to use - just fit the two together. This is particularly relevant so that NMIs intended to be handled by APEI / GHES actually make it to the respective handler. Note that the hook can (and should) be used irrespective of whether being in Dom0, as accessing port 0x61 in a DomU would be even worse, while the shared info field would just hold zero all the time. Note further that hardware NMI handling for PVH doesn't currently work anyway due to missing code in the hypervisor (but it is expected to work the native rather than the PV way). Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Diffstat (limited to 'arch/x86/xen')
-rw-r--r--arch/x86/xen/enlighten.c22
1 files changed, 21 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