Skip to contentSkip to conversation

qemu: fix cpuid eax for kvm cpu

PATCH In review Michael S. Tsirkin 2 participants 4 messages Apr 30, 2012 – May 1, 2012 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu: fix cpuid eax for kvm cpu

cpuid eax should return the max leaf so that
guests can find out the valid range.
This matches Xen et al.

Tested using -cpu kvm64.

---
 target-i386/kvm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
target-i386/kvm.c +1 -1
index e74a9e4..c097248 100644
@@ -379,7 +379,7 @@ int kvm_arch_init_vcpu(CPUX86State *env)
     c->function = KVM_CPUID_SIGNATURE;
     if (!hyperv_enabled()) {
         memcpy(signature, "KVMKVMKVM\0\0\0", 12);
-        c->eax = 0;
+        c->eax = KVM_CPUID_FEATURES;
     } else {
         memcpy(signature, "Microsoft Hv", 12);
         c->eax = HYPERV_CPUID_MIN;
Signature · 1 line
MST
#1 lore raw
Quoted 16 lines · Michael S. Tsirkin

cpuid eax should return the max leaf so that
guests can find out the valid range.
This matches Xen et al.

Tested using -cpu kvm64.

---
 target-i386/kvm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
target-i386/kvm.c +0 -0
index e74a9e4..c097248 100644

target-i386/kvm.c int kvm_arch_init_vcpu(CPUX86State *env) · line 385

Quoted 8 lines
target-i386/kvm.c +1 -1
@@ -379,7 +379,7 @@ int kvm_arch_init_vcpu(CPUX86State *env)
     c->function = KVM_CPUID_SIGNATURE;
     if (!hyperv_enabled()) {
         memcpy(signature, "KVMKVMKVM\0\0\0", 12);
-        c->eax = 0;
+        c->eax = KVM_CPUID_FEATURES;
     } else {
         memcpy(signature, "Microsoft Hv", 12);
         c->eax = HYPERV_CPUID_MIN;

Should only change for -M 1.1+?

Signature · 1 line
error compiling committee.c: too many arguments to function
#2 lore raw
Quoted 12 lines · Avi Kivity
Quoted 11 lines · Michael S. Tsirkin

cpuid eax should return the max leaf so that
guests can find out the valid range.
This matches Xen et al.

Tested using -cpu kvm64.

---
 target-i386/kvm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 15 lines

target-i386/kvm.c int kvm_arch_init_vcpu(CPUX86State *env) · line 385

Quoted 13 lines
target-i386/kvm.c +1 -1
index e74a9e4..c097248 100644
@@ -379,7 +379,7 @@ int kvm_arch_init_vcpu(CPUX86State *env)
     c->function = KVM_CPUID_SIGNATURE;
     if (!hyperv_enabled()) {
         memcpy(signature, "KVMKVMKVM\0\0\0", 12);
-        c->eax = 0;
+        c->eax = KVM_CPUID_FEATURES;
     } else {
         memcpy(signature, "Microsoft Hv", 12);
         c->eax = HYPERV_CPUID_MIN;

Should only change for -M 1.1+?

I don't think we should: it's a bug fix and we don't try to be bug for bug compatible unless fixing the bug actually affects guest behaviour.

Quoted 2 lines
Signature · 1 line
error compiling committee.c: too many arguments to function
#3 lore raw
Quoted 29 lines · Michael S. Tsirkin
Quoted 12 lines · Avi Kivity
Quoted 11 lines · Michael S. Tsirkin

cpuid eax should return the max leaf so that
guests can find out the valid range.
This matches Xen et al.

Tested using -cpu kvm64.

---
 target-i386/kvm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 15 lines

target-i386/kvm.c int kvm_arch_init_vcpu(CPUX86State *env) · line 385

Quoted 13 lines
target-i386/kvm.c +1 -1
index e74a9e4..c097248 100644
@@ -379,7 +379,7 @@ int kvm_arch_init_vcpu(CPUX86State *env)
     c->function = KVM_CPUID_SIGNATURE;
     if (!hyperv_enabled()) {
         memcpy(signature, "KVMKVMKVM\0\0\0", 12);
-        c->eax = 0;
+        c->eax = KVM_CPUID_FEATURES;
     } else {
         memcpy(signature, "Microsoft Hv", 12);
         c->eax = HYPERV_CPUID_MIN;

Should only change for -M 1.1+?

Quoted 3 lines

I don't think we should: it's a bug fix and we don't try to be bug for bug compatible unless fixing the bug actually affects guest behaviour.

I agree.

Signature · 1 line
error compiling committee.c: too many arguments to function