On Wed, 20 Feb 2013 15:37:14 -0800, Christoffer Dall <cdall@xxxxxxxxxxxxxxx> wrote: > On Wed, Feb 13, 2013 at 03:46:59PM +0000, Marc Zyngier wrote: >> As we carry on deconstructing stage2_set_pte(), introduce a method >> to write a pte at a given location. >> >> Make the prototype similar to the kernel set_pte_at(), so the properties >> are not completely surprising. Convert stage2_set_pte() to make use >> of stage_set_pte_at(). >> >> Signed-off-by: Marc Zyngier <marc.zyngier@xxxxxxx> >> --- >> arch/arm/kvm/mmu.c | 24 ++++++++++++++++-------- >> 1 file changed, 16 insertions(+), 8 deletions(-) >> >> diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c >> index cb2b42e..ab35906 100644 >> --- a/arch/arm/kvm/mmu.c >> +++ b/arch/arm/kvm/mmu.c >> @@ -444,10 +444,24 @@ static pte_t *stage2_get_pte(struct kvm *kvm, >> struct kvm_mmu_memory_cache *cache >> return pte_offset_kernel(pmd, addr); >> } >> >> +static void stage2_set_pte_at(struct kvm *kvm, phys_addr_t addr, >> + pte_t *pte, const pte_t pteval) >> +{ >> + pte_t old_pte; >> + >> + /* Create 2nd stage page table mapping - Level 3 */ >> + old_pte = *pte; >> + kvm_set_pte(pte, pteval); >> + if (pte_present(old_pte)) >> + kvm_tlb_flush_vmid_ipa(kvm, addr); >> + else >> + get_page(virt_to_page(pte)); >> +} > > what's the reason between this level of indirection? We already have > quite a few xxx_set_pte_xxx functions, ... The idea is to be able to perform a read-modify write on an PTE. At the moment, we can only write a full PTE. M. -- Fast, cheap, reliable. Pick two. _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/cucslists/listinfo/kvmarm