Revision c958a8bd target-i386/kvm.c
b/target-i386/kvm.c | ||
---|---|---|
71 | 71 |
return cpuid; |
72 | 72 |
} |
73 | 73 |
|
74 |
uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function, int reg) |
|
74 |
uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function, |
|
75 |
uint32_t index, int reg) |
|
75 | 76 |
{ |
76 | 77 |
struct kvm_cpuid2 *cpuid; |
77 | 78 |
int i, max; |
... | ... | |
88 | 89 |
} |
89 | 90 |
|
90 | 91 |
for (i = 0; i < cpuid->nent; ++i) { |
91 |
if (cpuid->entries[i].function == function) { |
|
92 |
if (cpuid->entries[i].function == function && |
|
93 |
cpuid->entries[i].index == index) { |
|
92 | 94 |
switch (reg) { |
93 | 95 |
case R_EAX: |
94 | 96 |
ret = cpuid->entries[i].eax; |
... | ... | |
110 | 112 |
/* On Intel, kvm returns cpuid according to the Intel spec, |
111 | 113 |
* so add missing bits according to the AMD spec: |
112 | 114 |
*/ |
113 |
cpuid_1_edx = kvm_arch_get_supported_cpuid(env, 1, R_EDX); |
|
115 |
cpuid_1_edx = kvm_arch_get_supported_cpuid(env, 1, 0, R_EDX);
|
|
114 | 116 |
ret |= cpuid_1_edx & 0x183f7ff; |
115 | 117 |
break; |
116 | 118 |
} |
... | ... | |
126 | 128 |
|
127 | 129 |
#else |
128 | 130 |
|
129 |
uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function, int reg) |
|
131 |
uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function, |
|
132 |
uint32_t index, int reg) |
|
130 | 133 |
{ |
131 | 134 |
return -1U; |
132 | 135 |
} |
... | ... | |
178 | 181 |
|
179 | 182 |
env->mp_state = KVM_MP_STATE_RUNNABLE; |
180 | 183 |
|
181 |
env->cpuid_features &= kvm_arch_get_supported_cpuid(env, 1, R_EDX); |
|
184 |
env->cpuid_features &= kvm_arch_get_supported_cpuid(env, 1, 0, R_EDX);
|
|
182 | 185 |
|
183 | 186 |
i = env->cpuid_ext_features & CPUID_EXT_HYPERVISOR; |
184 |
env->cpuid_ext_features &= kvm_arch_get_supported_cpuid(env, 1, R_ECX); |
|
187 |
env->cpuid_ext_features &= kvm_arch_get_supported_cpuid(env, 1, 0, R_ECX);
|
|
185 | 188 |
env->cpuid_ext_features |= i; |
186 | 189 |
|
187 | 190 |
env->cpuid_ext2_features &= kvm_arch_get_supported_cpuid(env, 0x80000001, |
188 |
R_EDX); |
|
191 |
0, R_EDX);
|
|
189 | 192 |
env->cpuid_ext3_features &= kvm_arch_get_supported_cpuid(env, 0x80000001, |
190 |
R_ECX); |
|
193 |
0, R_ECX);
|
|
191 | 194 |
|
192 | 195 |
cpuid_i = 0; |
193 | 196 |
|
Also available in: Unified diff