Message ID | 1339754099-12023-1-git-send-email-stefan.bader@canonical.com |
---|---|
State | New |
Headers | show |
On 15.06.2012 14:09, Tim Gardner wrote:
>
Sorry I was not clear enough before. This of course replaces the old SAUCE
patch. I took the liberty of pushing that revert to master-next myself.
Leann can squash the old patch plus revert out of existence on next rebase.
-Stefan
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 On 06/15/2012 07:42 AM, Stefan Bader wrote: > On 15.06.2012 14:09, Tim Gardner wrote: >> > Sorry I was not clear enough before. This of course replaces the > old SAUCE patch. I took the liberty of pushing that revert to > master-next myself. > > Leann can squash the old patch plus revert out of existence on next > rebase. > > -Stefan > Done - rebased out of existence. - -- Tim Gardner tim.gardner@canonical.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBCgAGBQJP21X+AAoJED12yEX6FEfKi80P/RbFH5nzJNiJEOgcFd7ylAhC D9CEIbrdlix+7e21jLi1eY92dxst1CojChmZ6BORsdzyW0dTzjHn8Nyh6KTXabn9 ll1+bQRJnces7DJ6yqftr6j3P3ENWUa8sz+zx3VJVvoSnQ5OOSQEbg2J8OWb7tOH o1e4p5h1wZurTiNaXeNgPAQxI7NnO/CIJ+DYUUazg3Wb4LGq2EeJNTHo6LaUk0Fd MTOmZ+F+oFF5d8evVkJk0gPP863Bu0W3NsF1AEebCelNhEgnRStZ2GcG3qY20TrL DAzHM9U8MScMJ3suREkrOjQn1MCDih+ERE7k2jcnMJYVWhRttJLvqIz8dTUShPEv h+ENfpy7ce4CwZF/1XdQeRJXZzrL0cbENhW0I8EJLhdWr3sOqs2F8pbbQx/K7ogD B/m0RckZRKvgXlvCc/89Gmu+p06Mub+nlqeBCgp4n51NHCTpUhqqccueOKTVk9De S7Kn5DynjhmvLbAR1uxLWd8CKPnoblStX1Z3Rh2y3SufyS5IfccA13SIp+yOyeVc IcSecaFwifGfPuM+9fkofIsUWKTKKxyOiKMGVixeO55rnBWelmHLzoWfqdTa4gid iyWc7mU7x/uExtqvz3474hZ9v6HGPbjbyGlj/CNnW9rWY4SQx5AlNrtEWS0WT0jc s99GPpV8shGwHf7UnOnA =5vBQ -----END PGP SIGNATURE-----
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index e74df95..d465026 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -196,6 +196,18 @@ void xen_vcpu_restore(void) } } +/* + * Older (with no clear statement about what old means) Xen hypervisors + * will crash a PV guest that tries to store OSXSAVE into CR4. + * To prevent this, we force the feature bits related to this off in the + * xen cpuid call. This inline function serves as a centralized test + * on whether the quirk should be done. + */ +static inline needs_xsave_quirk(unsigned version) +{ + return (xen_pv_domain() && ((version >> 16) < 4)) ? 1 : 0; +} + static void __init xen_banner(void) { unsigned version = HYPERVISOR_xen_version(XENVER_version, NULL); @@ -207,6 +219,8 @@ static void __init xen_banner(void) printk(KERN_INFO "Xen version: %d.%d%s%s\n", version >> 16, version & 0xffff, extra.extraversion, xen_feature(XENFEAT_mmu_pt_update_preserve_ad) ? " (preserve-AD)" : ""); + if (needs_xsave_quirk(version)) + printk(KERN_INFO "Forcing xsave off due to Xen version.\n"); } static __read_mostly unsigned int cpuid_leaf1_edx_mask = ~0; @@ -329,6 +343,7 @@ static bool __init xen_check_mwait(void) } static void __init xen_init_cpuid_mask(void) { + unsigned version = HYPERVISOR_xen_version(XENVER_version, NULL); unsigned int ax, bx, cx, dx; unsigned int xsave_mask; @@ -351,7 +366,7 @@ static void __init xen_init_cpuid_mask(void) (1 << (X86_FEATURE_OSXSAVE % 32)); /* Xen will set CR4.OSXSAVE if supported and not disabled by force */ - if ((cx & xsave_mask) != xsave_mask) + if (((cx & xsave_mask) != xsave_mask) || needs_xsave_quirk(version)) cpuid_leaf1_ecx_mask &= ~xsave_mask; /* disable XSAVE & OSXSAVE */ if (xen_check_mwait()) cpuid_leaf1_ecx_set_mask = (1 << (X86_FEATURE_MWAIT % 32));