Revision 457dfed6 target-i386/kvm.c
b/target-i386/kvm.c | ||
---|---|---|
133 | 133 |
|
134 | 134 |
#endif |
135 | 135 |
|
136 |
static void kvm_trim_features(uint32_t *features, uint32_t supported) |
|
137 |
{ |
|
138 |
int i; |
|
139 |
uint32_t mask; |
|
140 |
|
|
141 |
for (i = 0; i < 32; ++i) { |
|
142 |
mask = 1U << i; |
|
143 |
if ((*features & mask) && !(supported & mask)) { |
|
144 |
*features &= ~mask; |
|
145 |
} |
|
146 |
} |
|
147 |
} |
|
148 |
|
|
149 | 136 |
#ifdef CONFIG_KVM_PARA |
150 | 137 |
struct kvm_para_features { |
151 | 138 |
int cap; |
... | ... | |
191 | 178 |
|
192 | 179 |
env->mp_state = KVM_MP_STATE_RUNNABLE; |
193 | 180 |
|
194 |
kvm_trim_features(&env->cpuid_features, |
|
195 |
kvm_arch_get_supported_cpuid(env, 1, R_EDX)); |
|
181 |
env->cpuid_features &= kvm_arch_get_supported_cpuid(env, 1, R_EDX); |
|
196 | 182 |
|
197 | 183 |
i = env->cpuid_ext_features & CPUID_EXT_HYPERVISOR; |
198 |
kvm_trim_features(&env->cpuid_ext_features, |
|
199 |
kvm_arch_get_supported_cpuid(env, 1, R_ECX)); |
|
184 |
env->cpuid_ext_features &= kvm_arch_get_supported_cpuid(env, 1, R_ECX); |
|
200 | 185 |
env->cpuid_ext_features |= i; |
201 | 186 |
|
202 |
kvm_trim_features(&env->cpuid_ext2_features,
|
|
203 |
kvm_arch_get_supported_cpuid(env, 0x80000001, R_EDX));
|
|
204 |
kvm_trim_features(&env->cpuid_ext3_features,
|
|
205 |
kvm_arch_get_supported_cpuid(env, 0x80000001, R_ECX));
|
|
187 |
env->cpuid_ext2_features &= kvm_arch_get_supported_cpuid(env, 0x80000001,
|
|
188 |
R_EDX);
|
|
189 |
env->cpuid_ext3_features &= kvm_arch_get_supported_cpuid(env, 0x80000001,
|
|
190 |
R_ECX);
|
|
206 | 191 |
|
207 | 192 |
cpuid_i = 0; |
208 | 193 |
|
Also available in: Unified diff