xcp-1.6-updates/xen-4.1.hg
changeset 23232:7ee4016eeb9f
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@intel.com>
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@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset: 23955:bbde1453cbd9
xen-unstable date: Thu Oct 13 15:58:55 2011 +0100
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@intel.com>
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@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset: 23955:bbde1453cbd9
xen-unstable date: Thu Oct 13 15:58:55 2011 +0100
author | Shan Haitao <haitao.shan@intel.com> |
---|---|
date | Wed Mar 07 07:55:10 2012 +0000 (2012-03-07) |
parents | 04d72f81775d |
children | 637eaa1421d1 |
files | xen/arch/x86/hvm/hvm.c xen/arch/x86/traps.c |
line diff
1.1 --- a/xen/arch/x86/hvm/hvm.c Thu Feb 23 10:37:13 2012 +0000 1.2 +++ b/xen/arch/x86/hvm/hvm.c Wed Mar 07 07:55:10 2012 +0000 1.3 @@ -2230,7 +2230,7 @@ void hvm_cpuid(unsigned int input, unsig 1.4 { 1.5 /* reset EBX to default value first */ 1.6 *ebx = XSAVE_AREA_MIN_SIZE; 1.7 - for ( sub_leaf = 2; sub_leaf < 64; sub_leaf++ ) 1.8 + for ( sub_leaf = 2; sub_leaf < 63; sub_leaf++ ) 1.9 { 1.10 if ( !(v->arch.xcr0 & (1ULL << sub_leaf)) ) 1.11 continue;
2.1 --- a/xen/arch/x86/traps.c Thu Feb 23 10:37:13 2012 +0000 2.2 +++ b/xen/arch/x86/traps.c Wed Mar 07 07:55:10 2012 +0000 2.3 @@ -734,8 +734,34 @@ static void pv_cpuid(struct cpu_user_reg 2.4 2.5 if ( current->domain->domain_id != 0 ) 2.6 { 2.7 + unsigned int cpuid_leaf = a, sub_leaf = c; 2.8 + 2.9 if ( !cpuid_hypervisor_leaves(a, c, &a, &b, &c, &d) ) 2.10 domain_cpuid(current->domain, a, c, &a, &b, &c, &d); 2.11 + 2.12 + switch ( cpuid_leaf ) 2.13 + { 2.14 + case 0xd: 2.15 + { 2.16 + unsigned int _eax, _ebx, _ecx, _edx; 2.17 + /* EBX value of main leaf 0 depends on enabled xsave features */ 2.18 + if ( sub_leaf == 0 && current->arch.xcr0 ) 2.19 + { 2.20 + /* reset EBX to default value first */ 2.21 + b = XSAVE_AREA_MIN_SIZE; 2.22 + for ( sub_leaf = 2; sub_leaf < 63; sub_leaf++ ) 2.23 + { 2.24 + if ( !(current->arch.xcr0 & (1ULL << sub_leaf)) ) 2.25 + continue; 2.26 + domain_cpuid(current->domain, cpuid_leaf, sub_leaf, 2.27 + &_eax, &_ebx, &_ecx, &_edx); 2.28 + if ( (_eax + _ebx) > b ) 2.29 + b = _eax + _ebx; 2.30 + } 2.31 + } 2.32 + break; 2.33 + } 2.34 + } 2.35 goto out; 2.36 } 2.37