aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/apic.c
diff options
context:
space:
mode:
authorAndrew Cooper <andrew.cooper3@citrix.com>2011-06-14 12:47:45 +0100
committerAndrew Cooper <andrew.cooper3@citrix.com>2011-06-14 12:47:45 +0100
commit512f16bf73e62e6198f368d1549a936089a881e4 (patch)
tree6a553719750dc67f5dfb9836bb594ba3937a1f4f /xen/arch/x86/apic.c
parent046b947fb09a1fed471b5af716467bbc03f8783b (diff)
downloadxen-512f16bf73e62e6198f368d1549a936089a881e4.tar.gz
xen-512f16bf73e62e6198f368d1549a936089a881e4.tar.bz2
xen-512f16bf73e62e6198f368d1549a936089a881e4.zip
x86/apic: fix potential Protection Fault during shutdown
This is a rare case, but if the BIOS is set to uniprocessor, and Xen is booted with 'lapic x2apic', Xen will switch into x2apic mode, which will cause a protection fault when disabling the local APIC. This leads to a general protection fault as this code is also in the fault handler. When x2apic mode is enabled, the only tranlsation which does not result in a protection fault is to clear both the EN and EXTD bits, which is safe to do in all cases, even if you are in xapic mode rather than x2apic mode. The linux code from which this is derrived is protected by an if ( ! x2apic_mode ...) clause which is how they get away with it. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Jan Beulich <jbeulich@novell.com>
Diffstat (limited to 'xen/arch/x86/apic.c')
-rw-r--r--xen/arch/x86/apic.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index af335607cd..6f1272fb22 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -340,7 +340,8 @@ void disable_local_APIC(void)
if (enabled_via_apicbase) {
uint64_t msr_content;
rdmsrl(MSR_IA32_APICBASE, msr_content);
- wrmsrl(MSR_IA32_APICBASE, msr_content & ~MSR_IA32_APICBASE_ENABLE);
+ wrmsrl(MSR_IA32_APICBASE, msr_content &
+ ~(MSR_IA32_APICBASE_ENABLE|MSR_IA32_APICBASE_EXTD));
}
}