From patchwork Mon Sep 26 22:24:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 9351345 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C93686077B for ; Mon, 26 Sep 2016 22:28:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA63B28E78 for ; Mon, 26 Sep 2016 22:28:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF07C28E7B; Mon, 26 Sep 2016 22:28:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5CF7028E78 for ; Mon, 26 Sep 2016 22:28:22 +0000 (UTC) Received: from localhost ([::1]:46919 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1boeNp-00023l-Go for patchwork-qemu-devel@patchwork.kernel.org; Mon, 26 Sep 2016 18:28:21 -0400 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 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CD8983D967; Mon, 26 Sep 2016 22:24:29 +0000 (UTC) Received: from localhost (ovpn-116-174.phx2.redhat.com [10.3.116.174]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8QMOSTC002609; Mon, 26 Sep 2016 18:24:29 -0400 From: Eduardo Habkost To: Paolo Bonzini , Marcelo Tosatti 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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 26 Sep 2016 22:24:29 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 4/5] target-i386: Clear KVM CPUID features if KVM is disabled X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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; }