From: Marcelo Tosatti <mtosatti@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, vrozenfe@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/5] KVM: fix coexistence of KVM and Hyper-V leaves
Date: Fri, 24 Jan 2014 17:08:09 -0200 [thread overview]
Message-ID: <20140124190809.GC11980@amt.cnet> (raw)
In-Reply-To: <1390580276-15298-2-git-send-email-pbonzini@redhat.com>
On Fri, Jan 24, 2014 at 05:17:52PM +0100, Paolo Bonzini wrote:
> kvm_arch_init_vcpu's initialization of the KVM leaves at 0x40000100
> is broken, because KVM_CPUID_FEATURES is left at 0x40000001. Move
> it to 0x40000101 if Hyper-V is enabled.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/kvm_para.h
static inline unsigned int kvm_arch_para_features(void)
{
return cpuid_eax(KVM_CPUID_FEATURES);
}
Shouldnt it be using kvm_cpuid_base ?
> ---
> target-i386/kvm.c | 47 +++++++++++++++++++++++++----------------------
> 1 file changed, 25 insertions(+), 22 deletions(-)
>
> diff --git a/target-i386/kvm.c b/target-i386/kvm.c
> index 0a21c30..5738911 100644
> --- a/target-i386/kvm.c
> +++ b/target-i386/kvm.c
> @@ -455,6 +455,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
> uint32_t unused;
> struct kvm_cpuid_entry2 *c;
> uint32_t signature[3];
> + int kvm_base = KVM_CPUID_SIGNATURE;
> int r;
>
> memset(&cpuid_data, 0, sizeof(cpuid_data));
> @@ -462,26 +463,22 @@ int kvm_arch_init_vcpu(CPUState *cs)
> cpuid_i = 0;
>
> /* Paravirtualization CPUIDs */
> - c = &cpuid_data.entries[cpuid_i++];
> - c->function = KVM_CPUID_SIGNATURE;
> - if (!hyperv_enabled(cpu)) {
> - memcpy(signature, "KVMKVMKVM\0\0\0", 12);
> - c->eax = 0;
> - } else {
> + if (hyperv_enabled(cpu)) {
> + c = &cpuid_data.entries[cpuid_i++];
> + c->function = HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS;
> memcpy(signature, "Microsoft Hv", 12);
> c->eax = HYPERV_CPUID_MIN;
> - }
> - c->ebx = signature[0];
> - c->ecx = signature[1];
> - c->edx = signature[2];
> -
> - c = &cpuid_data.entries[cpuid_i++];
> - c->function = KVM_CPUID_FEATURES;
> - c->eax = env->features[FEAT_KVM];
> + c->ebx = signature[0];
> + c->ecx = signature[1];
> + c->edx = signature[2];
>
> - if (hyperv_enabled(cpu)) {
> + c = &cpuid_data.entries[cpuid_i++];
> + c->function = HYPERV_CPUID_INTERFACE;
> memcpy(signature, "Hv#1\0\0\0\0\0\0\0\0", 12);
> c->eax = signature[0];
> + c->ebx = 0;
> + c->ecx = 0;
> + c->edx = 0;
>
> c = &cpuid_data.entries[cpuid_i++];
> c->function = HYPERV_CPUID_VERSION;
> @@ -513,15 +510,21 @@ int kvm_arch_init_vcpu(CPUState *cs)
> c->eax = 0x40;
> c->ebx = 0x40;
>
> - c = &cpuid_data.entries[cpuid_i++];
> - c->function = KVM_CPUID_SIGNATURE_NEXT;
> - memcpy(signature, "KVMKVMKVM\0\0\0", 12);
> - c->eax = 0;
> - c->ebx = signature[0];
> - c->ecx = signature[1];
> - c->edx = signature[2];
> + kvm_base = KVM_CPUID_SIGNATURE_NEXT;
> }
>
> + memcpy(signature, "KVMKVMKVM\0\0\0", 12);
> + c = &cpuid_data.entries[cpuid_i++];
> + c->function = KVM_CPUID_SIGNATURE | kvm_base;
> + c->eax = 0;
> + c->ebx = signature[0];
> + c->ecx = signature[1];
> + c->edx = signature[2];
> +
> + c = &cpuid_data.entries[cpuid_i++];
> + c->function = KVM_CPUID_FEATURES | kvm_base;
> + c->eax = env->features[FEAT_KVM];
> +
> has_msr_async_pf_en = c->eax & (1 << KVM_FEATURE_ASYNC_PF);
>
> has_msr_pv_eoi_en = c->eax & (1 << KVM_FEATURE_PV_EOI);
> --
> 1.8.3.1
>
next prev parent reply other threads:[~2014-01-24 19:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-24 16:17 [Qemu-devel] [PATCH uq/master 0/5] Hyper-V improvements and migratability Paolo Bonzini
2014-01-24 16:17 ` [Qemu-devel] [PATCH 1/5] KVM: fix coexistence of KVM and Hyper-V leaves Paolo Bonzini
2014-01-24 19:08 ` Marcelo Tosatti [this message]
2014-01-24 19:40 ` Paolo Bonzini
2014-01-24 16:17 ` [Qemu-devel] [PATCH 2/5] kvm: make availability of Hyper-V enlightenments dependent on KVM_CAP_HYPERV Paolo Bonzini
2014-01-24 16:17 ` [Qemu-devel] [PATCH 3/5] kvm: make hyperv hypercall and guest os id MSRs migratable Paolo Bonzini
2014-01-24 16:17 ` [Qemu-devel] [PATCH 4/5] kvm: make hyperv vapic assist page migratable Paolo Bonzini
2014-01-24 16:17 ` [Qemu-devel] [PATCH 5/5] kvm: add support for hyper-v timers Paolo Bonzini
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=20140124190809.GC11980@amt.cnet \
--to=mtosatti@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=vrozenfe@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).