qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Qemu: Fix eax for cpuid leaf 0x40000000


From: Eduardo Habkost
Subject: Re: [Qemu-devel] [PATCH] Qemu: Fix eax for cpuid leaf 0x40000000
Date: Tue, 12 Aug 2014 15:55:52 -0300
User-agent: Mutt/1.5.23 (2014-03-12)

On Wed, Jun 04, 2014 at 03:17:56AM -0400, Jidong Xiao wrote:
> On Wed, Jun 4, 2014 at 3:09 AM, Paolo Bonzini <address@hidden> wrote:
> > Il 04/06/2014 03:10, Jidong Xiao ha scritto:
> >
> >> diff --git a/qemu-2.0.0/target-i386/kvm.c.orig
> >> b/qemu-2.0.0/target-i386/kvm.c
> >> index 4389959..b8b282d 100644
> >> --- a/qemu-2.0.0/target-i386/kvm.c.orig
> >> +++ b/qemu-2.0.0/target-i386/kvm.c
> >> @@ -530,7 +530,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
> >>      memcpy(signature, "KVMKVMKVM\0\0\0", 12);
> >>      c = &cpuid_data.entries[cpuid_i++];
> >>      c->function = KVM_CPUID_SIGNATURE | kvm_base;
> >> -    c->eax = 0;
> >> +   c->eax = KVM_CPUID_FEATURES;
> >>      c->ebx = signature[0];
> >>      c->ecx = signature[1];
> >>      c->edx = signature[2];
> >
> >
> > This should actually be "KVM_CPUID_FEATURES | kvm_base", in case Hyper-V
> > leaves are available too.  But it is a good catch!
> >
> > Paolo
> >
> Thanks Paolo. I have just added that and resend the patch as following:
> 
> -Jidong
> 
> ===
> Signed-off-by: Jidong Xiao <address@hidden>
> 
> ---
> diff --git a/qemu-2.0.0/target-i386/kvm.c.orig b/qemu-2.0.0/target-i386/kvm.c
> index 4389959..fe49a75 100644
> --- a/qemu-2.0.0/target-i386/kvm.c.orig
> +++ b/qemu-2.0.0/target-i386/kvm.c
> @@ -530,7 +530,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
>      memcpy(signature, "KVMKVMKVM\0\0\0", 12);
>      c = &cpuid_data.entries[cpuid_i++];
>      c->function = KVM_CPUID_SIGNATURE | kvm_base;
> -    c->eax = 0;
> +   c->eax = KVM_CPUID_FEATURES | kvm_base;

This makes the CPUID data change under the guest's feet during
live-migration.

Adding compat code to ensure older machine-types keep the old behavior
is necessary, but in this specific case it is mostly harmless because
0x0 is documented as being equivalent to 0x40000001.

(But I don't know how guests are supposed to behave when they see
CPUID[KVM_CPUID_SIGNATURE_NEXT].EAX==0.)

-- 
Eduardo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]