From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Egger Subject: [PATCH 11/18] Nested Virtualization: cpuid Date: Thu, 15 Apr 2010 14:35:49 +0200 Message-ID: <201004151435.50232.Christoph.Egger@amd.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Boundary-00=_mgwxLkTKLtN19lC" 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 --Boundary-00=_mgwxLkTKLtN19lC Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Signed-off-by: Christoph Egger -- ---to satisfy European Law for business letters: Advanced Micro Devices GmbH Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen Geschaeftsfuehrer: Andrew Bowd, Thomas M. McCoy, Giuliano Meroni Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632 --Boundary-00=_mgwxLkTKLtN19lC Content-Type: text/x-diff; charset="iso 8859-15"; name="xen_nh11_cpuid.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="xen_nh11_cpuid.diff" # HG changeset patch # User cegger # Date 1271330304 -7200 Pass cpuid feature bits to guest diff -r e905f1d81e63 -r 01758c6195f4 xen/arch/x86/hvm/hvm.c --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -1970,12 +1970,38 @@ void hvm_cpuid(unsigned int input, unsig } } break; + case 0x80000000: + if ( !nestedhvm_enabled(v->domain) ) + break; + if (*eax < 0x8000000a) + *eax = 0x8000000a; + break; case 0x80000001: /* We expose RDTSCP feature to guest only when tsc_mode == TSC_MODE_DEFAULT and host_tsc_is_safe() returns 1 */ if ( v->domain->arch.tsc_mode != TSC_MODE_DEFAULT || !host_tsc_is_safe() ) *edx &= ~bitmaskof(X86_FEATURE_RDTSCP); + + /* Don't expose SVM feature bit when host does not run with + * nested paging enabled. This check is needed as long as + * we don't support shadow-on-shadow. + */ + if ( !paging_mode_hap(v->domain) ) + *ecx &= ~bitmaskof(X86_FEATURE_SVME); + + /* Don't expose SVM feature bit when nestedhvm is disabled. */ + if ( !nestedhvm_enabled(v->domain) ) + *ecx &= ~bitmaskof(X86_FEATURE_SVME); + break; + case 0x8000000a: + /* Don't expose SVM feature bits when nestedhvm is disabled. */ + if ( !nestedhvm_enabled(v->domain) ) { + *eax = *ebx = *ecx = *edx = 0; + break; + } + + hvm_nestedhvm_vcpu_features(v, eax, ebx, ecx, edx); break; } } --Boundary-00=_mgwxLkTKLtN19lC 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 --Boundary-00=_mgwxLkTKLtN19lC--