Received: from eggs.gnu.org ([2001:4830:134:3::10]:55593) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1boykh-0003wi-Tt for qemu-devel@nongnu.org; Tue, 27 Sep 2016 16:13:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1boyke-0007ZW-Lv for qemu-devel@nongnu.org; Tue, 27 Sep 2016 16:13:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40114) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1boyke-0007Ym-FP for qemu-devel@nongnu.org; Tue, 27 Sep 2016 16:13:16 -0400 From: Eduardo Habkost Date: Tue, 27 Sep 2016 17:12:28 -0300 Message-Id: <1475007150-14665-19-git-send-email-ehabkost@redhat.com> In-Reply-To: <1475007150-14665-1-git-send-email-ehabkost@redhat.com> References: <1475007150-14665-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PULL 18/20] target-i386: Clear KVM CPUID features if KVM is disabled List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Paolo Bonzini , Richard Henderson , qemu-devel@nongnu.org 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 Signed-off-by: Eduardo Habkost --- target-i386/cpu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index ad09246..333309b 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: */ -- 2.7.4