|
|
0a122b |
From e77dfa0b88d9efdf6b2125817cd6febdcf4385b0 Mon Sep 17 00:00:00 2001
|
|
|
0a122b |
From: Vadim Rozenfeld <vrozenfe@redhat.com>
|
|
|
0a122b |
Date: Mon, 3 Mar 2014 12:09:15 +0100
|
|
|
0a122b |
Subject: [PATCH 03/12] KVM: fix coexistence of KVM and Hyper-V leaves
|
|
|
0a122b |
|
|
|
0a122b |
RH-Author: Vadim Rozenfeld <vrozenfe@redhat.com>
|
|
|
0a122b |
Message-id: <1393848564-10511-4-git-send-email-vrozenfe@redhat.com>
|
|
|
0a122b |
Patchwork-id: 57959
|
|
|
0a122b |
O-Subject: [RHEL-7.0 qemu-kvm v4 PATCH 03/12] KVM: fix coexistence of KVM and Hyper-V leaves
|
|
|
0a122b |
Bugzilla: 1004773
|
|
|
0a122b |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
0a122b |
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
|
|
|
0a122b |
RH-Acked-by: Juan Quintela <quintela@redhat.com>
|
|
|
0a122b |
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
0a122b |
|
|
|
0a122b |
From: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
0a122b |
|
|
|
0a122b |
kvm_arch_init_vcpu's initialization of the KVM leaves at 0x40000100
|
|
|
0a122b |
is broken, because KVM_CPUID_FEATURES is left at 0x40000001. Move
|
|
|
0a122b |
it to 0x40000101 if Hyper-V is enabled.
|
|
|
0a122b |
|
|
|
0a122b |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
0a122b |
(cherry picked from commit 234cc64796557eea829544e4ff72ee99b6149187)
|
|
|
0a122b |
---
|
|
|
0a122b |
target-i386/kvm.c | 47 +++++++++++++++++++++++++----------------------
|
|
|
0a122b |
1 file changed, 25 insertions(+), 22 deletions(-)
|
|
|
0a122b |
|
|
|
0a122b |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
0a122b |
---
|
|
|
0a122b |
target-i386/kvm.c | 47 +++++++++++++++++++++++++----------------------
|
|
|
0a122b |
1 files changed, 25 insertions(+), 22 deletions(-)
|
|
|
0a122b |
|
|
|
0a122b |
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
|
|
|
0a122b |
index 3a9e376..3688371 100644
|
|
|
0a122b |
--- a/target-i386/kvm.c
|
|
|
0a122b |
+++ b/target-i386/kvm.c
|
|
|
0a122b |
@@ -451,6 +451,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
|
|
|
0a122b |
uint32_t unused;
|
|
|
0a122b |
struct kvm_cpuid_entry2 *c;
|
|
|
0a122b |
uint32_t signature[3];
|
|
|
0a122b |
+ int kvm_base = KVM_CPUID_SIGNATURE;
|
|
|
0a122b |
int r;
|
|
|
0a122b |
|
|
|
0a122b |
memset(&cpuid_data, 0, sizeof(cpuid_data));
|
|
|
0a122b |
@@ -458,26 +459,22 @@ int kvm_arch_init_vcpu(CPUState *cs)
|
|
|
0a122b |
cpuid_i = 0;
|
|
|
0a122b |
|
|
|
0a122b |
/* Paravirtualization CPUIDs */
|
|
|
0a122b |
- c = &cpuid_data.entries[cpuid_i++];
|
|
|
0a122b |
- c->function = KVM_CPUID_SIGNATURE;
|
|
|
0a122b |
- if (!hyperv_enabled(cpu)) {
|
|
|
0a122b |
- memcpy(signature, "KVMKVMKVM\0\0\0", 12);
|
|
|
0a122b |
- c->eax = 0;
|
|
|
0a122b |
- } else {
|
|
|
0a122b |
+ if (hyperv_enabled(cpu)) {
|
|
|
0a122b |
+ c = &cpuid_data.entries[cpuid_i++];
|
|
|
0a122b |
+ c->function = HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS;
|
|
|
0a122b |
memcpy(signature, "Microsoft Hv", 12);
|
|
|
0a122b |
c->eax = HYPERV_CPUID_MIN;
|
|
|
0a122b |
- }
|
|
|
0a122b |
- c->ebx = signature[0];
|
|
|
0a122b |
- c->ecx = signature[1];
|
|
|
0a122b |
- c->edx = signature[2];
|
|
|
0a122b |
-
|
|
|
0a122b |
- c = &cpuid_data.entries[cpuid_i++];
|
|
|
0a122b |
- c->function = KVM_CPUID_FEATURES;
|
|
|
0a122b |
- c->eax = env->features[FEAT_KVM];
|
|
|
0a122b |
+ c->ebx = signature[0];
|
|
|
0a122b |
+ c->ecx = signature[1];
|
|
|
0a122b |
+ c->edx = signature[2];
|
|
|
0a122b |
|
|
|
0a122b |
- if (hyperv_enabled(cpu)) {
|
|
|
0a122b |
+ c = &cpuid_data.entries[cpuid_i++];
|
|
|
0a122b |
+ c->function = HYPERV_CPUID_INTERFACE;
|
|
|
0a122b |
memcpy(signature, "Hv#1\0\0\0\0\0\0\0\0", 12);
|
|
|
0a122b |
c->eax = signature[0];
|
|
|
0a122b |
+ c->ebx = 0;
|
|
|
0a122b |
+ c->ecx = 0;
|
|
|
0a122b |
+ c->edx = 0;
|
|
|
0a122b |
|
|
|
0a122b |
c = &cpuid_data.entries[cpuid_i++];
|
|
|
0a122b |
c->function = HYPERV_CPUID_VERSION;
|
|
|
0a122b |
@@ -509,15 +506,21 @@ int kvm_arch_init_vcpu(CPUState *cs)
|
|
|
0a122b |
c->eax = 0x40;
|
|
|
0a122b |
c->ebx = 0x40;
|
|
|
0a122b |
|
|
|
0a122b |
- c = &cpuid_data.entries[cpuid_i++];
|
|
|
0a122b |
- c->function = KVM_CPUID_SIGNATURE_NEXT;
|
|
|
0a122b |
- memcpy(signature, "KVMKVMKVM\0\0\0", 12);
|
|
|
0a122b |
- c->eax = 0;
|
|
|
0a122b |
- c->ebx = signature[0];
|
|
|
0a122b |
- c->ecx = signature[1];
|
|
|
0a122b |
- c->edx = signature[2];
|
|
|
0a122b |
+ kvm_base = KVM_CPUID_SIGNATURE_NEXT;
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
+ memcpy(signature, "KVMKVMKVM\0\0\0", 12);
|
|
|
0a122b |
+ c = &cpuid_data.entries[cpuid_i++];
|
|
|
0a122b |
+ c->function = KVM_CPUID_SIGNATURE | kvm_base;
|
|
|
0a122b |
+ c->eax = 0;
|
|
|
0a122b |
+ c->ebx = signature[0];
|
|
|
0a122b |
+ c->ecx = signature[1];
|
|
|
0a122b |
+ c->edx = signature[2];
|
|
|
0a122b |
+
|
|
|
0a122b |
+ c = &cpuid_data.entries[cpuid_i++];
|
|
|
0a122b |
+ c->function = KVM_CPUID_FEATURES | kvm_base;
|
|
|
0a122b |
+ c->eax = env->features[FEAT_KVM];
|
|
|
0a122b |
+
|
|
|
0a122b |
has_msr_async_pf_en = c->eax & (1 << KVM_FEATURE_ASYNC_PF);
|
|
|
0a122b |
|
|
|
0a122b |
has_msr_pv_eoi_en = c->eax & (1 << KVM_FEATURE_PV_EOI);
|
|
|
0a122b |
--
|
|
|
0a122b |
1.7.1
|
|
|
0a122b |
|