qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org
Cc: kvm@vger.kernel.org, Gleb Natapov <gleb@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	mtosatti@redhat.com, Blue Swirl <blauwirbel@gmail.com>,
	Jan Kiszka <jan.kiszka@web.de>,
	avi@redhat.com, Anthony Liguori <anthony@codemonkey.ws>
Subject: [Qemu-devel] [QEMU 1.2 PATCH] i386: kvm: have a predefined set of default KVM feature bits
Date: Wed, 29 Aug 2012 12:04:25 -0300	[thread overview]
Message-ID: <1346252665-9373-1-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <20120829144157.GH6223@otherpad.lan.raisama.net>

We can't simply expose the GET_SUPPORTED_CPUID results directly to the
guest, or the resulting guest-visible CPUID bits may change under the
guest's feet when we live-migrate.

We still have to implement proper per-machine-type migration
compatibility bits, but this at least is a workaround for cases where PV
EOI would be silently enabled after a host kernel upgrade.

We also have to implement proper check/warnings about unsupported bits
when using "-cpu check" or "-cpu enforce", because the default bits may
be silently disabled if the host kernel doesn't support them.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 target-i386/cpu.c | 18 +++++++++++++++++-
 target-i386/cpu.h | 10 ++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 120a2e3..52042f0 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -283,6 +283,21 @@ typedef struct x86_def_t {
           CPUID_EXT3_CR8LEG | CPUID_EXT3_ABM | CPUID_EXT3_SSE4A)
 #define TCG_SVM_FEATURES 0
 
+
+/* List of KVM features we (try to) enable by default
+ * 
+ * CPUID_KVM_PV_EOI is not enabled until we have proper per-machine-type
+ * migration compatibility support
+ * 
+ * CPUID_KVM_MMU is not enabled because it is deprecated.
+ */
+#define DEFAULT_KVM_FEATURES (CPUID_KVM_CLOCKSOURCE | \
+                              CPUID_KVM_KVM_NOP_IO_DELAY | \
+                              CPUID_KVM_CLOCKSOURCE2 | \
+                              CPUID_KVM_KVM_ASYNC_PF | \
+                              CPUID_KVM_STEAL_TIME | \
+                              CPUID_KVM_CLOCKSOURCE_STABLE_BIT)
+
 /* maintains list of cpu model definitions
  */
 static x86_def_t *x86_defs = {NULL};
@@ -887,7 +902,8 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_model)
         memcpy(x86_cpu_def, def, sizeof(*def));
     }
 
-    plus_kvm_features = ~0; /* not supported bits will be filtered out later */
+    /* not supported bits will be filtered out later */
+    plus_kvm_features = DEFAULT_KVM_FEATURES;
 
     add_flagname_to_bitmaps("hypervisor", &plus_features,
         &plus_ext_features, &plus_ext2_features, &plus_ext3_features,
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 60f9e97..5ce4baf 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -440,6 +440,16 @@
 #define CPUID_SVM_PAUSEFILTER  (1 << 10)
 #define CPUID_SVM_PFTHRESHOLD  (1 << 12)
 
+/* CPUID[4000_0001h].EAX bits: */
+#define CPUID_KVM_CLOCKSOURCE             (1 << 0)
+#define CPUID_KVM_KVM_NOP_IO_DELAY        (1 << 1)
+#define CPUID_KVM_MMU                     (1 << 2)
+#define CPUID_KVM_CLOCKSOURCE2            (1 << 3)
+#define CPUID_KVM_KVM_ASYNC_PF            (1 << 4)
+#define CPUID_KVM_STEAL_TIME              (1 << 5)
+#define CPUID_KVM_KVM_PV_EOI              (1 << 6)
+#define CPUID_KVM_CLOCKSOURCE_STABLE_BIT  (1 << 24)
+
 #define CPUID_VENDOR_INTEL_1 0x756e6547 /* "Genu" */
 #define CPUID_VENDOR_INTEL_2 0x49656e69 /* "ineI" */
 #define CPUID_VENDOR_INTEL_3 0x6c65746e /* "ntel" */
-- 
1.7.11.4

  reply	other threads:[~2012-08-29 15:03 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-28 17:43 [Qemu-devel] [PATCHv4 0/4] migrate PV EOI MSR Michael S. Tsirkin
2012-08-28 17:43 ` [Qemu-devel] [PATCHv4 1/4] linux-headers: update to 3.6-rc3 Michael S. Tsirkin
2012-08-28 17:43 ` [Qemu-devel] [PATCHv4 2/4] pc: refactor compat code Michael S. Tsirkin
2012-08-29 14:49   ` Anthony Liguori
2012-08-28 17:43 ` [Qemu-devel] [PATCHv4 3/4] cpuid: disable pv eoi for 1.1 and older compat types Michael S. Tsirkin
2012-08-28 19:13   ` Eduardo Habkost
2012-08-28 21:35     ` Michael S. Tsirkin
2012-08-28 22:02       ` Eduardo Habkost
2012-08-28 22:21         ` Michael S. Tsirkin
2012-08-28 22:25           ` Michael S. Tsirkin
2012-08-28 23:50             ` Eduardo Habkost
2012-08-29 10:06               ` Michael S. Tsirkin
2012-08-29 12:56                 ` Eduardo Habkost
2012-08-29 13:18                   ` Michael S. Tsirkin
2012-08-29 13:49                     ` Eduardo Habkost
2012-08-29 14:11                       ` Michael S. Tsirkin
2012-08-29 14:21                         ` Eduardo Habkost
2012-08-29  9:59           ` Marcelo Tosatti
2012-08-29 10:03             ` Marcelo Tosatti
2012-08-29 10:32               ` Michael S. Tsirkin
2012-08-29 10:23             ` Michael S. Tsirkin
2012-08-29 10:31               ` Michael S. Tsirkin
2012-08-29 14:43       ` Juan Quintela
2012-08-29 13:36   ` Anthony Liguori
2012-08-29 13:40     ` Gleb Natapov
2012-08-29 14:09       ` Anthony Liguori
2012-08-29 14:29         ` Michael S. Tsirkin
2012-08-29 14:41         ` Eduardo Habkost
2012-08-29 15:04           ` Eduardo Habkost [this message]
2012-08-29 15:10             ` [Qemu-devel] [QEMU 1.2 PATCH] i386: kvm: have a predefined set of default KVM feature bits Michael S. Tsirkin
2012-08-29 15:46               ` Marcelo Tosatti
2012-08-29 14:03     ` [Qemu-devel] [PATCHv4 3/4] cpuid: disable pv eoi for 1.1 and older compat types Eduardo Habkost
2012-08-28 17:43 ` [Qemu-devel] [PATCHv4 4/4] kvm: get/set PV EOI MSR Michael S. Tsirkin

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=1346252665-9373-1-git-send-email-ehabkost@redhat.com \
    --to=ehabkost@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=gleb@redhat.com \
    --cc=jan.kiszka@web.de \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=mtosatti@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).