Commit a36b1029e226f377028aeab0e8779fcd4c3e414e
1 parent
486bd5a2
KVM: Get all cpuid values from function 2 (Amit Shah)
cpuid function 2 can have multiple values to describe cache behaviour. Loop till we have fetched all the values. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6567 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
26 additions
and
0 deletions
target-i386/kvm.c
... | ... | @@ -51,6 +51,32 @@ int kvm_arch_init_vcpu(CPUState *env) |
51 | 51 | struct kvm_cpuid_entry2 *c = &cpuid_data.entries[cpuid_i++]; |
52 | 52 | |
53 | 53 | switch (i) { |
54 | + case 2: { | |
55 | + /* Keep reading function 2 till all the input is received */ | |
56 | + int times; | |
57 | + | |
58 | + cpu_x86_cpuid(env, i, 0, &eax, &ebx, &ecx, &edx); | |
59 | + times = eax & 0xff; | |
60 | + | |
61 | + c->function = i; | |
62 | + c->flags |= KVM_CPUID_FLAG_STATEFUL_FUNC; | |
63 | + c->flags |= KVM_CPUID_FLAG_STATE_READ_NEXT; | |
64 | + c->eax = eax; | |
65 | + c->ebx = ebx; | |
66 | + c->ecx = ecx; | |
67 | + c->edx = edx; | |
68 | + | |
69 | + for (j = 1; j < times; ++j) { | |
70 | + cpu_x86_cpuid(env, i, 0, &eax, &ebx, &ecx, &edx); | |
71 | + c->function = i; | |
72 | + c->flags |= KVM_CPUID_FLAG_STATEFUL_FUNC; | |
73 | + c->eax = eax; | |
74 | + c->ebx = ebx; | |
75 | + c->ecx = ecx; | |
76 | + c->edx = edx; | |
77 | + } | |
78 | + break; | |
79 | + } | |
54 | 80 | case 4: |
55 | 81 | case 0xb: |
56 | 82 | case 0xd: | ... | ... |