From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eduardo Habkost Subject: [PATCH 4/5] target-i386: Clear KVM CPUID features if KVM is disabled Date: Mon, 26 Sep 2016 19:24:09 -0300 Message-ID: <1474928650-22514-5-git-send-email-ehabkost@redhat.com> References: <1474928650-22514-1-git-send-email-ehabkost@redhat.com> Cc: kvm@vger.kernel.org, qemu-devel@nongnu.org To: Paolo Bonzini , Marcelo Tosatti Return-path: Received: from mx1.redhat.com ([209.132.183.28]:42906 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754450AbcIZWYa (ORCPT ); Mon, 26 Sep 2016 18:24:30 -0400 In-Reply-To: <1474928650-22514-1-git-send-email-ehabkost@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: This will ensure all checks for features[FEAT_KVM] in the code will be correct in case the KVM CPUID leaf is completely disabled. 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 db12728..8aa2b0f 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -2998,6 +2998,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; + } + if (env->features[FEAT_7_0_EBX] && env->cpuid_level < 7) { env->cpuid_level = 7; } -- 2.7.4 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56087) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1boeK8-0007Ss-AC for qemu-devel@nongnu.org; Mon, 26 Sep 2016 18:24:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1boeK6-0001IR-Hj for qemu-devel@nongnu.org; Mon, 26 Sep 2016 18:24:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44260) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1boeK6-0001IF-C3 for qemu-devel@nongnu.org; Mon, 26 Sep 2016 18:24:30 -0400 From: Eduardo Habkost Date: Mon, 26 Sep 2016 19:24:09 -0300 Message-Id: <1474928650-22514-5-git-send-email-ehabkost@redhat.com> In-Reply-To: <1474928650-22514-1-git-send-email-ehabkost@redhat.com> References: <1474928650-22514-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH 4/5] target-i386: Clear KVM CPUID features if KVM is disabled List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , Marcelo Tosatti Cc: kvm@vger.kernel.org, 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. 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 db12728..8aa2b0f 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -2998,6 +2998,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; + } + if (env->features[FEAT_7_0_EBX] && env->cpuid_level < 7) { env->cpuid_level = 7; } -- 2.7.4