All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Joerg Roedel <joerg.roedel@amd.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>, kvm@vger.kernel.org
Subject: Re: [PATCH 09/13] KVM: SVM: Add intercept checks for remaining group7 instructions
Date: Mon, 28 Mar 2011 14:15:34 +0200	[thread overview]
Message-ID: <4D907BE6.8020202@redhat.com> (raw)
In-Reply-To: <1301309210-11120-10-git-send-email-joerg.roedel@amd.com>

On 03/28/2011 12:46 PM, Joerg Roedel wrote:
> This patch implements the emulator intercept checks for the
> RDTSCP, MONITOR, and MWAIT instructions.
>
> Signed-off-by: Joerg Roedel<joerg.roedel@amd.com>
> ---
>   arch/x86/kvm/emulate.c |   15 +++++++++++++--
>   arch/x86/kvm/svm.c     |    3 +++
>   2 files changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index 8b8f63d..e0eed4c 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -2366,6 +2366,12 @@ static int em_mov(struct x86_emulate_ctxt *ctxt)
>   		D2bv(((_f)&  ~Lock) | DstAcc | SrcImm)
>
>
> +static struct opcode group7_rm1[] = {
> +	DI(SrcNone | ModRM | Priv, monitor),
> +	DI(SrcNone | ModRM | Priv, mwait),

Note these are unprivileged if magic msr c0010015 is tweaked.  I don't 
think we support the enabled setting.

> +	N, N, N, N, N, N,
> +};
> +
>   static struct opcode group7_rm3[] = {
>   	DI(SrcNone | ModRM | Priv, vmrun),
>   	DI(SrcNone | ModRM | Priv, vmmcall),
> @@ -2377,6 +2383,11 @@ static struct opcode group7_rm3[] = {
>   	DI(SrcNone | ModRM | Priv, invlpga),
>   };
>
> +static struct opcode group7_rm7[] = {
> +	N,
> +	DI(SrcNone | ModRM, rdtscp),

Need to check cr4.tsd before the intercept.

> +	N, N, N, N, N, N,
> +};
>   static struct opcode group1[] = {
>   	X7(D(Lock)), N
>   };
> @@ -2419,10 +2430,10 @@ static struct group_dual group7 = { {
>   	DI(SrcMem16 | ModRM | Mov | Priv, lmsw),
>   	DI(SrcMem | ModRM | ByteOp | Priv | NoAccess, invlpg),
>   }, {
> -	D(SrcNone | ModRM | Priv | VendorSpecific), N,
> +	D(SrcNone | ModRM | Priv | VendorSpecific), EXT(0, group7_rm1),
>   	N, EXT(0, group7_rm3),
>   	DI(SrcNone | ModRM | DstMem | Mov, smsw), N,
> -	DI(SrcMem16 | ModRM | Mov | Priv, lmsw), N,
> +	DI(SrcMem16 | ModRM | Mov | Priv, lmsw), EXT(0, group7_rm7),
>   } };
>
>   static struct opcode group8[] = {
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 9b22f5f..2853625 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -3904,6 +3904,9 @@ static struct __x86_intercept {
>   	[x86_intercept_clgi]		= POST_EX(SVM_EXIT_CLGI),
>   	[x86_intercept_skinit]		= POST_EX(SVM_EXIT_SKINIT),
>   	[x86_intercept_invlpga]		= POST_EX(SVM_EXIT_INVLPGA),
> +	[x86_intercept_rdtscp]		= POST_EX(SVM_EXIT_RDTSCP),
> +	[x86_intercept_monitor]		= POST_MEM(SVM_EXIT_MONITOR),
> +	[x86_intercept_mwait]		= POST_EX(SVM_EXIT_MWAIT),
>   };
>
>   #undef POST_EX


-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2011-03-28 12:15 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-28 10:46 [PATCH 0/13] KVM: Make the instruction emulator aware of Nested Virtualization v3 Joerg Roedel
2011-03-28 10:46 ` [PATCH 01/13] KVM: x86 emulator: add framework for instruction intercepts Joerg Roedel
2011-03-28 10:46 ` [PATCH 02/13] KVM: x86 emulator: add SVM intercepts Joerg Roedel
2011-03-28 10:46 ` [PATCH 03/13] KVM: X86: Don't write-back cpu-state on X86EMUL_INTERCEPTED Joerg Roedel
2011-03-28 10:46 ` [PATCH 04/13] KVM: X86: Add x86 callback for intercept check Joerg Roedel
2011-03-28 10:46 ` [PATCH 05/13] KVM: SVM: Add intercept check for emulated cr accesses Joerg Roedel
2011-03-28 10:46 ` [PATCH 06/13] KVM: SVM: Add intercept check for accessing dr registers Joerg Roedel
2011-03-28 10:46 ` [PATCH 07/13] KVM: SVM: Add intercept checks for descriptor table accesses Joerg Roedel
2011-03-28 12:35   ` Avi Kivity
2011-03-28 13:56     ` Roedel, Joerg
2011-03-28 14:34       ` Avi Kivity
2011-03-28 10:46 ` [PATCH 08/13] KVM: SVM: Add intercept checks for SVM instructions Joerg Roedel
2011-03-28 12:08   ` Avi Kivity
2011-03-28 12:18     ` Roedel, Joerg
2011-03-28 10:46 ` [PATCH 09/13] KVM: SVM: Add intercept checks for remaining group7 instructions Joerg Roedel
2011-03-28 12:15   ` Avi Kivity [this message]
2011-03-28 10:46 ` [PATCH 10/13] KVM: SVM: Add intercept checks for remaining twobyte instructions Joerg Roedel
2011-03-28 12:29   ` Avi Kivity
2011-03-28 10:46 ` [PATCH 11/13] KVM: SVM: Add intercept checks for one-byte instructions Joerg Roedel
2011-03-28 10:46 ` [PATCH 12/13] KVM: SVM: Add checks for IO instructions Joerg Roedel
2011-03-28 12:28   ` Avi Kivity
2011-03-31  7:14     ` Roedel, Joerg
2011-03-31  9:18       ` Avi Kivity
2011-03-31  9:42         ` Roedel, Joerg
2011-03-31 10:03           ` Avi Kivity
2011-03-31 10:28             ` Roedel, Joerg
2011-03-28 10:46 ` [PATCH 13/13] KVM: SVM: Remove nested sel_cr0_write handling code Joerg Roedel
  -- strict thread matches above, loose matches on Subject: below --
2011-03-25  9:29 [PATCH 0/13] KVM: Make the instruction emulator aware of Nested Virtualization v2 Joerg Roedel
2011-03-25  9:29 ` [PATCH 09/13] KVM: SVM: Add intercept checks for remaining group7 instructions Joerg Roedel

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=4D907BE6.8020202@redhat.com \
    --to=avi@redhat.com \
    --cc=joerg.roedel@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.