kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sheng Yang <sheng@linux.intel.com>
To: Avi Kivity <avi@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 6/6] Enable MTRR for EPT
Date: Thu, 9 Oct 2008 16:49:34 +0800	[thread overview]
Message-ID: <200810091649.34684.sheng@linux.intel.com> (raw)
In-Reply-To: <48EDC463.7030408@redhat.com>

On Thursday 09 October 2008 16:44:19 Avi Kivity wrote:
> Sheng Yang wrote:
> > The effective memory type of EPT is the mixture of MSR_IA32_CR_PAT and
> > memory type field of EPT entry.
> >
> >
> >
> > @@ -168,6 +168,7 @@ static u64 __read_mostly shadow_x_mask;	/* mutual
> > exclusive with nx_mask */ static u64 __read_mostly shadow_user_mask;
> >  static u64 __read_mostly shadow_accessed_mask;
> >  static u64 __read_mostly shadow_dirty_mask;
> > +static u64 __read_mostly shadow_mt_mask;
>
> For shadow, the mt mask is different based on the level of the page
> table, so we need an array here.  This can of course be left until
> shadow pat is implemented.
>
> > +	if (mt_mask) {
> > +		mt_mask = get_memory_type(vcpu, gfn) <<
> > +			  kvm_x86_ops->get_mt_mask_shift();
> > +		spte |= mt_mask;
> > +	}
>
> For shadow, it's not a simple shift, since for large pages one of the
> bits is at position 12.  So we would need the callback to calculate the
> mask value.
>
> Perhaps even simpler, have a 4x8 array, with the first index the page
> table level and the second index the memory type.  The initialization
> code can prepare the array like it prepares the other masks.
>
> This can wait until we have a shadow pat implementation.

Yes, of course. Now this mask is just used by EPT, so I do it like this. Later 
shadow mtrr/pat would solve this as well. :)

-- 
regards
Yang, Sheng

  reply	other threads:[~2008-10-09  8:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-09  8:01 [PATCH 0/6] MTRR/PAT support for EPT (v3) Sheng Yang
2008-10-09  8:01 ` [PATCH 1/6] x86: Rename mtrr_state struct and macro names Sheng Yang
2008-10-09  8:01 ` [PATCH 2/6] x86: Export some definition of MTRR Sheng Yang
2008-10-09  8:01 ` [PATCH 3/6] KVM: Improve MTRR structure Sheng Yang
2008-10-09  8:01 ` [PATCH 4/6] KVM: VMX: Add PAT support for EPT Sheng Yang
2008-10-09  8:01 ` [PATCH 5/6] Add local get_mtrr_type() to support MTRR Sheng Yang
2008-10-09  8:01 ` [PATCH 6/6] Enable MTRR for EPT Sheng Yang
2008-10-09  8:44   ` Avi Kivity
2008-10-09  8:49     ` Sheng Yang [this message]
2008-10-09  9:03 ` [PATCH 0/6] MTRR/PAT support for EPT (v3) Avi Kivity
2008-10-09  9:26   ` Sheng Yang
2008-10-09 10:12     ` Avi Kivity
2008-10-10  2:46       ` Sheng Yang
2008-10-10  6:49         ` Avi Kivity
2008-10-10  7:16           ` Sheng Yang
2008-10-12  9:47             ` Avi Kivity

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=200810091649.34684.sheng@linux.intel.com \
    --to=sheng@linux.intel.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.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;
as well as URLs for NNTP newsgroup(s).