public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mask out clflush
@ 2008-07-08 18:29 Glauber Costa
  2008-07-08 19:34 ` Anthony Liguori
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Glauber Costa @ 2008-07-08 18:29 UTC (permalink / raw)
  To: kvm; +Cc: glommer, avi

clflush is a non-privileged instruction that flushes the cacheline
given by its parameter, in terms of linear address. As it is non-privileged,
it is quite tricky, because a guest doing clflush will actually be trying to
flush a host kernel address.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
 qemu/qemu-kvm-x86.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/qemu/qemu-kvm-x86.c b/qemu/qemu-kvm-x86.c
index 5daedd1..7f90fc2 100644
--- a/qemu/qemu-kvm-x86.c
+++ b/qemu/qemu-kvm-x86.c
@@ -505,13 +505,17 @@ static void do_cpuid_ent(struct kvm_cpuid_entry *e, uint32_t function,
 	e->ecx = bcd[1];
 	e->edx = bcd[2];
     }
-    // "Hypervisor present" bit for Microsoft guests
-    if (function == 1)
-	e->ecx |= (1u << 31);
+
+    if (function == 1) {
+        // "Hypervisor present" bit for Microsoft guests
+        e->ecx |= (1u << 31);
+        e->edx &= ~(1u << 19);
+    }
 
     // 3dnow isn't properly emulated yet
     if (function == 0x80000001)
-	e->edx &= ~0xc0000000;
+        e->edx &= ~0xc0000000;
+
 }
 
 struct kvm_para_features {
-- 
1.5.5.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2008-07-13  7:58 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-08 18:29 [PATCH] mask out clflush Glauber Costa
2008-07-08 19:34 ` Anthony Liguori
2008-07-08 20:01   ` Glauber Costa
2008-07-10 10:43 ` Yang, Sheng
2008-07-10 13:30   ` Anthony Liguori
2008-07-10 13:34     ` Avi Kivity
2008-07-10 13:37       ` Anthony Liguori
2008-07-10 14:10         ` Avi Kivity
2008-07-10 14:20           ` Anthony Liguori
2008-07-10 14:45             ` Glauber Costa
2008-07-10 14:47               ` Avi Kivity
2008-07-10 15:37                 ` Anthony Liguori
2008-07-10 15:39                   ` Avi Kivity
2008-07-10 20:18                     ` Glauber Costa
2008-07-13  7:58                       ` Avi Kivity
2008-07-10 14:16 ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox