diff options
author | Avi Kivity <avi@redhat.com> | 2009-02-16 16:34:19 +0000 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-02-16 16:34:19 +0000 |
commit | 1c68cbed4db8e3157e3266d9bca4491433acf680 (patch) | |
tree | 6274fbc110bf53eaa393a7d8595336eb12bd26d0 /target-i386/kvm.c | |
parent | Fix hardware accelerated video to video copy on Cirrus VGA (Brian Kress) (diff) | |
parent | virtio: Remove malloc failure checks (Jan Kiszka) (diff) | |
download | qemu-kvm-1c68cbed4db8e3157e3266d9bca4491433acf680.tar.gz qemu-kvm-1c68cbed4db8e3157e3266d9bca4491433acf680.tar.bz2 qemu-kvm-1c68cbed4db8e3157e3266d9bca4491433acf680.zip |
Merge branch 'qemu-cvs'
Conflicts:
qemu/Makefile.target
qemu/hw/acpi.c
qemu/hw/device-hotplug.c
qemu/hw/ide.c
qemu/hw/lsi53c895a.c
qemu/hw/pc.c
qemu/hw/pc.h
qemu/hw/pci.c
qemu/hw/pci.h
qemu/hw/virtio-blk.c
qemu/hw/virtio-net.c
qemu/monitor.c
qemu/net.c
qemu/net.h
qemu/pc-bios/bios.bin
qemu/sysemu.h
qemu/vl.c
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'target-i386/kvm.c')
-rw-r--r-- | target-i386/kvm.c | 86 |
1 files changed, 69 insertions, 17 deletions
diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 7d5bc6320..0222c9c24 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -36,35 +36,87 @@ int kvm_arch_init_vcpu(CPUState *env) { struct { - struct kvm_cpuid cpuid; - struct kvm_cpuid_entry entries[100]; + struct kvm_cpuid2 cpuid; + struct kvm_cpuid_entry2 entries[100]; } __attribute__((packed)) cpuid_data; - uint32_t limit, i, cpuid_i; + uint32_t limit, i, j, cpuid_i; uint32_t eax, ebx, ecx, edx; cpuid_i = 0; - cpu_x86_cpuid(env, 0, &eax, &ebx, &ecx, &edx); + cpu_x86_cpuid(env, 0, 0, &eax, &ebx, &ecx, &edx); limit = eax; for (i = 0; i <= limit; i++) { - struct kvm_cpuid_entry *c = &cpuid_data.entries[cpuid_i++]; - - cpu_x86_cpuid(env, i, &eax, &ebx, &ecx, &edx); - c->function = i; - c->eax = eax; - c->ebx = ebx; - c->ecx = ecx; - c->edx = edx; + struct kvm_cpuid_entry2 *c = &cpuid_data.entries[cpuid_i++]; + + switch (i) { + case 2: { + /* Keep reading function 2 till all the input is received */ + int times; + + cpu_x86_cpuid(env, i, 0, &eax, &ebx, &ecx, &edx); + times = eax & 0xff; + + c->function = i; + c->flags |= KVM_CPUID_FLAG_STATEFUL_FUNC; + c->flags |= KVM_CPUID_FLAG_STATE_READ_NEXT; + c->eax = eax; + c->ebx = ebx; + c->ecx = ecx; + c->edx = edx; + + for (j = 1; j < times; ++j) { + cpu_x86_cpuid(env, i, 0, &eax, &ebx, &ecx, &edx); + c->function = i; + c->flags |= KVM_CPUID_FLAG_STATEFUL_FUNC; + c->eax = eax; + c->ebx = ebx; + c->ecx = ecx; + c->edx = edx; + c = &cpuid_data.entries[++cpuid_i]; + } + break; + } + case 4: + case 0xb: + case 0xd: + for (j = 0; ; j++) { + cpu_x86_cpuid(env, i, j, &eax, &ebx, &ecx, &edx); + c->function = i; + c->flags = KVM_CPUID_FLAG_SIGNIFCANT_INDEX; + c->index = j; + c->eax = eax; + c->ebx = ebx; + c->ecx = ecx; + c->edx = edx; + c = &cpuid_data.entries[++cpuid_i]; + + if (i == 4 && eax == 0) + break; + if (i == 0xb && !(ecx & 0xff00)) + break; + if (i == 0xd && eax == 0) + break; + } + break; + default: + cpu_x86_cpuid(env, i, 0, &eax, &ebx, &ecx, &edx); + c->function = i; + c->eax = eax; + c->ebx = ebx; + c->ecx = ecx; + c->edx = edx; + break; + } } - - cpu_x86_cpuid(env, 0x80000000, &eax, &ebx, &ecx, &edx); + cpu_x86_cpuid(env, 0x80000000, 0, &eax, &ebx, &ecx, &edx); limit = eax; for (i = 0x80000000; i <= limit; i++) { - struct kvm_cpuid_entry *c = &cpuid_data.entries[cpuid_i++]; + struct kvm_cpuid_entry2 *c = &cpuid_data.entries[cpuid_i++]; - cpu_x86_cpuid(env, i, &eax, &ebx, &ecx, &edx); + cpu_x86_cpuid(env, i, 0, &eax, &ebx, &ecx, &edx); c->function = i; c->eax = eax; c->ebx = ebx; @@ -74,7 +126,7 @@ int kvm_arch_init_vcpu(CPUState *env) cpuid_data.cpuid.nent = cpuid_i; - return kvm_vcpu_ioctl(env, KVM_SET_CPUID, &cpuid_data); + return kvm_vcpu_ioctl(env, KVM_SET_CPUID2, &cpuid_data); } static int kvm_has_msr_star(CPUState *env) |