[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 3/7] kvm: Extend kvm_arch_get_supported_cpuid() to s
From: |
Marcelo Tosatti |
Subject: |
[Qemu-devel] [PATCH 3/7] kvm: Extend kvm_arch_get_supported_cpuid() to support index |
Date: |
Mon, 28 Jun 2010 13:14:10 -0300 |
From: Sheng Yang <address@hidden>
Would use it later for XSAVE related CPUID.
Signed-off-by: Sheng Yang <address@hidden>
Signed-off-by: Marcelo Tosatti <address@hidden>
---
kvm.h | 2 +-
target-i386/kvm.c | 19 +++++++++++--------
2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/kvm.h b/kvm.h
index a30529c..500e7e4 100644
--- a/kvm.h
+++ b/kvm.h
@@ -144,7 +144,7 @@ bool kvm_arch_stop_on_emulation_error(CPUState *env);
int kvm_check_extension(KVMState *s, unsigned int extension);
uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function,
- int reg);
+ uint32_t index, int reg);
void kvm_cpu_synchronize_state(CPUState *env);
void kvm_cpu_synchronize_post_reset(CPUState *env);
void kvm_cpu_synchronize_post_init(CPUState *env);
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 5453239..2b14ff5 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -71,7 +71,8 @@ static struct kvm_cpuid2 *try_get_cpuid(KVMState *s, int max)
return cpuid;
}
-uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function, int
reg)
+uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function,
+ uint32_t index, int reg)
{
struct kvm_cpuid2 *cpuid;
int i, max;
@@ -88,7 +89,8 @@ uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t
function, int reg)
}
for (i = 0; i < cpuid->nent; ++i) {
- if (cpuid->entries[i].function == function) {
+ if (cpuid->entries[i].function == function &&
+ cpuid->entries[i].index == index) {
switch (reg) {
case R_EAX:
ret = cpuid->entries[i].eax;
@@ -110,7 +112,7 @@ uint32_t kvm_arch_get_supported_cpuid(CPUState *env,
uint32_t function, int reg)
/* On Intel, kvm returns cpuid according to the Intel spec,
* so add missing bits according to the AMD spec:
*/
- cpuid_1_edx = kvm_arch_get_supported_cpuid(env, 1, R_EDX);
+ cpuid_1_edx = kvm_arch_get_supported_cpuid(env, 1, 0,
R_EDX);
ret |= cpuid_1_edx & 0x183f7ff;
break;
}
@@ -126,7 +128,8 @@ uint32_t kvm_arch_get_supported_cpuid(CPUState *env,
uint32_t function, int reg)
#else
-uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function, int
reg)
+uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function,
+ uint32_t index, int reg)
{
return -1U;
}
@@ -178,16 +181,16 @@ int kvm_arch_init_vcpu(CPUState *env)
env->mp_state = KVM_MP_STATE_RUNNABLE;
- env->cpuid_features &= kvm_arch_get_supported_cpuid(env, 1, R_EDX);
+ env->cpuid_features &= kvm_arch_get_supported_cpuid(env, 1, 0, R_EDX);
i = env->cpuid_ext_features & CPUID_EXT_HYPERVISOR;
- env->cpuid_ext_features &= kvm_arch_get_supported_cpuid(env, 1, R_ECX);
+ env->cpuid_ext_features &= kvm_arch_get_supported_cpuid(env, 1, 0, R_ECX);
env->cpuid_ext_features |= i;
env->cpuid_ext2_features &= kvm_arch_get_supported_cpuid(env, 0x80000001,
- R_EDX);
+ 0, R_EDX);
env->cpuid_ext3_features &= kvm_arch_get_supported_cpuid(env, 0x80000001,
- R_ECX);
+ 0, R_ECX);
cpuid_i = 0;
--
1.6.6.1
- [Qemu-devel] [PATCH 0/7] [PULL] qemu-kvm.git uq/master queue, Marcelo Tosatti, 2010/06/28
- [Qemu-devel] [PATCH 4/7] Enable XSAVE related CPUID, Marcelo Tosatti, 2010/06/28
- [Qemu-devel] [PATCH 7/7] kvm: Fix cpu_is_bsp() compilation warning, Marcelo Tosatti, 2010/06/28
- [Qemu-devel] [PATCH 6/7] kvm: init mp_state, Marcelo Tosatti, 2010/06/28
- [Qemu-devel] [PATCH 3/7] kvm: Extend kvm_arch_get_supported_cpuid() to support index,
Marcelo Tosatti <=
- [Qemu-devel] [PATCH 1/7] kvm: Switch kvm_update_guest_debug to run_on_cpu, Marcelo Tosatti, 2010/06/28
- [Qemu-devel] [PATCH 2/7] fix CPUID vendor override, Marcelo Tosatti, 2010/06/28
- [Qemu-devel] [PATCH 5/7] kvm: Enable XSAVE live migration support, Marcelo Tosatti, 2010/06/28
- Re: [Qemu-devel] [PATCH 0/7] [PULL] qemu-kvm.git uq/master queue, Anthony Liguori, 2010/06/28