Skip to content

Commit a9c0e12

Browse files
Marc Zyngierchazy
authored andcommitted
KVM: arm/arm64: Only clean the dcache on translation fault
The only case where we actually need to perform a dcache maintenance is when we map the page for the first time, and subsequent permission faults do not require cache maintenance. Let's make it conditional on not being a permission fault (and thus a translation fault). Reviewed-by: Christoffer Dall <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Signed-off-by: Christoffer Dall <[email protected]>
1 parent d0e22b4 commit a9c0e12

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

virt/kvm/arm/mmu.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,7 +1400,9 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
14001400
new_pmd = kvm_s2pmd_mkwrite(new_pmd);
14011401
kvm_set_pfn_dirty(pfn);
14021402
}
1403-
clean_dcache_guest_page(vcpu, pfn, PMD_SIZE);
1403+
1404+
if (fault_status != FSC_PERM)
1405+
clean_dcache_guest_page(vcpu, pfn, PMD_SIZE);
14041406

14051407
if (exec_fault) {
14061408
new_pmd = kvm_s2pmd_mkexec(new_pmd);
@@ -1416,7 +1418,9 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
14161418
kvm_set_pfn_dirty(pfn);
14171419
mark_page_dirty(kvm, gfn);
14181420
}
1419-
clean_dcache_guest_page(vcpu, pfn, PAGE_SIZE);
1421+
1422+
if (fault_status != FSC_PERM)
1423+
clean_dcache_guest_page(vcpu, pfn, PAGE_SIZE);
14201424

14211425
if (exec_fault) {
14221426
new_pte = kvm_s2pte_mkexec(new_pte);

0 commit comments

Comments
 (0)