From: "Jan Beulich" Subject: [PATCH] x86: fix boot time APIC mode detection Date: Thu, 23 May 2013 08:07:42 +0100 Message-ID: <519DDC5E02000078000D859F@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part4A7A8B2E.1__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Andrew Cooper , Keir Fraser List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part4A7A8B2E.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline current_cpu_data becomes valid only relatively late in the boot process, so looking there for a particular feature early in the game would generally give the appearance of the feature being unavailable. Getting this wrong means that at kexec time the system would get returned to xAPIC mode, causing disconnect_bsp_APIC() to try to access the APIC page, which on systems with x2APIC pre-enabled will never get set up. Signed-off-by: Jan Beulich --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -1474,7 +1474,7 @@ enum apic_mode current_local_apic_mode(v =20 /* Reading EXTD bit from the MSR is only valid if CPUID * says so, else reserved */ - if ( cpu_has(¤t_cpu_data, X86_FEATURE_X2APIC) + if ( boot_cpu_has(X86_FEATURE_X2APIC) && (msr_contents & MSR_IA32_APICBASE_EXTD) ) return APIC_MODE_X2APIC; =20 --=__Part4A7A8B2E.1__= Content-Type: text/plain; name="x86-boot-APIC-mode.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-boot-APIC-mode.patch" x86: fix boot time APIC mode detection=0A=0Acurrent_cpu_data becomes valid = only relatively late in the boot=0Aprocess, so looking there for a = particular feature early in the game=0Awould generally give the appearance = of the feature being unavailable.=0A=0AGetting this wrong means that at = kexec time the system would get=0Areturned to xAPIC mode, causing = disconnect_bsp_APIC() to try to access=0Athe APIC page, which on systems = with x2APIC pre-enabled will never get=0Aset up.=0A=0ASigned-off-by: Jan = Beulich =0A=0A--- a/xen/arch/x86/apic.c=0A+++ b/xen/arch= /x86/apic.c=0A@@ -1474,7 +1474,7 @@ enum apic_mode current_local_apic_mode(= v=0A =0A /* Reading EXTD bit from the MSR is only valid if CPUID=0A = * says so, else reserved */=0A- if ( cpu_has(¤t_cpu_data, = X86_FEATURE_X2APIC)=0A+ if ( boot_cpu_has(X86_FEATURE_X2APIC)=0A = && (msr_contents & MSR_IA32_APICBASE_EXTD) )=0A return APIC_MODE_= X2APIC;=0A =0A --=__Part4A7A8B2E.1__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part4A7A8B2E.1__=--