diff mbox

[Xen-devel,v4,4/7] xen/x86: introduce more cache maintenance operations

Message ID 1412941440-5646-4-git-send-email-stefano.stabellini@eu.citrix.com
State New
Headers show

Commit Message

Stefano Stabellini Oct. 10, 2014, 11:43 a.m. UTC
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

---

Changes in v4:
- remove _xen in the function names;
- implement the functions using existing x86 flushing functions.
---
 xen/arch/x86/flushtlb.c    |    6 ++++++
 xen/include/asm-x86/page.h |    7 ++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/xen/arch/x86/flushtlb.c b/xen/arch/x86/flushtlb.c
index 5d5d79c..3e5e287 100644
--- a/xen/arch/x86/flushtlb.c
+++ b/xen/arch/x86/flushtlb.c
@@ -152,3 +152,9 @@  void flush_area_local(const void *va, unsigned int flags)
 
     local_irq_restore(irqfl);
 }
+
+void clean_and_invalidate_dcache_va_range(const void *p, unsigned long size)
+{
+    int order = get_order_from_bytes(size);
+    flush_area_local(p, FLUSH_CACHE|FLUSH_ORDER(order));
+}
diff --git a/xen/include/asm-x86/page.h b/xen/include/asm-x86/page.h
index 9aa780e..e56be8a 100644
--- a/xen/include/asm-x86/page.h
+++ b/xen/include/asm-x86/page.h
@@ -344,8 +344,13 @@  static inline uint32_t cacheattr_to_pte_flags(uint32_t cacheattr)
     return ((cacheattr & 4) << 5) | ((cacheattr & 3) << 3);
 }
 
-/* No cache maintenance required on x86 architecture. */
 static inline void flush_page_to_ram(unsigned long mfn) {}
+static inline void invalidate_dcache_va_range(const void *p, unsigned long size) {}
+void clean_and_invalidate_dcache_va_range(const void *p, unsigned long size);
+static inline void clean_dcache_va_range(const void *p, unsigned long size)
+{
+    clean_and_invalidate_dcache_va_range(p, size);
+}
 
 /* return true if permission increased */
 static inline bool_t