From: Christoph Egger Subject: [PATCH 8/15] Nested Virtualization: cpuid Date: Thu, 3 Jun 2010 18:14:52 +0200 Message-ID: <201006031814.52319.Christoph.Egger@amd.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Boundary-00=_8T9BMPFQtFcDdkm" 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=_8T9BMPFQtFcDdkm 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 Einsteinring 24, 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=_8T9BMPFQtFcDdkm Content-Type: text/x-diff; charset="iso 8859-15"; name="xen_nh08_cpuid.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="xen_nh08_cpuid.diff" # HG changeset patch # User cegger # Date 1275382029 -7200 Pass cpuid feature bits to guest diff -r 06a332fd936d -r c3ca485ecfbe xen/arch/x86/hvm/hvm.c --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -2021,12 +2021,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=_8T9BMPFQtFcDdkm 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=_8T9BMPFQtFcDdkm--