On Friday 14 Jan 2022 at 12:50:38 (+0000), Marc Zyngier wrote: > CMOs issued from EL2 cannot directly use the kernel helpers, > as EL2 doesn't have a mapping of the guest pages. Oops. > > Instead, use the mm_ops indirection to use helpers that will > perform a mapping at EL2 and allow the CMO to be effective. Right, we were clearly lucky not to use those paths at EL2 _yet_, but that's going to change soon and this is better for consistency, so: Reviewed-by: Quentin Perret <qperret@xxxxxxxxxx> > Fixes: 25aa28691bb9 ("KVM: arm64: Move guest CMOs to the fault handlers") > Signed-off-by: Marc Zyngier <maz@xxxxxxxxxx> > --- > arch/arm64/kvm/hyp/pgtable.c | 18 ++++++------------ > 1 file changed, 6 insertions(+), 12 deletions(-) > > diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c > index 844a6f003fd5..2cb3867eb7c2 100644 > --- a/arch/arm64/kvm/hyp/pgtable.c > +++ b/arch/arm64/kvm/hyp/pgtable.c > @@ -983,13 +983,9 @@ static int stage2_unmap_walker(u64 addr, u64 end, u32 level, kvm_pte_t *ptep, > */ > stage2_put_pte(ptep, mmu, addr, level, mm_ops); > > - if (need_flush) { > - kvm_pte_t *pte_follow = kvm_pte_follow(pte, mm_ops); > - > - dcache_clean_inval_poc((unsigned long)pte_follow, > - (unsigned long)pte_follow + > - kvm_granule_size(level)); > - } > + if (need_flush && mm_ops->dcache_clean_inval_poc) > + mm_ops->dcache_clean_inval_poc(kvm_pte_follow(pte, mm_ops), > + kvm_granule_size(level)); > > if (childp) > mm_ops->put_page(childp); > @@ -1151,15 +1147,13 @@ static int stage2_flush_walker(u64 addr, u64 end, u32 level, kvm_pte_t *ptep, > struct kvm_pgtable *pgt = arg; > struct kvm_pgtable_mm_ops *mm_ops = pgt->mm_ops; > kvm_pte_t pte = *ptep; > - kvm_pte_t *pte_follow; > > if (!kvm_pte_valid(pte) || !stage2_pte_cacheable(pgt, pte)) > return 0; > > - pte_follow = kvm_pte_follow(pte, mm_ops); > - dcache_clean_inval_poc((unsigned long)pte_follow, > - (unsigned long)pte_follow + > - kvm_granule_size(level)); > + if (mm_ops->dcache_clean_inval_poc) > + mm_ops->dcache_clean_inval_poc(kvm_pte_follow(pte, mm_ops), > + kvm_granule_size(level)); > return 0; > } > > -- > 2.30.2 > _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/mailman/listinfo/kvmarm