Re: [RFC PATCH 1/7] ARM: KVM: introduce stage2_get_pte

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 20 Feb 2013 15:36:58 -0800, Christoffer Dall
<cdall@xxxxxxxxxxxxxxx> wrote:
> On Wed, Feb 13, 2013 at 03:46:58PM +0000, Marc Zyngier wrote:
>> stage2_set_pte() does too many things:
>> - Walks the page table
>> - Allocating each level as it goes
>> - Tests for I/O mappings
>> - Set the new PTE and takes care of the TLB invalidation
>> 
>> Introduce stage2_get_pte() that only takes care of the first two
>> points. stage2_set_pte() is modified to use stage2_get_pte().
>> 
>> Signed-off-by: Marc Zyngier <marc.zyngier@xxxxxxx>
>> ---
>>  arch/arm/kvm/mmu.c | 23 +++++++++++++++++------
>>  1 file changed, 17 insertions(+), 6 deletions(-)
>> 
>> diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
>> index 2943163..cb2b42e 100644
>> --- a/arch/arm/kvm/mmu.c
>> +++ b/arch/arm/kvm/mmu.c
>> @@ -409,20 +409,19 @@ void kvm_free_stage2_pgd(struct kvm *kvm)
>>  }
>>  
>>  
>> -static int stage2_set_pte(struct kvm *kvm, struct kvm_mmu_memory_cache
>> *cache,
>> -			  phys_addr_t addr, const pte_t *new_pte, bool iomap)
>> +static pte_t *stage2_get_pte(struct kvm *kvm, struct
>> kvm_mmu_memory_cache *cache,
>> +			     phys_addr_t addr)
>>  {
>>  	pgd_t *pgd;
>>  	pud_t *pud;
>>  	pmd_t *pmd;
>> -	pte_t *pte, old_pte;
>>  
>>  	/* Create 2nd stage page table mapping - Level 1 */
>>  	pgd = kvm->arch.pgd + pgd_index(addr);
>>  	pud = pud_offset(pgd, addr);
>>  	if (pud_none(*pud)) {
>>  		if (!cache)
>> -			return 0; /* ignore calls from kvm_set_spte_hva */
>> +			return NULL; /* ignore calls from kvm_set_spte_hva */
>>  		pmd = mmu_memory_cache_alloc(cache);
>>  		pud_populate(NULL, pud, pmd);
>>  		get_page(virt_to_page(pud));
>> @@ -432,15 +431,27 @@ static int stage2_set_pte(struct kvm *kvm, struct
>> kvm_mmu_memory_cache *cache,
> 
> This should call stage2_get_pmd as we discussed.

Agreed. I'll introduce that when I get to rework this patch series after
the merge window.

        M.
-- 
Fast, cheap, reliable. Pick two.
_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/cucslists/listinfo/kvmarm


[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux