kvm: x86: Pass KVMState to kvm_arch_get_supported_cpuid

kvm_arch_get_supported_cpuid checks for global cpuid restrictions, it
does not require any CPUState reference. Changing its interface allows
to call it before any VCPU is initialized.

CC: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
This commit is contained in:
Jan Kiszka 2011-06-08 16:11:05 +02:00 committed by Marcelo Tosatti
parent 4bef75b533
commit ba9bc59e1f
3 changed files with 28 additions and 24 deletions

View file

@ -1144,10 +1144,12 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
break;
case 7:
if (kvm_enabled()) {
*eax = kvm_arch_get_supported_cpuid(env, 0x7, count, R_EAX);
*ebx = kvm_arch_get_supported_cpuid(env, 0x7, count, R_EBX);
*ecx = kvm_arch_get_supported_cpuid(env, 0x7, count, R_ECX);
*edx = kvm_arch_get_supported_cpuid(env, 0x7, count, R_EDX);
KVMState *s = env->kvm_state;
*eax = kvm_arch_get_supported_cpuid(s, 0x7, count, R_EAX);
*ebx = kvm_arch_get_supported_cpuid(s, 0x7, count, R_EBX);
*ecx = kvm_arch_get_supported_cpuid(s, 0x7, count, R_ECX);
*edx = kvm_arch_get_supported_cpuid(s, 0x7, count, R_EDX);
} else {
*eax = 0;
*ebx = 0;
@ -1179,10 +1181,12 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
break;
}
if (kvm_enabled()) {
*eax = kvm_arch_get_supported_cpuid(env, 0xd, count, R_EAX);
*ebx = kvm_arch_get_supported_cpuid(env, 0xd, count, R_EBX);
*ecx = kvm_arch_get_supported_cpuid(env, 0xd, count, R_ECX);
*edx = kvm_arch_get_supported_cpuid(env, 0xd, count, R_EDX);
KVMState *s = env->kvm_state;
*eax = kvm_arch_get_supported_cpuid(s, 0xd, count, R_EAX);
*ebx = kvm_arch_get_supported_cpuid(s, 0xd, count, R_EBX);
*ecx = kvm_arch_get_supported_cpuid(s, 0xd, count, R_ECX);
*edx = kvm_arch_get_supported_cpuid(s, 0xd, count, R_EDX);
} else {
*eax = 0;
*ebx = 0;