[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] x86/kexec: fix kexec on systems which boot in x2apic mode



commit 77ffa26374370c1c9805f9596f37a44d412a7fdb
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Wed Jul 23 18:08:47 2014 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Jul 23 18:08:47 2014 +0200

    x86/kexec: fix kexec on systems which boot in x2apic mode
    
    Moving straight from fully disabled to x2apic mode is an illegal state
    transition, and causes an unconditional #GP fault.  Bounce through xapic 
mode
    to avoid the fault.
    
    In addition, avoid bouncing through the various apic modes if the mode is
    already correct.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/x86/apic.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 0e5e302..bbcc0a1 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -314,7 +314,7 @@ void disable_local_APIC(void)
                ~(MSR_IA32_APICBASE_ENABLE|MSR_IA32_APICBASE_EXTD));
     }
 
-    if ( kexecing )
+    if ( kexecing && (current_local_apic_mode() != apic_boot_mode) )
     {
         uint64_t msr_content;
         rdmsrl(MSR_IA32_APICBASE, msr_content);
@@ -330,7 +330,9 @@ void disable_local_APIC(void)
             wrmsrl(MSR_IA32_APICBASE, msr_content);
             break;
         case APIC_MODE_X2APIC:
-            msr_content |= (MSR_IA32_APICBASE_ENABLE|MSR_IA32_APICBASE_EXTD);
+            msr_content |= MSR_IA32_APICBASE_ENABLE;
+            wrmsrl(MSR_IA32_APICBASE, msr_content);
+            msr_content |= MSR_IA32_APICBASE_EXTD;
             wrmsrl(MSR_IA32_APICBASE, msr_content);
             break;
         default:
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.