diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2011-01-21 21:48:22 +0100 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2011-01-23 02:27:22 -0200 |
commit | c5999bfcfdf66390c98115044cb6fd174fbcf36d (patch) | |
tree | 26c063d765cabca38b4ee8b72ccaece253b62616 /target-i386 | |
parent | d8f771d9124e9a295b564d47d7546d93e844b526 (diff) |
kvm: x86: Only read/write MSR_KVM_ASYNC_PF_EN if supported
If the kernel does not support KVM_CAP_ASYNC_PF, it also does not know
about the related MSR. So skip it during state synchronization in that
case. Fixes annoying kernel warnings.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'target-i386')
-rw-r--r-- | target-i386/kvm.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/target-i386/kvm.c b/target-i386/kvm.c index b2c5ee0efe..8e8880a92b 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -63,6 +63,9 @@ const KVMCapabilityInfo kvm_arch_required_capabilities[] = { static bool has_msr_star; static bool has_msr_hsave_pa; +#if defined(CONFIG_KVM_PARA) && defined(KVM_CAP_ASYNC_PF) +static bool has_msr_async_pf_en; +#endif static int lm_capable_kernel; static struct kvm_cpuid2 *try_get_cpuid(KVMState *s, int max) @@ -164,6 +167,7 @@ static int get_para_features(CPUState *env) features |= (1 << para_features[i].feature); } } + has_msr_async_pf_en = features & (1 << KVM_FEATURE_ASYNC_PF); return features; } #endif @@ -828,7 +832,10 @@ static int kvm_put_msrs(CPUState *env, int level) env->system_time_msr); kvm_msr_entry_set(&msrs[n++], MSR_KVM_WALL_CLOCK, env->wall_clock_msr); #if defined(CONFIG_KVM_PARA) && defined(KVM_CAP_ASYNC_PF) - kvm_msr_entry_set(&msrs[n++], MSR_KVM_ASYNC_PF_EN, env->async_pf_en_msr); + if (has_msr_async_pf_en) { + kvm_msr_entry_set(&msrs[n++], MSR_KVM_ASYNC_PF_EN, + env->async_pf_en_msr); + } #endif } #ifdef KVM_CAP_MCE @@ -1064,7 +1071,9 @@ static int kvm_get_msrs(CPUState *env) msrs[n++].index = MSR_KVM_SYSTEM_TIME; msrs[n++].index = MSR_KVM_WALL_CLOCK; #if defined(CONFIG_KVM_PARA) && defined(KVM_CAP_ASYNC_PF) - msrs[n++].index = MSR_KVM_ASYNC_PF_EN; + if (has_msr_async_pf_en) { + msrs[n++].index = MSR_KVM_ASYNC_PF_EN; + } #endif #ifdef KVM_CAP_MCE |