[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH 4/6] KVM: ARM: extend __coherent_cache_guest_pag
From: |
Andrew Jones |
Subject: |
[Qemu-devel] [RFC PATCH 4/6] KVM: ARM: extend __coherent_cache_guest_page |
Date: |
Fri, 6 Mar 2015 13:52:31 -0500 |
Also support only invalidating, rather than always invalidate+clear.
Signed-off-by: Andrew Jones <address@hidden>
---
arch/arm/include/asm/kvm_mmu.h | 7 +++++--
arch/arm/kvm/mmu.c | 2 +-
arch/arm64/include/asm/kvm_mmu.h | 7 +++++--
3 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/arch/arm/include/asm/kvm_mmu.h b/arch/arm/include/asm/kvm_mmu.h
index fd801e96fdd3c..a1c7f554f5de8 100644
--- a/arch/arm/include/asm/kvm_mmu.h
+++ b/arch/arm/include/asm/kvm_mmu.h
@@ -176,7 +176,8 @@ static inline void *kvm_get_hwpgd(struct kvm *kvm)
struct kvm;
-#define kvm_flush_dcache_to_poc(a,l) __cpuc_flush_dcache_area((a), (l))
+#define kvm_flush_dcache_to_poc(a,l) __cpuc_flush_dcache_area((a),
(l))
+#define kvm_invalidate_cache_to_poc(a,l) dmac_unmap_area((a), (l), 0)
static inline bool vcpu_has_cache_enabled(struct kvm_vcpu *vcpu)
{
@@ -184,7 +185,7 @@ static inline bool vcpu_has_cache_enabled(struct kvm_vcpu
*vcpu)
}
static inline void __coherent_cache_guest_page(pfn_t pfn, unsigned long size,
- bool need_flush)
+ bool need_flush, bool invalidate)
{
/*
* If we are going to insert an instruction page and the icache is
@@ -214,6 +215,8 @@ static inline void __coherent_cache_guest_page(pfn_t pfn,
unsigned long size,
if (need_flush)
kvm_flush_dcache_to_poc(va, PAGE_SIZE);
+ if (invalidate)
+ kvm_invalidate_cache_to_poc(va, PAGE_SIZE);
if (icache_is_pipt())
__cpuc_coherent_user_range((unsigned long)va,
diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
index 781afc712871c..2f3a6581b9200 100644
--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -1158,7 +1158,7 @@ static void coherent_cache_guest_page(struct kvm_vcpu
*vcpu, pfn_t pfn,
unsigned long size, bool uncached)
{
bool need_flush = uncached || !vcpu_has_cache_enabled(vcpu);
- __coherent_cache_guest_page(pfn, size, need_flush);
+ __coherent_cache_guest_page(pfn, size, need_flush, false);
}
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 56a976c776bc2..e1090ad70133d 100644
--- a/arch/arm64/include/asm/kvm_mmu.h
+++ b/arch/arm64/include/asm/kvm_mmu.h
@@ -257,7 +257,8 @@ static inline bool kvm_page_empty(void *ptr)
struct kvm;
-#define kvm_flush_dcache_to_poc(a,l) __flush_dcache_area((a), (l))
+#define kvm_flush_dcache_to_poc(a,l) __flush_dcache_area((a), (l))
+#define kvm_invalidate_cache_to_poc(a,l) __dma_unmap_area((a), (l), 0)
static inline bool vcpu_has_cache_enabled(struct kvm_vcpu *vcpu)
{
@@ -265,12 +266,14 @@ static inline bool vcpu_has_cache_enabled(struct kvm_vcpu
*vcpu)
}
static inline void __coherent_cache_guest_page(pfn_t pfn, unsigned long size,
- bool need_flush)
+ bool need_flush, bool invalidate)
{
void *va = page_address(pfn_to_page(pfn));
if (need_flush)
kvm_flush_dcache_to_poc(va, size);
+ if (invalidate)
+ kvm_invalidate_cache_to_poc(va, size);
if (!icache_is_aliasing()) { /* PIPT */
flush_icache_range((unsigned long)va,
--
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, 2015/03/06
- [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 <=
- [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
- [Qemu-devel] [RFC/WIP PATCH 6/6] memory: add clear_cache_to_poc, Andrew Jones, 2015/03/06