[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-4.1-testing] Fix PV CPUID virtualization of XSave
# HG changeset patch # User Shan Haitao <haitao.shan@xxxxxxxxx> # Date 1331106910 0 # Node ID 7ee4016eeb9fb1c05f033e2b9da78cf5564c3e54 # Parent 04d72f81775d66d159f4f2aea7723bb1ad432564 Fix PV CPUID virtualization of XSave The patch will fix XSave CPUID virtualization for PV guests. The XSave area size returned by CPUID leaf D is changed dynamically depending on the XCR0. Tools/libxc only assigns a static value. The fix will adjust xsave area size during runtime. Note: This fix is already in HVM cpuid virtualization. And Dom0 is not affected, either. Signed-off-by: Shan Haitao <haitao.shan@xxxxxxxxx> xen-unstable changeset: 23853:b78235de5c64 xen-unstable date: Sun Sep 18 00:01:58 2011 +0100 x86: Further fixes for xsave leaf in pv_cpuid(). Signed-off-by: Shan Haitao <haitao.shan@xxxxxxxxx> Committed-by: Keir Fraser <keir@xxxxxxx> xen-unstable changeset: 23955:bbde1453cbd9 xen-unstable date: Thu Oct 13 15:58:55 2011 +0100 --- diff -r 04d72f81775d -r 7ee4016eeb9f xen/arch/x86/hvm/hvm.c --- a/xen/arch/x86/hvm/hvm.c Thu Feb 23 10:37:13 2012 +0000 +++ b/xen/arch/x86/hvm/hvm.c Wed Mar 07 07:55:10 2012 +0000 @@ -2230,7 +2230,7 @@ { /* reset EBX to default value first */ *ebx = XSAVE_AREA_MIN_SIZE; - for ( sub_leaf = 2; sub_leaf < 64; sub_leaf++ ) + for ( sub_leaf = 2; sub_leaf < 63; sub_leaf++ ) { if ( !(v->arch.xcr0 & (1ULL << sub_leaf)) ) continue; diff -r 04d72f81775d -r 7ee4016eeb9f xen/arch/x86/traps.c --- a/xen/arch/x86/traps.c Thu Feb 23 10:37:13 2012 +0000 +++ b/xen/arch/x86/traps.c Wed Mar 07 07:55:10 2012 +0000 @@ -734,8 +734,34 @@ if ( current->domain->domain_id != 0 ) { + unsigned int cpuid_leaf = a, sub_leaf = c; + if ( !cpuid_hypervisor_leaves(a, c, &a, &b, &c, &d) ) domain_cpuid(current->domain, a, c, &a, &b, &c, &d); + + switch ( cpuid_leaf ) + { + case 0xd: + { + unsigned int _eax, _ebx, _ecx, _edx; + /* EBX value of main leaf 0 depends on enabled xsave features */ + if ( sub_leaf == 0 && current->arch.xcr0 ) + { + /* reset EBX to default value first */ + b = XSAVE_AREA_MIN_SIZE; + for ( sub_leaf = 2; sub_leaf < 63; sub_leaf++ ) + { + if ( !(current->arch.xcr0 & (1ULL << sub_leaf)) ) + continue; + domain_cpuid(current->domain, cpuid_leaf, sub_leaf, + &_eax, &_ebx, &_ecx, &_edx); + if ( (_eax + _ebx) > b ) + b = _eax + _ebx; + } + } + break; + } + } goto out; } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |