kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: Gleb Natapov <gleb@redhat.com>
Cc: kvm@vger.kernel.org,
	Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>,
	Jun Nakajima <jun.nakajima@intel.com>,
	Yang Zhang <yang.z.zhang@intel.com>,
	pbonzini@redhat.com
Subject: Re: [PATCH v7 10/15] nEPT: Add nEPT violation/misconfigration support
Date: Tue, 06 Aug 2013 10:01:55 +0200	[thread overview]
Message-ID: <5200AD73.90402@web.de> (raw)
In-Reply-To: <1375690040-5764-11-git-send-email-gleb@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2922 bytes --]

On 2013-08-05 10:07, Gleb Natapov wrote:
> From: Yang Zhang <yang.z.zhang@Intel.com>
> 
> Inject nEPT fault to L1 guest. This patch is original from Xinhao.
> 
> Reviewed-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
> Signed-off-by: Jun Nakajima <jun.nakajima@intel.com>
> Signed-off-by: Xinhao Xu <xinhao.xu@intel.com>
> Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
> Signed-off-by: Gleb Natapov <gleb@redhat.com>
> ---
>  arch/x86/include/asm/kvm_host.h |    4 +++
>  arch/x86/kvm/mmu.c              |   61 ++++++++++++++++++++++++++++++++-------
>  arch/x86/kvm/paging_tmpl.h      |   25 ++++++++++++++--
>  arch/x86/kvm/vmx.c              |   19 ++++++++++++
>  4 files changed, 95 insertions(+), 14 deletions(-)
> 
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index 531f47c..58a17c0 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -286,6 +286,7 @@ struct kvm_mmu {
>  	u64 *pae_root;
>  	u64 *lm_root;
>  	u64 rsvd_bits_mask[2][4];
> +	u64 bad_mt_xwr;
>  
>  	/*
>  	 * Bitmap: bit set = last pte in walk
> @@ -512,6 +513,9 @@ struct kvm_vcpu_arch {
>  	 * instruction.
>  	 */
>  	bool write_fault_to_shadow_pgtable;
> +
> +	/* set at EPT violation at this point */
> +	unsigned long exit_qualification;
>  };
>  
>  struct kvm_lpage_info {
> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> index a512ecf..f2d982d 100644
> --- a/arch/x86/kvm/mmu.c
> +++ b/arch/x86/kvm/mmu.c
> @@ -3519,6 +3519,8 @@ static void reset_rsvds_bits_mask(struct kvm_vcpu *vcpu,
>  	int maxphyaddr = cpuid_maxphyaddr(vcpu);
>  	u64 exb_bit_rsvd = 0;
>  
> +	context->bad_mt_xwr = 0;
> +
>  	if (!context->nx)
>  		exb_bit_rsvd = rsvd_bits(63, 63);
>  	switch (context->root_level) {
> @@ -3574,7 +3576,40 @@ static void reset_rsvds_bits_mask(struct kvm_vcpu *vcpu,
>  	}
>  }
>  
> -static void update_permission_bitmask(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu)
> +static void reset_rsvds_bits_mask_ept(struct kvm_vcpu *vcpu,
> +		struct kvm_mmu *context, bool execonly)
> +{
> +	int maxphyaddr = cpuid_maxphyaddr(vcpu);
> +	int pte;
> +
> +	context->rsvd_bits_mask[0][3] =
> +		rsvd_bits(maxphyaddr, 51) | rsvd_bits(3, 7);
> +	context->rsvd_bits_mask[0][2] =
> +		rsvd_bits(maxphyaddr, 51) | rsvd_bits(3, 6);
> +	context->rsvd_bits_mask[0][1] =
> +		rsvd_bits(maxphyaddr, 51) | rsvd_bits(3, 6);
> +	context->rsvd_bits_mask[0][0] = rsvd_bits(maxphyaddr, 51);
> +
> +	/* large page */
> +	context->rsvd_bits_mask[1][3] = context->rsvd_bits_mask[0][3];
> +	context->rsvd_bits_mask[1][2] =
> +		rsvd_bits(maxphyaddr, 51) | rsvd_bits(12, 29);
> +	context->rsvd_bits_mask[1][1] =
> +		rsvd_bits(maxphyaddr, 51) | rsvd_bits(12, 20);
> +	context->rsvd_bits_mask[1][0] = context->rsvd_bits_mask[0][0];
> +	

Here is a whitespace error (says git am).

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

  reply	other threads:[~2013-08-06  8:01 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-05  8:07 [PATCH v7 00/15] Nested EPT Gleb Natapov
2013-08-05  8:07 ` [PATCH v7 01/15] nEPT: Support LOAD_IA32_EFER entry/exit controls for L1 Gleb Natapov
2013-08-05 11:27   ` Arthur Chunqi Li
2013-08-05 11:40     ` Gleb Natapov
2013-08-06  7:47       ` Jan Kiszka
2013-08-06  7:51         ` Gleb Natapov
2013-08-06  7:55           ` Jan Kiszka
2013-08-06  8:00             ` Gleb Natapov
2013-08-06  8:18               ` Jan Kiszka
2013-08-06  8:24                 ` Gleb Natapov
2013-08-05 11:48     ` Paolo Bonzini
2013-08-05 12:05       ` Gleb Natapov
2013-08-05  8:07 ` [PATCH v7 02/15] nEPT: Fix cr3 handling in nested exit and entry Gleb Natapov
2013-08-05  8:07 ` [PATCH v7 03/15] nEPT: Fix wrong test in kvm_set_cr3 Gleb Natapov
2013-08-05  8:07 ` [PATCH v7 04/15] nEPT: Move common code to paging_tmpl.h Gleb Natapov
2013-08-05  8:07 ` [PATCH v7 05/15] nEPT: make guest's A/D bits depends on guest's paging mode Gleb Natapov
2013-08-05  8:07 ` [PATCH v7 06/15] nEPT: Support shadow paging for guest paging without A/D bits Gleb Natapov
2013-08-05  8:07 ` [PATCH v7 07/15] nEPT: Add EPT tables support to paging_tmpl.h Gleb Natapov
2013-08-05  8:07 ` [PATCH v7 08/15] nEPT: Redefine EPT-specific link_shadow_page() Gleb Natapov
2013-08-05  8:07 ` [PATCH v7 09/15] nEPT: correctly check if remote tlb flush is needed for shadowed EPT tables Gleb Natapov
2013-08-05  8:07 ` [PATCH v7 10/15] nEPT: Add nEPT violation/misconfigration support Gleb Natapov
2013-08-06  8:01   ` Jan Kiszka [this message]
2013-08-06  9:00   ` Gleb Natapov
2013-08-05  8:07 ` [PATCH v7 11/15] nEPT: MMU context for nested EPT Gleb Natapov
2013-08-05  8:07 ` [PATCH v7 12/15] nEPT: Nested INVEPT Gleb Natapov
2013-08-05  8:53   ` Xiao Guangrong
2013-08-05  8:07 ` [PATCH v7 13/15] nEPT: Advertise EPT to L1 Gleb Natapov
2013-08-06  8:20   ` Jan Kiszka
2013-08-06  9:02   ` Gleb Natapov
2013-08-05  8:07 ` [PATCH v7 14/15] nEPT: Some additional comments Gleb Natapov
2013-08-05  8:07 ` [PATCH v7 15/15] nEPT: Miscelleneous cleanups Gleb Natapov
2013-08-07 14:07 ` [PATCH v7 00/15] Nested EPT Paolo Bonzini

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=5200AD73.90402@web.de \
    --to=jan.kiszka@web.de \
    --cc=gleb@redhat.com \
    --cc=jun.nakajima@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=xiaoguangrong@linux.vnet.ibm.com \
    --cc=yang.z.zhang@intel.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 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).