]> xenbits.xensource.com Git - xen.git/commitdiff
Allow control of icache invalidations when calling flush_page_to_ram()
authorPunit Agrawal <punit.agrawal@arm.com>
Fri, 26 May 2017 11:14:05 +0000 (12:14 +0100)
committerStefano Stabellini <sstabellini@kernel.org>
Tue, 6 Jun 2017 18:49:22 +0000 (11:49 -0700)
flush_page_to_ram() unconditionally drops the icache. In certain
situations this leads to execessive icache flushes when
flush_page_to_ram() ends up being repeatedly called in a loop.

Introduce a parameter to allow callers of flush_page_to_ram() to take
responsibility of synchronising the icache. This is in preparations for
adding logic to make the callers perform the necessary icache
maintenance operations.

Signed-off-by: Punit Agrawal <punit.agrawal@arm.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/mm.c
xen/arch/arm/p2m.c
xen/common/page_alloc.c
xen/include/asm-arm/page.h
xen/include/asm-x86/flushtlb.h

index 48f74f6e650d8ddba376cdea37f51ef2baf3f5c1..082c872c72c7ea0d1674196587812708614f9a82 100644 (file)
@@ -420,7 +420,7 @@ unsigned long domain_page_map_to_mfn(const void *ptr)
 }
 #endif
 
-void flush_page_to_ram(unsigned long mfn)
+void flush_page_to_ram(unsigned long mfn, bool sync_icache)
 {
     void *v = map_domain_page(_mfn(mfn));
 
@@ -435,7 +435,8 @@ void flush_page_to_ram(unsigned long mfn)
      * I-Cache (See D4.9.2 in ARM DDI 0487A.k_iss10775). Instead of using flush
      * by VA on select platforms, we just flush the entire cache here.
      */
-    invalidate_icache();
+    if ( sync_icache )
+        invalidate_icache();
 }
 
 void __init arch_init_memory(void)
index 752e948070b7748a23e4b089f50d32ab8e2c5c34..291998938e0d3f390751ad2013520e1737ea0f3b 100644 (file)
@@ -1398,7 +1398,7 @@ int p2m_cache_flush(struct domain *d, gfn_t start, unsigned long nr)
         /* XXX: Implement preemption */
         while ( gfn_x(start) < gfn_x(next_gfn) )
         {
-            flush_page_to_ram(mfn_x(mfn));
+            flush_page_to_ram(mfn_x(mfn), true);
 
             start = gfn_add(start, 1);
             mfn = mfn_add(mfn, 1);
index 9e41fb4cd32b94c87f123ac0f271a1a978dd858f..eba78f1a3d5daedd766e67b7207a02fb7f300da1 100644 (file)
@@ -833,7 +833,7 @@ static struct page_info *alloc_heap_pages(
         /* Ensure cache and RAM are consistent for platforms where the
          * guest can control its own visibility of/through the cache.
          */
-        flush_page_to_ram(page_to_mfn(&pg[i]));
+        flush_page_to_ram(page_to_mfn(&pg[i]), true);
     }
 
     spin_unlock(&heap_lock);
index 4b46e8831c4fcdeaf627c48b25615e18773c1022..497b4c86ad6f855cbff286f31c28533481fca31f 100644 (file)
@@ -407,7 +407,7 @@ static inline void flush_xen_data_tlb_range_va(unsigned long va,
 }
 
 /* Flush the dcache for an entire page. */
-void flush_page_to_ram(unsigned long mfn);
+void flush_page_to_ram(unsigned long mfn, bool sync_icache);
 
 /*
  * Print a walk of a page table or p2m
index aa86ea2f3e36b233424454af21ca365fe3eb92f2..131b31cfcc09b57f3db156595f9d74fd75eaf842 100644 (file)
@@ -118,7 +118,7 @@ void flush_area_mask(const cpumask_t *, const void *va, unsigned int flags);
 #define flush_tlb_one_all(v)                    \
     flush_tlb_one_mask(&cpu_online_map, v)
 
-static inline void flush_page_to_ram(unsigned long mfn) {}
+static inline void flush_page_to_ram(unsigned long mfn, bool sync_icache) {}
 static inline int invalidate_dcache_va_range(const void *p,
                                              unsigned long size)
 { return -EOPNOTSUPP; }