From: "Jan Beulich" Subject: [PATCH 1/7] x86: eliminate old-CPU support bits Date: Thu, 31 Mar 2011 16:54:46 +0100 Message-ID: <4D94BFE602000078000396B4@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartC4E810D6.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" 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. --=__PartC4E810D6.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Some pieces can be removed altogether, others are only of possible use in 32-bit builds. Signed-off-by: Jan Beulich --- a/xen/arch/x86/cpu/common.c +++ b/xen/arch/x86/cpu/common.c @@ -15,15 +15,8 @@ =20 #include "cpu.h" =20 -#define tsc_disable 0 -#define disable_pse 0 - static int cachesize_override __cpuinitdata =3D -1; size_param("cachesize", cachesize_override); -static bool_t __cpuinitdata disable_x86_fxsr; -boolean_param("nofxsr", disable_x86_fxsr); -static bool_t __cpuinitdata disable_x86_serial_nr; -boolean_param("noserialnumber", disable_x86_serial_nr); =20 static bool_t __cpuinitdata use_xsave; boolean_param("xsave", use_xsave); @@ -191,28 +184,6 @@ static void __cpuinit get_cpu_vendor(str } =20 =20 -/* Standard macro to see if a specific flag is changeable */ -static inline int flag_is_changeable_p(unsigned long flag) -{ - unsigned long f1, f2; - - asm("pushf\n\t" - "pushf\n\t" - "pop %0\n\t" - "mov %0,%1\n\t" - "xor %2,%0\n\t" - "push %0\n\t" - "popf\n\t" - "pushf\n\t" - "pop %0\n\t" - "popf\n\t" - : "=3D&r" (f1), "=3D&r" (f2) - : "ir" (flag)); - - return ((f1^f2) & flag) !=3D 0; -} - - /* Do minimum CPU detection early. Fields really needed: vendor, cpuid_level, family, model, mask, cache = alignment. The others are not touched to avoid unwanted side effects. @@ -302,6 +273,14 @@ void __cpuinit generic_identify(struct c #endif } =20 +#ifdef __i386__ + +static bool_t __cpuinitdata disable_x86_fxsr; +boolean_param("nofxsr", disable_x86_fxsr); + +static bool_t __cpuinitdata disable_x86_serial_nr; +boolean_param("noserialnumber", disable_x86_serial_nr); + static void __cpuinit squash_the_stupid_serial_number(struct cpuinfo_x86 = *c) { if (cpu_has(c, X86_FEATURE_PN) && disable_x86_serial_nr ) { @@ -317,6 +296,7 @@ static void __cpuinit squash_the_stupid_ } } =20 +#endif =20 /* * This does the hard work of actually picking apart the CPU stuff... @@ -376,26 +356,24 @@ void __cpuinit identify_cpu(struct cpuin if ( cpu_has_xsave ) xsave_init(); =20 - /* Disable the PN if appropriate */ - squash_the_stupid_serial_number(c); - /* * The vendor-specific functions might have changed features. Now * we do "generic changes." */ =20 - /* TSC disabled? */ - if ( tsc_disable ) - clear_bit(X86_FEATURE_TSC, c->x86_capability); +#ifdef __i386__ + /* Disable the PN if appropriate */ + squash_the_stupid_serial_number(c); =20 /* FXSR disabled? */ if (disable_x86_fxsr) { clear_bit(X86_FEATURE_FXSR, c->x86_capability); - clear_bit(X86_FEATURE_XMM, c->x86_capability); + if (!cpu_has_xsave) { + clear_bit(X86_FEATURE_XMM, c->x86_capability); + clear_bit(X86_FEATURE_AES, c->x86_capability); + } } - - if (disable_pse) - clear_bit(X86_FEATURE_PSE, c->x86_capability); +#endif =20 for (i =3D 0 ; i < NCAPINTS ; ++i) c->x86_capability[i] &=3D ~cleared_caps[i]; --- a/xen/include/asm-x86/cpufeature.h +++ b/xen/include/asm-x86/cpufeature.h @@ -101,6 +101,7 @@ #define X86_FEATURE_X2APIC (4*32+21) /* Extended xAPIC */ #define X86_FEATURE_POPCNT (4*32+23) /* POPCNT instruction */ #define X86_FEATURE_TSC_DEADLINE (4*32+24) /* "tdt" TSC Deadline Timer */ +#define X86_FEATURE_AES (4*32+25) /* AES instructions */ #define X86_FEATURE_XSAVE (4*32+26) /* XSAVE/XRSTOR/XSETBV/XGETBV */ #define X86_FEATURE_OSXSAVE (4*32+27) /* OSXSAVE */ #define X86_FEATURE_AVX (4*32+28) /* Advanced Vector Extensions */ --=__PartC4E810D6.0__= Content-Type: text/plain; name="x86-remove-pre-x86_64.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-remove-pre-x86_64.patch" Some pieces can be removed altogether, others are only of possible = use=0Ain 32-bit builds.=0A=0ASigned-off-by: Jan Beulich =0A=0A--- a/xen/arch/x86/cpu/common.c=0A+++ b/xen/arch/x86/cpu/common.c= =0A@@ -15,15 +15,8 @@=0A =0A #include "cpu.h"=0A =0A-#define tsc_disable = 0=0A-#define disable_pse 0=0A-=0A static int cachesize_override __cpuinitda= ta =3D -1;=0A size_param("cachesize", cachesize_override);=0A-static = bool_t __cpuinitdata disable_x86_fxsr;=0A-boolean_param("nofxsr", = disable_x86_fxsr);=0A-static bool_t __cpuinitdata disable_x86_serial_nr;=0A= -boolean_param("noserialnumber", disable_x86_serial_nr);=0A =0A static = bool_t __cpuinitdata use_xsave;=0A boolean_param("xsave", use_xsave);=0A@@ = -191,28 +184,6 @@ static void __cpuinit get_cpu_vendor(str=0A }=0A =0A = =0A-/* Standard macro to see if a specific flag is changeable */=0A-static = inline int flag_is_changeable_p(unsigned long flag)=0A-{=0A- unsigned = long f1, f2;=0A-=0A- asm("pushf\n\t"=0A- "pushf\n\t"=0A- = "pop %0\n\t"=0A- "mov %0,%1\n\t"=0A- "xor %2,%0\n\t"=0A- = "push %0\n\t"=0A- "popf\n\t"=0A- "pushf\n\t"=0A- = "pop %0\n\t"=0A- "popf\n\t"=0A- : "=3D&r" (f1), = "=3D&r" (f2)=0A- : "ir" (flag));=0A-=0A- return ((f1^f2) & = flag) !=3D 0;=0A-}=0A-=0A-=0A /* Do minimum CPU detection early.=0A = Fields really needed: vendor, cpuid_level, family, model, mask, cache = alignment.=0A The others are not touched to avoid unwanted side = effects.=0A@@ -302,6 +273,14 @@ void __cpuinit generic_identify(struct = c=0A #endif=0A }=0A =0A+#ifdef __i386__=0A+=0A+static bool_t __cpuinitdata = disable_x86_fxsr;=0A+boolean_param("nofxsr", disable_x86_fxsr);=0A+=0A+stat= ic bool_t __cpuinitdata disable_x86_serial_nr;=0A+boolean_param("noserialnu= mber", disable_x86_serial_nr);=0A+=0A static void __cpuinit squash_the_stup= id_serial_number(struct cpuinfo_x86 *c)=0A {=0A if (cpu_has(c, = X86_FEATURE_PN) && disable_x86_serial_nr ) {=0A@@ -317,6 +296,7 @@ static = void __cpuinit squash_the_stupid_=0A }=0A }=0A =0A+#endif=0A =0A /*=0A = * This does the hard work of actually picking apart the CPU stuff...=0A@@ = -376,26 +356,24 @@ void __cpuinit identify_cpu(struct cpuin=0A if ( = cpu_has_xsave )=0A xsave_init();=0A =0A- /* Disable the PN = if appropriate */=0A- squash_the_stupid_serial_number(c);=0A-=0A = /*=0A * The vendor-specific functions might have changed features. = Now=0A * we do "generic changes."=0A */=0A =0A- /* TSC disabled? = */=0A- if ( tsc_disable )=0A- clear_bit(X86_FEATURE_TSC, = c->x86_capability);=0A+#ifdef __i386__=0A+ /* Disable the PN if = appropriate */=0A+ squash_the_stupid_serial_number(c);=0A =0A /* = FXSR disabled? */=0A if (disable_x86_fxsr) {=0A clear_bit(X= 86_FEATURE_FXSR, c->x86_capability);=0A- clear_bit(X86_FEATU= RE_XMM, c->x86_capability);=0A+ if (!cpu_has_xsave) {=0A+ = clear_bit(X86_FEATURE_XMM, c->x86_capability);=0A+ = clear_bit(X86_FEATURE_AES, c->x86_capability);=0A+ }=0A = }=0A-=0A- if (disable_pse)=0A- clear_bit(X86_FEATURE_PSE, = c->x86_capability);=0A+#endif=0A =0A for (i =3D 0 ; i < NCAPINTS ; = ++i)=0A c->x86_capability[i] &=3D ~cleared_caps[i];=0A--- = a/xen/include/asm-x86/cpufeature.h=0A+++ b/xen/include/asm-x86/cpufeature.h= =0A@@ -101,6 +101,7 @@=0A #define X86_FEATURE_X2APIC (4*32+21) /* = Extended xAPIC */=0A #define X86_FEATURE_POPCNT (4*32+23) /* POPCNT = instruction */=0A #define X86_FEATURE_TSC_DEADLINE (4*32+24) /* "tdt" TSC = Deadline Timer */=0A+#define X86_FEATURE_AES (4*32+25) /* AES = instructions */=0A #define X86_FEATURE_XSAVE (4*32+26) /* XSAVE/XRSTOR/X= SETBV/XGETBV */=0A #define X86_FEATURE_OSXSAVE (4*32+27) /* OSXSAVE */=0A = #define X86_FEATURE_AVX (4*32+28) /* Advanced Vector Extensions = */=0A --=__PartC4E810D6.0__= 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.xensource.com http://lists.xensource.com/xen-devel --=__PartC4E810D6.0__=--