[PATCH] MIPS: mm: Use SMP safe operations for flush_cache_vmap
From: Chris Packham
Date: Tue May 28 2019 - 18:16:31 EST
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@xxxxxxxxxxxxxxxxxxx>
---
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 --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;
--
2.21.0