uint32_t hyperv_vendor_id[3];
uint32_t hyperv_interface_id[4];
uint32_t hyperv_limits[3];
- uint32_t hyperv_nested[4];
bool hyperv_enforce_cpuid;
uint32_t hyperv_ver_id_build;
uint16_t hyperv_ver_id_major;
|| env->user_tsc_khz;
}
+#define DEFAULT_EVMCS_VERSION ((1 << 8) | 1)
+
static struct {
const char *desc;
struct {
}
}
+ /* HV_CPUID_NESTED_FEATURES.EAX also encodes the supported eVMCS range */
+ if (func == HV_CPUID_NESTED_FEATURES && reg == R_EAX) {
+ if (hyperv_feat_enabled(cpu, HYPERV_FEAT_EVMCS)) {
+ r |= DEFAULT_EVMCS_VERSION;
+ }
+ }
+
return r;
}
struct kvm_cpuid_entry2 *c;
uint32_t signature[3];
uint32_t cpuid_i = 0, max_cpuid_leaf = 0;
+ uint32_t nested_eax =
+ hv_build_cpuid_leaf(cs, HV_CPUID_NESTED_FEATURES, R_EAX);
- max_cpuid_leaf = HV_CPUID_IMPLEMENT_LIMITS;
- if (hyperv_feat_enabled(cpu, HYPERV_FEAT_EVMCS)) {
- max_cpuid_leaf = MAX(max_cpuid_leaf, HV_CPUID_NESTED_FEATURES);
- }
+ max_cpuid_leaf = nested_eax ? HV_CPUID_NESTED_FEATURES :
+ HV_CPUID_IMPLEMENT_LIMITS;
if (hyperv_feat_enabled(cpu, HYPERV_FEAT_SYNDBG)) {
max_cpuid_leaf =
c->ecx = cpu->hyperv_limits[1];
c->edx = cpu->hyperv_limits[2];
- if (hyperv_feat_enabled(cpu, HYPERV_FEAT_EVMCS)) {
+ if (nested_eax) {
uint32_t function;
/* Create zeroed 0x40000006..0x40000009 leaves */
c = &cpuid_ent[cpuid_i++];
c->function = HV_CPUID_NESTED_FEATURES;
- c->eax = cpu->hyperv_nested[0];
+ c->eax = nested_eax;
}
if (hyperv_feat_enabled(cpu, HYPERV_FEAT_SYNDBG)) {
(max_version <= max_supported_version);
}
-#define DEFAULT_EVMCS_VERSION ((1 << 8) | 1)
-
static int hyperv_init_vcpu(X86CPU *cpu)
{
CPUState *cs = CPU(cpu);
supported_evmcs_version >> 8);
return -ENOTSUP;
}
-
- cpu->hyperv_nested[0] = evmcs_version;
}
if (cpu->hyperv_enforce_cpuid) {