|
@@ -238,6 +238,7 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx,
|
|
static __init void xen_init_cpuid_mask(void)
|
|
static __init void xen_init_cpuid_mask(void)
|
|
{
|
|
{
|
|
unsigned int ax, bx, cx, dx;
|
|
unsigned int ax, bx, cx, dx;
|
|
|
|
+ unsigned int xsave_mask;
|
|
|
|
|
|
cpuid_leaf1_edx_mask =
|
|
cpuid_leaf1_edx_mask =
|
|
~((1 << X86_FEATURE_MCE) | /* disable MCE */
|
|
~((1 << X86_FEATURE_MCE) | /* disable MCE */
|
|
@@ -249,24 +250,16 @@ static __init void xen_init_cpuid_mask(void)
|
|
cpuid_leaf1_edx_mask &=
|
|
cpuid_leaf1_edx_mask &=
|
|
~((1 << X86_FEATURE_APIC) | /* disable local APIC */
|
|
~((1 << X86_FEATURE_APIC) | /* disable local APIC */
|
|
(1 << X86_FEATURE_ACPI)); /* disable ACPI */
|
|
(1 << X86_FEATURE_ACPI)); /* disable ACPI */
|
|
-
|
|
|
|
ax = 1;
|
|
ax = 1;
|
|
- cx = 0;
|
|
|
|
xen_cpuid(&ax, &bx, &cx, &dx);
|
|
xen_cpuid(&ax, &bx, &cx, &dx);
|
|
|
|
|
|
- /* cpuid claims we support xsave; try enabling it to see what happens */
|
|
|
|
- if (cx & (1 << (X86_FEATURE_XSAVE % 32))) {
|
|
|
|
- unsigned long cr4;
|
|
|
|
-
|
|
|
|
- set_in_cr4(X86_CR4_OSXSAVE);
|
|
|
|
-
|
|
|
|
- cr4 = read_cr4();
|
|
|
|
|
|
+ xsave_mask =
|
|
|
|
+ (1 << (X86_FEATURE_XSAVE % 32)) |
|
|
|
|
+ (1 << (X86_FEATURE_OSXSAVE % 32));
|
|
|
|
|
|
- if ((cr4 & X86_CR4_OSXSAVE) == 0)
|
|
|
|
- cpuid_leaf1_ecx_mask &= ~(1 << (X86_FEATURE_XSAVE % 32));
|
|
|
|
-
|
|
|
|
- clear_in_cr4(X86_CR4_OSXSAVE);
|
|
|
|
- }
|
|
|
|
|
|
+ /* Xen will set CR4.OSXSAVE if supported and not disabled by force */
|
|
|
|
+ if ((cx & xsave_mask) != xsave_mask)
|
|
|
|
+ cpuid_leaf1_ecx_mask &= ~xsave_mask; /* disable XSAVE & OSXSAVE */
|
|
}
|
|
}
|
|
|
|
|
|
static void xen_set_debugreg(int reg, unsigned long val)
|
|
static void xen_set_debugreg(int reg, unsigned long val)
|