public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sheng Yang <sheng@linux.intel.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Avi Kivity <avi@redhat.com>, kvm@vger.kernel.org
Subject: Re: [PATCH 4/4] KVM: VMX: Enable EPT 1GB page support
Date: Wed, 6 Jan 2010 17:25:27 +0800	[thread overview]
Message-ID: <201001061725.27571.sheng@linux.intel.com> (raw)
In-Reply-To: <20100106091915.GA4553@amt.cnet>

On Wednesday 06 January 2010 17:19:15 Marcelo Tosatti wrote:
> On Tue, Jan 05, 2010 at 07:02:29PM +0800, Sheng Yang wrote:
> > Signed-off-by: Sheng Yang <sheng@linux.intel.com>
> > ---
> >  arch/x86/include/asm/vmx.h |    1 +
> >  arch/x86/kvm/mmu.c         |    8 +++++---
> >  arch/x86/kvm/vmx.c         |   11 ++++++++++-
> >  3 files changed, 16 insertions(+), 4 deletions(-)
> >
> > diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h
> > index 713ed9a..43f1e9b 100644
> > --- a/arch/x86/include/asm/vmx.h
> > +++ b/arch/x86/include/asm/vmx.h
> > @@ -364,6 +364,7 @@ enum vmcs_field {
> >  #define VMX_EPTP_UC_BIT				(1ull << 8)
> >  #define VMX_EPTP_WB_BIT				(1ull << 14)
> >  #define VMX_EPT_2MB_PAGE_BIT			(1ull << 16)
> > +#define VMX_EPT_1GB_PAGE_BIT			(1ull << 17)
> >  #define VMX_EPT_EXTENT_INDIVIDUAL_BIT		(1ull << 24)
> >  #define VMX_EPT_EXTENT_CONTEXT_BIT		(1ull << 25)
> >  #define VMX_EPT_EXTENT_GLOBAL_BIT		(1ull << 26)
> > diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> > index 43cf2ea..9012541 100644
> > --- a/arch/x86/kvm/mmu.c
> > +++ b/arch/x86/kvm/mmu.c
> > @@ -499,8 +499,7 @@ out:
> >  static int mapping_level(struct kvm_vcpu *vcpu, gfn_t large_gfn)
> >  {
> >  	struct kvm_memory_slot *slot;
> > -	int host_level;
> > -	int level = PT_PAGE_TABLE_LEVEL;
> > +	int host_level, level, max_level;
> >
> >  	slot = gfn_to_memslot(vcpu->kvm, large_gfn);
> >  	if (slot && slot->dirty_bitmap)
> > @@ -511,7 +510,10 @@ static int mapping_level(struct kvm_vcpu *vcpu,
> > gfn_t large_gfn) if (host_level == PT_PAGE_TABLE_LEVEL)
> >  		return host_level;
> >
> > -	for (level = PT_DIRECTORY_LEVEL; level <= host_level; ++level)
> > +	max_level = kvm_x86_ops->get_lpage_level() < host_level ?
> > +		kvm_x86_ops->get_lpage_level() : host_level;
> > +
> 
> BUG_ON(kvm_x86_ops->get_lpage_level() < host_level) instead? See
> the if (host_level == PT_PAGE_TABLE_LEVEL) above.
 
Sorry, I don't understand...

Here, EPT can support either 2MB or 1GB page at most, So we represent the 
value through get_lpage_level(). Now 1GB page backed host memory can still 
using by 2MB page backed EPT if 1GB page EPT is not supported in the 
processor.

-- 
regards
Yang, Sheng

  reply	other threads:[~2010-01-06  9:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-05 11:02 [PATCH 0/4 v2] EPT 1GB page support Sheng Yang
2010-01-05 11:02 ` [PATCH 1/4] KVM: x86: Moving PT_*_LEVEL to mmu.h Sheng Yang
2010-01-05 11:02 ` [PATCH 2/4] KVM: x86: Rename gb_page_enable() to get_lpage_level() in kvm_x86_ops Sheng Yang
2010-01-05 11:02 ` [PATCH 3/4] KVM: x86: Fix host_mapping_level() Sheng Yang
2010-01-05 11:02 ` [PATCH 4/4] KVM: VMX: Enable EPT 1GB page support Sheng Yang
2010-01-06  9:19   ` Marcelo Tosatti
2010-01-06  9:25     ` Sheng Yang [this message]
2010-01-06 10:02       ` Marcelo Tosatti

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=201001061725.27571.sheng@linux.intel.com \
    --to=sheng@linux.intel.com \
    --cc=avi@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox