From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [PATCH] mask out clflush Date: Tue, 08 Jul 2008 14:34:30 -0500 Message-ID: <4873C146.1030503@codemonkey.ws> References: <1215541784-26539-1-git-send-email-gcosta@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, glommer@gmail.com, avi@qumranet.com To: Glauber Costa Return-path: Received: from an-out-0708.google.com ([209.85.132.240]:42106 "EHLO an-out-0708.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751620AbYGHTe4 (ORCPT ); Tue, 8 Jul 2008 15:34:56 -0400 Received: by an-out-0708.google.com with SMTP id d40so538655and.103 for ; Tue, 08 Jul 2008 12:34:55 -0700 (PDT) In-Reply-To: <1215541784-26539-1-git-send-email-gcosta@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Glauber Costa wrote: > 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. > Is this the case still with NPT/EPT? Regards, Anthony Liguori > Signed-off-by: Glauber Costa > --- > 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 { >