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