xen/20059-vmx-nmi-handling.patch

78 lines
2.8 KiB
Diff

# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1250696034 -3600
# Node ID 4af92eee8be497964912cda863c956691b3a3f89
# Parent 2d6c4cc6a2a9e48218fe31d443f8937a3a88bf3f
VMX: issue an NMI rather than just calling the NMI handler
when the VMEXIT code indicates that an NMI has been raised.
Otherwise we might hit a real NMI while in the handler.
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
xen-unstable changeset: 20059:76a65bf2aa4d
xen-unstable date: Fri Aug 14 10:58:32 2009 +0100
Index: xen-3.4.1-testing/xen/arch/x86/hvm/vmx/vmx.c
===================================================================
--- xen-3.4.1-testing.orig/xen/arch/x86/hvm/vmx/vmx.c
+++ xen-3.4.1-testing/xen/arch/x86/hvm/vmx/vmx.c
@@ -936,8 +936,6 @@ static void vmx_set_tsc_offset(struct vc
vmx_vmcs_exit(v);
}
-void do_nmi(struct cpu_user_regs *);
-
static void vmx_init_hypercall_page(struct domain *d, void *hypercall_page)
{
char *p;
@@ -2416,7 +2414,7 @@ asmlinkage void vmx_vmexit_handler(struc
(X86_EVENTTYPE_NMI << 8) )
goto exit_and_crash;
HVMTRACE_0D(NMI);
- do_nmi(regs); /* Real NMI, vector 2: normal processing. */
+ self_nmi(); /* Real NMI, vector 2: normal processing. */
break;
case TRAP_machine_check:
HVMTRACE_0D(MCE);
Index: xen-3.4.1-testing/xen/arch/x86/nmi.c
===================================================================
--- xen-3.4.1-testing.orig/xen/arch/x86/nmi.c
+++ xen-3.4.1-testing/xen/arch/x86/nmi.c
@@ -441,18 +441,21 @@ void nmi_watchdog_tick(struct cpu_user_r
* 8-3 and 8-4 in IA32 Reference Manual Volume 3. We send the IPI to
* our own APIC ID explicitly which is valid.
*/
-static void do_nmi_trigger(unsigned char key)
+void self_nmi(void)
{
u32 id = get_apic_id();
-
- printk("Triggering NMI on APIC ID %x\n", id);
-
local_irq_disable();
apic_wait_icr_idle();
apic_icr_write(APIC_DM_NMI | APIC_DEST_PHYSICAL, id);
local_irq_enable();
}
+static void do_nmi_trigger(unsigned char key)
+{
+ printk("Triggering NMI on APIC ID %x\n", get_apic_id());
+ self_nmi();
+}
+
static void do_nmi_stats(unsigned char key)
{
int i;
Index: xen-3.4.1-testing/xen/include/asm-x86/apic.h
===================================================================
--- xen-3.4.1-testing.orig/xen/include/asm-x86/apic.h
+++ xen-3.4.1-testing/xen/include/asm-x86/apic.h
@@ -196,6 +196,7 @@ extern void setup_secondary_APIC_clock (
extern void setup_apic_nmi_watchdog (void);
extern int reserve_lapic_nmi(void);
extern void release_lapic_nmi(void);
+extern void self_nmi(void);
extern void disable_timer_nmi_watchdog(void);
extern void enable_timer_nmi_watchdog(void);
extern void nmi_watchdog_tick (struct cpu_user_regs *regs);