# 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; } }