[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH 3/6] KVM: ARM: change __coherent_cache_guest_pag
From: |
Andrew Jones |
Subject: |
[Qemu-devel] [RFC PATCH 3/6] KVM: ARM: change __coherent_cache_guest_page interface |
Date: |
Fri, 6 Mar 2015 13:52:30 -0500 |
Remove the vcpu parameter. We can do this by doing the same
query in the caller of __coherent_cache_guest_page, and then
folding the result into its ipa_uncached parameter, which we
rename to need_flush.
A later patch will add a new caller for __coherent_cache_guest_page
that does not have a vcpu parameter.
Signed-off-by: Andrew Jones <address@hidden>
---
arch/arm/include/asm/kvm_mmu.h | 7 ++-----
arch/arm/kvm/mmu.c | 3 ++-
arch/arm64/include/asm/kvm_mmu.h | 7 +++----
3 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/arch/arm/include/asm/kvm_mmu.h b/arch/arm/include/asm/kvm_mmu.h
index 37ca2a4c6f094..fd801e96fdd3c 100644
--- a/arch/arm/include/asm/kvm_mmu.h
+++ b/arch/arm/include/asm/kvm_mmu.h
@@ -183,9 +183,8 @@ 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, pfn_t
pfn,
- unsigned long size,
- bool ipa_uncached)
+static inline void __coherent_cache_guest_page(pfn_t pfn, unsigned long size,
+ bool need_flush)
{
/*
* If we are going to insert an instruction page and the icache is
@@ -205,8 +204,6 @@ static inline void __coherent_cache_guest_page(struct
kvm_vcpu *vcpu, pfn_t pfn,
* and iterate over the range.
*/
- bool need_flush = !vcpu_has_cache_enabled(vcpu) || ipa_uncached;
-
VM_BUG_ON(size & PAGE_MASK);
if (!need_flush && !icache_is_pipt())
diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
index a806e8cecc01b..781afc712871c 100644
--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -1157,7 +1157,8 @@ void kvm_arch_mmu_write_protect_pt_masked(struct kvm *kvm,
static void coherent_cache_guest_page(struct kvm_vcpu *vcpu, pfn_t pfn,
unsigned long size, bool uncached)
{
- __coherent_cache_guest_page(vcpu, pfn, size, uncached);
+ bool need_flush = uncached || !vcpu_has_cache_enabled(vcpu);
+ __coherent_cache_guest_page(pfn, size, need_flush);
}
static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h
index 6458b53731421..56a976c776bc2 100644
--- a/arch/arm64/include/asm/kvm_mmu.h
+++ b/arch/arm64/include/asm/kvm_mmu.h
@@ -264,13 +264,12 @@ static inline bool vcpu_has_cache_enabled(struct kvm_vcpu
*vcpu)
return (vcpu_sys_reg(vcpu, SCTLR_EL1) & 0b101) == 0b101;
}
-static inline void __coherent_cache_guest_page(struct kvm_vcpu *vcpu, pfn_t
pfn,
- unsigned long size,
- bool ipa_uncached)
+static inline void __coherent_cache_guest_page(pfn_t pfn, unsigned long size,
+ bool need_flush)
{
void *va = page_address(pfn_to_page(pfn));
- if (!vcpu_has_cache_enabled(vcpu) || ipa_uncached)
+ if (need_flush)
kvm_flush_dcache_to_poc(va, size);
if (!icache_is_aliasing()) { /* PIPT */
--
1.8.3.1
- [Qemu-devel] the arm cache coherency cluster, Andrew Jones, 2015/03/06
- [Qemu-devel] [RFC PATCH 0/6] flush/invalidate on entry/exit, Andrew Jones, 2015/03/06
- [Qemu-devel] [RFC PATCH 2/6] KVM: Introduce incoherent cache maintenance API, Andrew Jones, 2015/03/06
- [Qemu-devel] [RFC PATCH 3/6] KVM: ARM: change __coherent_cache_guest_page interface,
Andrew Jones <=
- [Qemu-devel] [RFC PATCH 5/6] KVM: ARM: implement kvm_*_incoherent_memory_regions, Andrew Jones, 2015/03/06
- [Qemu-devel] [RFC PATCH 4/6] KVM: ARM: extend __coherent_cache_guest_page, Andrew Jones, 2015/03/06
- [Qemu-devel] [RFC PATCH 6/6] KVM: ARM: no need for kvm_arch_flush_incoherent, Andrew Jones, 2015/03/06
- [Qemu-devel] [RFC PATCH 1/6] kvm: promote KVM_MEMSLOT_INCOHERENT to uapi, Andrew Jones, 2015/03/06
- [Qemu-devel] [RFC PATCH 0/6] support KVM_MEM_INCOHERENT, Andrew Jones, 2015/03/06
- [Qemu-devel] [RFC PATCH 2/6] HACK: linux header update, Andrew Jones, 2015/03/06
- [Qemu-devel] [PATCH 3/6] kvm-all: put kvm_mem_flags to more work, Andrew Jones, 2015/03/06
- [Qemu-devel] [RFC PATCH 4/6] kvm-all: set KVM_MEM_INCOHERENT, Andrew Jones, 2015/03/06
- [Qemu-devel] [RFC PATCH 1/6] memory: add incoherent cache flag, Andrew Jones, 2015/03/06
- [Qemu-devel] [RFC PATCH 5/6] vga: flag vram as incoherent, Andrew Jones, 2015/03/06