diff mbox series

MIPS: mm: Use SMP safe operations for flush_cache_vmap

Message ID 20190528221255.22460-1-chris.packham@alliedtelesis.co.nz (mailing list archive)
State Superseded
Headers show
Series MIPS: mm: Use SMP safe operations for flush_cache_vmap | expand

Commit Message

Chris Packham May 28, 2019, 10:12 p.m. UTC
flush_cache_vmap() and flush_cache_vunmap() were calling
r4k_blast_dcache() which is not safe to do on a SMP system. Redefine
them to call r4k_flush_kernel_vmap_range() which will correctly handle
the SMP/UP cases.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
I don't know if passing 0, dcache_size to r4k_flush_kernel_vmap_range is
a good idea. It does have the desired outcome but it could be a bit
fragile.

Getting the address and size through to r4k__flush_cache_vmap involves
updating the prototype for __flush_cache_vmap() which meant touching
more code than I was comfortable doing. It would be relatively straight
forward to do but then I'd hit things I have no way of testing.

 arch/mips/mm/c-r4k.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 5166e38cd1c6..976c54268456 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -559,16 +559,6 @@  static inline int has_valid_asid(const struct mm_struct *mm, unsigned int type)
 	return 0;
 }
 
-static void r4k__flush_cache_vmap(void)
-{
-	r4k_blast_dcache();
-}
-
-static void r4k__flush_cache_vunmap(void)
-{
-	r4k_blast_dcache();
-}
-
 /*
  * Note: flush_tlb_range() assumes flush_cache_range() sufficiently flushes
  * whole caches when vma is executable.
@@ -986,6 +976,16 @@  static void r4k_flush_kernel_vmap_range(unsigned long vaddr, int size)
 				&args);
 }
 
+static void r4k__flush_cache_vmap(void)
+{
+	r4k_flush_kernel_vmap_range(0, dcache_size);
+}
+
+static void r4k__flush_cache_vunmap(void)
+{
+	r4k_flush_kernel_vmap_range(0, dcache_size);
+}
+
 static inline void rm7k_erratum31(void)
 {
 	const unsigned long ic_lsize = 32;