qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm@vger.kernel.org, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 4/5] target-i386: Clear KVM CPUID features if KVM is disabled
Date: Mon, 26 Sep 2016 19:24:09 -0300	[thread overview]
Message-ID: <1474928650-22514-5-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1474928650-22514-1-git-send-email-ehabkost@redhat.com>

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 <ehabkost@redhat.com>
---
 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

  parent reply	other threads:[~2016-09-26 22:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-26 22:24 [Qemu-devel] [PATCH 0/5] target-i386: Eliminate unnecessary has_msr_* global variables Eduardo Habkost
2016-09-26 22:24 ` [Qemu-devel] [PATCH 1/5] target-i386: Remove has_msr_mtrr global variable Eduardo Habkost
2016-09-26 22:24 ` [Qemu-devel] [PATCH 2/5] target-i386: Remove has_msr_hv_apic " Eduardo Habkost
2016-09-26 22:24 ` [Qemu-devel] [PATCH 3/5] target-i386: Remove has_msr_hv_tsc " Eduardo Habkost
2016-09-26 22:24 ` Eduardo Habkost [this message]
2016-09-26 22:24 ` [Qemu-devel] [PATCH 5/5] target-i386: Remove has_msr_* global vars for KVM features Eduardo Habkost
2016-09-27  8:51 ` [Qemu-devel] [PATCH 0/5] target-i386: Eliminate unnecessary has_msr_* global variables Paolo Bonzini
2016-09-27 12:44   ` Eduardo Habkost

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1474928650-22514-5-git-send-email-ehabkost@redhat.com \
    --to=ehabkost@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).