On Wed, 20 Feb 2013 15:37:26 -0800, Christoffer Dall <cdall@xxxxxxxxxxxxxxx> wrote: > On Wed, Feb 13, 2013 at 03:47:00PM +0000, Marc Zyngier wrote: >> Simplify stage2_set_pte() by removing the IO mapping handling. >> kvm_phys_addr_ioremap() now directly calls stage2_get_pte() and >> stage2_set_pte_at(). >> >> This allows for the removal of the iomap flag in stage2_set_pte() >> prototype. >> >> Signed-off-by: Marc Zyngier <marc.zyngier@xxxxxxx> >> --- >> arch/arm/kvm/mmu.c | 22 +++++++++++----------- >> 1 file changed, 11 insertions(+), 11 deletions(-) >> >> diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c >> index ab35906..8fde75b 100644 >> --- a/arch/arm/kvm/mmu.c >> +++ b/arch/arm/kvm/mmu.c >> @@ -459,18 +459,13 @@ static void stage2_set_pte_at(struct kvm *kvm, >> phys_addr_t addr, >> } >> >> 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) >> + phys_addr_t addr, const pte_t *new_pte) >> { >> pte_t *pte; >> >> pte = stage2_get_pte(kvm, cache, addr); >> - if (!pte) >> - return 0; >> - >> - if (iomap && pte_present(*pte)) >> - return -EFAULT; >> - >> - stage2_set_pte_at(kvm, addr, pte, *new_pte); >> + if (pte) >> + stage2_set_pte_at(kvm, addr, pte, *new_pte); > > this should never happen now right? I think we can get rid of this > function (but I think stage2_set_pte_at should be named stage2_set_pte). It does happen. See the call site in kvm_set_spte_handler, which calls stage_set_pte with a NULL memory cache. As for the name, stage2_set_pte is what I'm trying to get rid off, so calling the new function the same would be counter productive... ;-) Furthermore, set_pte_at is the kernel function to do a similar operation on a stage-1 page table. Consistency is important IMHO. M. -- Fast, cheap, reliable. Pick two. _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/cucslists/listinfo/kvmarm