diff options
author | brillywu@viatech.com.cn <brillywu@viatech.com.cn> | 2011-06-01 09:59:52 +0800 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2011-06-14 09:34:35 -0500 |
commit | b3baa152aaef1905876670590275c2dd0bbb088c (patch) | |
tree | 703293b33f8bd12b67f90204ded1c87ecca6ab23 /target-i386/kvm.c | |
parent | 6df658f55c41c583b3f6d6f872e3314ad7fe744c (diff) |
kvm: Add CPUID support for VIA CPU
When KVM is running on VIA CPU with host cpu's model, the
feautures of VIA CPU will be passed into kvm guest by calling
the CPUID instruction for Centaur.
Signed-off-by: BrillyWu<brillywu@viatech.com.cn>
Signed-off-by: KaryJin<karyjin@viatech.com.cn>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'target-i386/kvm.c')
-rw-r--r-- | target-i386/kvm.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/target-i386/kvm.c b/target-i386/kvm.c index faedc6c25..1ae2d6174 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -482,6 +482,21 @@ int kvm_arch_init_vcpu(CPUState *env) cpu_x86_cpuid(env, i, 0, &c->eax, &c->ebx, &c->ecx, &c->edx); } + /* Call Centaur's CPUID instructions they are supported. */ + if (env->cpuid_xlevel2 > 0) { + env->cpuid_ext4_features &= + kvm_arch_get_supported_cpuid(env, 0xC0000001, 0, R_EDX); + cpu_x86_cpuid(env, 0xC0000000, 0, &limit, &unused, &unused, &unused); + + for (i = 0xC0000000; i <= limit; i++) { + c = &cpuid_data.entries[cpuid_i++]; + + c->function = i; + c->flags = 0; + cpu_x86_cpuid(env, i, 0, &c->eax, &c->ebx, &c->ecx, &c->edx); + } + } + cpuid_data.cpuid.nent = cpuid_i; #ifdef KVM_CAP_MCE |