public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Gleb Natapov <gleb@redhat.com>
Cc: KVM <kvm@vger.kernel.org>, Paolo Bonzini <pbonzini@redhat.com>,
	Andre Przywara <andre@andrep.de>,
	"H. Peter Anvin" <hpa@zytor.com>, X86 ML <x86@kernel.org>,
	Borislav Petkov <bp@suse.de>
Subject: Re: [PATCH 4/4] kvm: Emulate MOVBE
Date: Tue, 16 Jul 2013 00:41:15 +0200	[thread overview]
Message-ID: <20130715224115.GE14503@pd.tnic> (raw)
In-Reply-To: <20130715223930.GD14503@pd.tnic>

Fix kvm ML already.

On Tue, Jul 16, 2013 at 12:39:30AM +0200, Borislav Petkov wrote:
> On Sun, Jul 07, 2013 at 01:18:27PM +0300, Gleb Natapov wrote:
> > KVM does not enables emulation because QEMU called
> > KVM_GET_EMULATED_CPUID. KVM enables emulation because QEMU sets
> > MOVBE bit in a guest visible cpuid using KVM_SET_CPUID2. QEMU does
> > that either because host and cpu model QEMU uses both have it, or
> > because user asked for it specifically and KVM reports that it can
> > be emulated. Why emulator should care what is the reason MOVBE is
> > enabled?
> 
> Ok, I think I know what you mean:
> 
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index 6fe5a838116a..c963ff8e43dd 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -3147,10 +3147,18 @@ static int em_mov(struct x86_emulate_ctxt *ctxt)
>         return X86EMUL_CONTINUE;
>  }
>  
> +#undef F
> +#define F(x) bit(X86_FEATURE_##x)
> +
>  static int em_movbe(struct x86_emulate_ctxt *ctxt)
>  {
> +       u32 ebx, ecx, edx, eax = 1;
>         u16 tmp;
>  
> +       ctxt->ops->get_cpuid(ctxt, &eax, &ebx, &ecx, &edx);
> +       if (!(ecx & F(MOVBE)))
> +               return X86EMUL_PROPAGATE_FAULT;
> +
>         switch (ctxt->op_bytes) {
>         case 2:
>                 /*
> ---
> 
> Right?

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

       reply	other threads:[~2013-07-15 22:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20130625111937.GP18508@redhat.com>
     [not found] ` <20130702105758.GF4535@pd.tnic>
     [not found]   ` <20130702115122.GA28872@redhat.com>
     [not found]     ` <20130702131910.GG4535@pd.tnic>
     [not found]       ` <20130702141606.GB18489@redhat.com>
     [not found]         ` <20130706122739.GB7149@pd.tnic>
     [not found]           ` <20130707093552.GV5113@redhat.com>
     [not found]             ` <20130707100023.GB27168@pd.tnic>
     [not found]               ` <20130707101826.GW5113@redhat.com>
     [not found]                 ` <20130715223930.GD14503@pd.tnic>
2013-07-15 22:41                   ` Borislav Petkov [this message]
2013-07-16  6:04                     ` [PATCH 4/4] kvm: Emulate MOVBE Gleb Natapov

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=20130715224115.GE14503@pd.tnic \
    --to=bp@alien8.de \
    --cc=andre@andrep.de \
    --cc=bp@suse.de \
    --cc=gleb@redhat.com \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=x86@kernel.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