diff options
author | Vitaly Kuznetsov <vkuznets@redhat.com> | 2020-11-19 11:32:17 +0100 |
---|---|---|
committer | Eduardo Habkost <ehabkost@redhat.com> | 2020-12-16 14:07:33 -0500 |
commit | 088567713f6ea39f25f810cc51b92112bf8d952c (patch) | |
tree | 51824117f2d8262f4128cee4f2e503b70be7dcfe /target/i386/kvm | |
parent | 0c36af8ce86df663bcbb7aba6466645d08f29bbf (diff) |
i386: move hyperv_vendor_id initialization to x86_cpu_realizefn()
As a preparation to expanding Hyper-V CPU features early, move
hyperv_vendor_id initialization to x86_cpu_realizefn(). Introduce
x86_cpu_hyperv_realize() to not not pollute x86_cpu_realizefn()
itself.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20201119103221.1665171-2-vkuznets@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'target/i386/kvm')
-rw-r--r-- | target/i386/kvm/kvm.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index bcfa4b03e0..6a5d91e39f 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -1208,6 +1208,13 @@ static int hyperv_handle_properties(CPUState *cs, memcpy(cpuid_ent, &cpuid->entries[0], cpuid->nent * sizeof(cpuid->entries[0])); + c = cpuid_find_entry(cpuid, HV_CPUID_VENDOR_AND_MAX_FUNCTIONS, 0); + if (c) { + cpu->hyperv_vendor_id[0] = c->ebx; + cpu->hyperv_vendor_id[1] = c->ecx; + cpu->hyperv_vendor_id[2] = c->edx; + } + c = cpuid_find_entry(cpuid, HV_CPUID_FEATURES, 0); if (c) { env->features[FEAT_HYPERV_EAX] = c->eax; @@ -1282,23 +1289,11 @@ static int hyperv_handle_properties(CPUState *cs, c = &cpuid_ent[cpuid_i++]; c->function = HV_CPUID_VENDOR_AND_MAX_FUNCTIONS; - if (!cpu->hyperv_vendor_id) { - memcpy(signature, "Microsoft Hv", 12); - } else { - size_t len = strlen(cpu->hyperv_vendor_id); - - if (len > 12) { - error_report("hv-vendor-id truncated to 12 characters"); - len = 12; - } - memset(signature, 0, 12); - memcpy(signature, cpu->hyperv_vendor_id, len); - } c->eax = hyperv_feat_enabled(cpu, HYPERV_FEAT_EVMCS) ? HV_CPUID_NESTED_FEATURES : HV_CPUID_IMPLEMENT_LIMITS; - c->ebx = signature[0]; - c->ecx = signature[1]; - c->edx = signature[2]; + c->ebx = cpu->hyperv_vendor_id[0]; + c->ecx = cpu->hyperv_vendor_id[1]; + c->edx = cpu->hyperv_vendor_id[2]; c = &cpuid_ent[cpuid_i++]; c->function = HV_CPUID_INTERFACE; |