aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kvm/mmu.c
diff options
context:
space:
mode:
authorMarc Zyngier <marc.zyngier@arm.com>2014-01-14 14:13:10 -0500
committerMarc Zyngier <marc.zyngier@arm.com>2014-03-02 20:15:20 -0500
commit2d58b733c87689d3d5144e4ac94ea861cc729145 (patch)
treeedd6af8c4b9f314684b372712babfb8abb323450 /arch/arm/kvm/mmu.c
parent1b385cbdd74aa803e966e01e5fe49490d6044e30 (diff)
arm64: KVM: force cache clean on page fault when caches are off
In order for the guest with caches off to observe data written contained in a given page, we need to make sure that page is committed to memory, and not just hanging in the cache (as guest accesses are completely bypassing the cache until it decides to enable it). For this purpose, hook into the coherent_icache_guest_page function and flush the region if the guest SCTLR_EL1 register doesn't show the MMU and caches as being enabled. The function also get renamed to coherent_cache_guest_page. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Diffstat (limited to 'arch/arm/kvm/mmu.c')
-rw-r--r--arch/arm/kvm/mmu.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
index 7789857d1470..fc71a8df0e13 100644
--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -715,7 +715,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
715 kvm_set_s2pmd_writable(&new_pmd); 715 kvm_set_s2pmd_writable(&new_pmd);
716 kvm_set_pfn_dirty(pfn); 716 kvm_set_pfn_dirty(pfn);
717 } 717 }
718 coherent_icache_guest_page(kvm, hva & PMD_MASK, PMD_SIZE); 718 coherent_cache_guest_page(vcpu, hva & PMD_MASK, PMD_SIZE);
719 ret = stage2_set_pmd_huge(kvm, memcache, fault_ipa, &new_pmd); 719 ret = stage2_set_pmd_huge(kvm, memcache, fault_ipa, &new_pmd);
720 } else { 720 } else {
721 pte_t new_pte = pfn_pte(pfn, PAGE_S2); 721 pte_t new_pte = pfn_pte(pfn, PAGE_S2);
@@ -723,7 +723,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
723 kvm_set_s2pte_writable(&new_pte); 723 kvm_set_s2pte_writable(&new_pte);
724 kvm_set_pfn_dirty(pfn); 724 kvm_set_pfn_dirty(pfn);
725 } 725 }
726 coherent_icache_guest_page(kvm, hva, PAGE_SIZE); 726 coherent_cache_guest_page(vcpu, hva, PAGE_SIZE);
727 ret = stage2_set_pte(kvm, memcache, fault_ipa, &new_pte, false); 727 ret = stage2_set_pte(kvm, memcache, fault_ipa, &new_pte, false);
728 } 728 }
729 729