Patch "ARM: KVM: force cache clean on page fault when caches are off" has been added to the 3.14-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
ARM: KVM: force cache clean on page fault when caches are off
to the 3.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
arm-kvm-force-cache-clean-on-page-fault-when-caches-are-off.patch
and it can be found in the queue-3.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
159793001d7d85af17855630c94f0a176848e16bMon Sep 17 00:00:00 2001
From: Marc Zyngier <[email protected]>
Date: Tue, 14 Jan 2014 19:13:10 +0000
Subject: ARM: KVM: force cache clean on page fault when caches are off
From: Marc Zyngier <[email protected]>
commit 159793001d7d85af17855630c94f0a176848e16b upstream.
In order for a guest with caches disabled 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_cache_guest_page function and flush the region if the guest SCTLR register doesn't show the MMU and caches as being enabled.
--- arch/arm/include/asm/kvm_mmu.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
arch/arm/include/asm/kvm_mmu.h +10 -1
@@ -129,9 +129,19 @@ static inline void kvm_set_s2pmd_writablstruct kvm ; +#define kvm_flush_dcache_to_poc (a,l) __cpuc_flush_dcache_area((a), (l)) + +static inline bool vcpu_has_cache_enabled (struct kvm_vcpu *vcpu) +{ +return (vcpu->arch.cp15[c1_SCTLR] &0b101 ) ==0b101 ; +} +static inline void coherent_cache_guest_page (struct kvm_vcpu *vcpu,hva_t hva,unsigned long size) { +if (!vcpu_has_cache_enabled (vcpu)) +kvm_flush_dcache_to_poc ((void *)hva, size); +/* * If we are going to insert an instruction page and the icache is * either VIPT or PIPT, there is a potential problem where the host
@@ -152,7 +162,6 @@ static inline void coherent_cache_guest_ } } -#define kvm_flush_dcache_to_poc (a,l) __cpuc_flush_dcache_area((a), (l))#define kvm_virt_to_phys (x) virt_to_idmap((unsigned long)(x))void stage2_flush_vm (struct kvm *kvm);
Patches currently in stable-queue which might be from [email protected] are
queue-3.14/kvm-arm-arm64-vgic-fix-gicd_icfgr-register-accesses.patch queue-3.14/arm-kvm-introduce-per-vcpu-hyp-configuration-register.patch queue-3.14/arm-kvm-fix-handling-of-trapped-64bit-coprocessor-accesses.patch queue-3.14/kvm-arm64-vgic-fix-hyp-panic-with-64k-pages-on-juno-platform.patch queue-3.14/arm64-kvm-force-cache-clean-on-page-fault-when-caches-are-off.patch queue-3.14/arm-kvm-introduce-kvm_p-d_addr_end.patch queue-3.14/arm64-kvm-flush-vm-pages-before-letting-the-guest-enable-caches.patch queue-3.14/arm-kvm-force-cache-clean-on-page-fault-when-caches-are-off.patch queue-3.14/arm-kvm-add-world-switch-for-amair-0-1.patch queue-3.14/kvm-arm-vgic-fix-the-overlap-check-action-about-setting-the-gicd-gicc-base-address.patch queue-3.14/arm64-kvm-use-inner-shareable-barriers-for-inner-shareable-maintenance.patch queue-3.14/arm64-kvm-allows-discrimination-of-aarch32-sysreg-access.patch queue-3.14/arm-kvm-trap-vm-system-registers-until-mmu-and-caches-are-on.patch queue-3.14/arm-kvm-fix-ordering-of-64bit-coprocessor-accesses.patch queue-3.14/arm64-kvm-trap-vm-system-registers-until-mmu-and-caches-are-on.patch