summaryrefslogtreecommitdiff
path: root/target-i386
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2016-09-26 19:11:14 -0300
committerEduardo Habkost <ehabkost@redhat.com>2016-09-27 17:03:34 -0300
commitaec661de86894e914d2d82431d9cefa9a9a40213 (patch)
treecf0760106bc774f186e05530d188b6b7f875ffb0 /target-i386
parent3ddcd2edc8ca708ccd808a78424b9aadebd4f7c4 (diff)
downloadqemu-aec661de86894e914d2d82431d9cefa9a9a40213.tar.gz
target-i386: Clear KVM CPUID features if KVM is disabled
This will ensure all checks for features[FEAT_KVM] in the code will be correct in case the KVM CPUID leaf is completely disabled. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'target-i386')
-rw-r--r--target-i386/cpu.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index ad09246d59..333309b9a7 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -3038,6 +3038,10 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
cpu->env.features[w] &= ~minus_features[w];
}
+ if (!kvm_enabled() || !cpu->expose_kvm) {
+ env->features[FEAT_KVM] = 0;
+ }
+
x86_cpu_enable_xsave_components(cpu);
/* CPUID[EAX=7,ECX=0].EBX always increased level automatically: */