All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joerg Roedel <joerg.roedel@amd.com>
To: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <marcelo@kvack.org>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/8] kvm/mmu: add support for another level to page walker
Date: Mon, 22 Jun 2009 11:38:13 +0200	[thread overview]
Message-ID: <20090622093813.GC5139@amd.com> (raw)
In-Reply-To: <4A3CC5D4.7040905@redhat.com>

On Sat, Jun 20, 2009 at 02:19:48PM +0300, Avi Kivity wrote:
> On 06/19/2009 04:16 PM, Joerg Roedel wrote:
>> The page walker may be used with nested paging too when accessing mmio areas.
>> Make it support the additional page-level too.
>>
>> Signed-off-by: Joerg Roedel<joerg.roedel@amd.com>
>> ---
>>   arch/x86/kvm/mmu.c         |    6 ++++++
>>   arch/x86/kvm/paging_tmpl.h |   16 ++++++++++++++++
>>   2 files changed, 22 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
>> index ef2396d..fc0e2fc 100644
>> --- a/arch/x86/kvm/mmu.c
>> +++ b/arch/x86/kvm/mmu.c
>> @@ -117,6 +117,11 @@ module_param(oos_shadow, bool, 0644);
>>   #define PT64_DIR_BASE_ADDR_MASK \
>>   	(PT64_BASE_ADDR_MASK&  ~((1ULL<<  (PAGE_SHIFT + PT64_LEVEL_BITS)) - 1))
>>
>> +#define PT64_PDPE_BASE_ADDR_MASK \
>> +	(PT64_BASE_ADDR_MASK&  ~(1ULL<<  (PAGE_SHIFT + (2 * PT64_LEVEL_BITS))))
>> +#define PT64_PDPE_OFFSET_MASK \
>> +	(PT64_BASE_ADDR_MASK&  (1ULL<<  (PAGE_SHIFT + (2 * PT64_LEVEL_BITS))))
>> +
>>   #define PT32_BASE_ADDR_MASK PAGE_MASK
>>   #define PT32_DIR_BASE_ADDR_MASK \
>>   	(PAGE_MASK&  ~((1ULL<<  (PAGE_SHIFT + PT32_LEVEL_BITS)) - 1))
>> @@ -130,6 +135,7 @@ module_param(oos_shadow, bool, 0644);
>>   #define PFERR_RSVD_MASK (1U<<  3)
>>   #define PFERR_FETCH_MASK (1U<<  4)
>> +static gfn_t gpte_to_gfn_pdpe(pt_element_t gpte)
>> +{
>> +	return (gpte&  PT64_PDPE_BASE_ADDR_MASK)>>  PAGE_SHIFT;
>> +}
>> +
>>   static bool FNAME(cmpxchg_gpte)(struct kvm *kvm,
>>   			 gfn_t table_gfn, unsigned index,
>>   			 pt_element_t orig_pte, pt_element_t new_pte)
>> @@ -201,6 +207,15 @@ walk:
>>   			break;
>>   		}
>>
>> +		if (walker->level == PT_PDPE_LEVEL&&
>> +		    (pte&  PT_PAGE_SIZE_MASK)&&
>> +		    is_long_mode(vcpu)) {
>> +			walker->gfn  = gpte_to_gfn_pdpe(pte);
>> +			walker->gfn += (addr&  PT64_PDPE_OFFSET_MASK)
>> +					>>  PAGE_SHIFT;
>> +			break;
>> +		}
>> +
>>   		pt_access = pte_access;
>>    
>
> It would be cleaner to merge this with the 2MB check earlier (and to  
> rename and parametrise gpte_to_gfn_pde() rather than duplicate it).

Ok, I will merge it into the previous function.

Joerg

-- 
           | Advanced Micro Devices GmbH
 Operating | Karl-Hammerschmidt-Str. 34, 85609 Dornach bei München
 System    | 
 Research  | Geschäftsführer: Thomas M. McCoy, Giuliano Meroni
 Center    | Sitz: Dornach, Gemeinde Aschheim, Landkreis München
           | Registergericht München, HRB Nr. 43632


  reply	other threads:[~2009-06-22  9:39 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-19 13:16 [PATCH 0/8 v3] KVM support for 1GB pages Joerg Roedel
2009-06-19 13:16 ` [PATCH 1/8] hugetlbfs: export vma_kernel_pagsize to modules Joerg Roedel
2009-06-19 13:16 ` [PATCH 2/8] kvm: change memslot data structures for multiple hugepage sizes Joerg Roedel
2009-06-23 16:49   ` Marcelo Tosatti
2009-06-19 13:16 ` [PATCH 3/8] kvm/mmu: rename is_largepage_backed to mapping_level Joerg Roedel
2009-06-23 15:59   ` Marcelo Tosatti
2009-06-23 17:00     ` Joerg Roedel
2009-06-19 13:16 ` [PATCH 4/8] kvm/mmu: make rmap code aware of mapping levels Joerg Roedel
2009-06-19 13:16 ` [PATCH 5/8] kvm/mmu: make direct mapping paths " Joerg Roedel
2009-06-23 16:47   ` Marcelo Tosatti
2009-06-23 17:10     ` Joerg Roedel
2009-06-19 13:16 ` [PATCH 6/8] kvm/mmu: add support for another level to page walker Joerg Roedel
2009-06-20 11:19   ` Avi Kivity
2009-06-22  9:38     ` Joerg Roedel [this message]
2009-06-19 13:16 ` [PATCH 7/8] kvm/mmu: enable gbpages by increasing nr of pagesizes Joerg Roedel
2009-06-19 13:16 ` [PATCH 8/8] kvm x86: report 1GB page support to userspace Joerg Roedel
2009-06-20 11:03 ` [PATCH 0/8 v3] KVM support for 1GB pages Avi Kivity
2009-06-22  9:40   ` Joerg Roedel
2009-06-22  9:43     ` Avi Kivity
2009-06-22  9:49       ` Joerg Roedel
2009-06-22  9:55         ` Avi Kivity
2009-06-24  8:43 ` Avi Kivity
2009-06-29 13:17   ` 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=20090622093813.GC5139@amd.com \
    --to=joerg.roedel@amd.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@kvack.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 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.