linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MIPS: mm: Use SMP safe operations for flush_cache_vmap
@ 2019-05-28 22:12 Chris Packham
  2019-05-29 22:47 ` [PATCH] MIPS: mm: Implement flush_cache_v(un)map using __flush_kernel_vmap_range Paul Burton
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Packham @ 2019-05-28 22:12 UTC (permalink / raw)
  To: ralf, paul.burton, jhogan
  Cc: Hamish Martin, linux-mips, linux-kernel, Chris Packham

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 --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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-29 23:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-28 22:12 [PATCH] MIPS: mm: Use SMP safe operations for flush_cache_vmap Chris Packham
2019-05-29 22:47 ` [PATCH] MIPS: mm: Implement flush_cache_v(un)map using __flush_kernel_vmap_range Paul Burton
2019-05-29 23:17   ` Chris Packham

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).