From: Vadim Rozenfeld <vrozenfe@redhat.com>
To: kvm@vger.kernel.org
Cc: Avi Kivity <avi@redhat.com>, Vadim Rozenfeld <vrozenfe@redhat.com>
Subject: [RFC PATCH 7/7] [hyper-v] init hyper-v cpuid leafs
Date: Sun, 9 Oct 2011 20:52:55 +0200 [thread overview]
Message-ID: <1318186375-27672-8-git-send-email-vrozenfe@redhat.com> (raw)
In-Reply-To: <1318186375-27672-1-git-send-email-vrozenfe@redhat.com>
---
target-i386/kvm.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 52 insertions(+), 1 deletions(-)
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 3840255..74fcc9a 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -29,6 +29,7 @@
#include "hw/pc.h"
#include "hw/apic.h"
#include "ioport.h"
+#include "hyperv.h"
//#define DEBUG_KVM
@@ -379,11 +380,21 @@ int kvm_arch_init_vcpu(CPUState *env)
cpuid_i = 0;
/* Paravirtualization CPUIDs */
- memcpy(signature, "KVMKVMKVM\0\0\0", 12);
c = &cpuid_data.entries[cpuid_i++];
memset(c, 0, sizeof(*c));
c->function = KVM_CPUID_SIGNATURE;
+#ifndef CONFIG_HYPERV
+ memcpy(signature, "KVMKVMKVM\0\0\0", 12);
c->eax = 0;
+#else
+ if (!hyperv_enabled()) {
+ memcpy(signature, "KVMKVMKVM\0\0\0", 12);
+ c->eax = 0;
+ } else {
+ memcpy(signature, "Microsoft Hv", 12);
+ c->eax = HYPERV_CPUID_MIN;
+ }
+#endif
c->ebx = signature[0];
c->ecx = signature[1];
c->edx = signature[2];
@@ -393,6 +404,46 @@ int kvm_arch_init_vcpu(CPUState *env)
c->function = KVM_CPUID_FEATURES;
c->eax = env->cpuid_kvm_features &
kvm_arch_get_supported_cpuid(s, KVM_CPUID_FEATURES, 0, R_EAX);
+#ifdef CONFIG_HYPERV
+ if (hyperv_enabled()) {
+ memcpy(signature, "Hv#1\0\0\0\0\0\0\0\0", 12);
+ c->eax = signature[0];
+
+ c = &cpuid_data.entries[cpuid_i++];
+ memset(c, 0, sizeof(*c));
+ c->function = HYPERV_CPUID_VERSION;
+ c->eax = 0x00001bbc;
+ c->ebx = 0x00060001;
+
+ c = &cpuid_data.entries[cpuid_i++];
+ memset(c, 0, sizeof(*c));
+ c->function = HYPERV_CPUID_FEATURES;
+ if (hyperv_relaxed_timing()) {
+ c->eax |= HV_X64_MSR_HYPERCALL_AVAILABLE;
+ }
+ if (hyperv_apic_recommended()) {
+ c->eax |= HV_X64_MSR_HYPERCALL_AVAILABLE;
+ c->eax |= HV_X64_MSR_APIC_ACCESS_AVAILABLE;
+ }
+
+ c = &cpuid_data.entries[cpuid_i++];
+ memset(c, 0, sizeof(*c));
+ c->function = HYPERV_CPUID_ENLIGHTMENT_INFO;
+ if (hyperv_relaxed_timing()) {
+ c->eax |= HV_X64_RELAXED_TIMING_RECOMMENDED;
+ }
+ if (hyperv_apic_recommended()) {
+ c->eax |= HV_X64_APIC_ACCESS_RECOMMENDED;
+ }
+ c->ebx = hyperv_spinlock_retries();
+
+ c = &cpuid_data.entries[cpuid_i++];
+ memset(c, 0, sizeof(*c));
+ c->function = HYPERV_CPUID_IMPLEMENT_LIMITS;
+ c->eax = 0x40;
+ c->ebx = 0x40;
+ }
+#endif
has_msr_async_pf_en = c->eax & (1 << KVM_FEATURE_ASYNC_PF);
--
1.7.4.4
next prev parent reply other threads:[~2011-10-09 18:53 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-09 18:52 [RFC PATCH 0/7] Initial support for Microsoft Hyper-V Vadim Rozenfeld
2011-10-09 18:52 ` [RFC PATCH 1/7] [hyper-v] Add hyper-v parameters block Vadim Rozenfeld
2011-10-10 6:54 ` Jan Kiszka
2011-10-10 9:40 ` Vadim Rozenfeld
2011-10-10 10:25 ` Jan Kiszka
2011-10-11 7:35 ` Paolo Bonzini
2011-10-11 7:42 ` Paolo Bonzini
2011-10-09 18:52 ` [RFC PATCH 2/7] [hyper-v] add hyper-v placeholders Vadim Rozenfeld
2011-10-11 7:40 ` Paolo Bonzini
2011-10-09 18:52 ` [RFC PATCH 3/7] [hyper-v] make Hyper-V option configurable Vadim Rozenfeld
2011-10-10 6:54 ` Jan Kiszka
2011-10-09 18:52 ` [RFC PATCH 4/7] [hyper-v] hyper-v parameters Vadim Rozenfeld
2011-10-09 18:52 ` [RFC PATCH 5/7] [hyper-v] hyper-v helper functions Vadim Rozenfeld
2011-10-09 19:01 ` Alon Levy
2011-10-10 6:45 ` Vadim Rozenfeld
2011-10-09 18:52 ` [RFC PATCH 6/7] [hyper-v] parse hyper-v parameters Vadim Rozenfeld
2011-10-09 18:52 ` Vadim Rozenfeld [this message]
2011-10-11 7:38 ` [RFC PATCH 7/7] [hyper-v] init hyper-v cpuid leafs Paolo Bonzini
2011-10-11 13:46 ` Vadim Rozenfeld
2011-10-11 15:52 ` Paolo Bonzini
2011-10-11 16:09 ` Vadim Rozenfeld
2011-10-11 16:17 ` Paolo Bonzini
2011-10-10 6:53 ` [RFC PATCH 0/7] Initial support for Microsoft Hyper-V Jan Kiszka
2011-10-10 9:39 ` Vadim Rozenfeld
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1318186375-27672-8-git-send-email-vrozenfe@redhat.com \
--to=vrozenfe@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox