diff options
-rw-r--r-- | arch/mips/mm/c-r4k.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c index d7088331fb0f..6806d58211b2 100644 --- a/arch/mips/mm/c-r4k.c +++ b/arch/mips/mm/c-r4k.c | |||
@@ -345,11 +345,26 @@ static void r4k___flush_cache_all(void) | |||
345 | r4k_on_each_cpu(local_r4k___flush_cache_all, NULL, 1, 1); | 345 | r4k_on_each_cpu(local_r4k___flush_cache_all, NULL, 1, 1); |
346 | } | 346 | } |
347 | 347 | ||
348 | static inline int has_valid_asid(const struct mm_struct *mm) | ||
349 | { | ||
350 | #if defined(CONFIG_MIPS_MT_SMP) || defined(CONFIG_MIPS_MT_SMTC) | ||
351 | int i; | ||
352 | |||
353 | for_each_online_cpu(i) | ||
354 | if (cpu_context(i, mm)) | ||
355 | return 1; | ||
356 | |||
357 | return 0; | ||
358 | #else | ||
359 | return cpu_context(smp_processor_id(), mm); | ||
360 | #endif | ||
361 | } | ||
362 | |||
348 | static inline void local_r4k_flush_cache_range(void * args) | 363 | static inline void local_r4k_flush_cache_range(void * args) |
349 | { | 364 | { |
350 | struct vm_area_struct *vma = args; | 365 | struct vm_area_struct *vma = args; |
351 | 366 | ||
352 | if (!(cpu_context(smp_processor_id(), vma->vm_mm))) | 367 | if (!(has_valid_asid(vma->vm_mm))) |
353 | return; | 368 | return; |
354 | 369 | ||
355 | r4k_blast_dcache(); | 370 | r4k_blast_dcache(); |
@@ -368,7 +383,7 @@ static inline void local_r4k_flush_cache_mm(void * args) | |||
368 | { | 383 | { |
369 | struct mm_struct *mm = args; | 384 | struct mm_struct *mm = args; |
370 | 385 | ||
371 | if (!cpu_context(smp_processor_id(), mm)) | 386 | if (!has_valid_asid(mm)) |
372 | return; | 387 | return; |
373 | 388 | ||
374 | /* | 389 | /* |
@@ -420,7 +435,7 @@ static inline void local_r4k_flush_cache_page(void *args) | |||
420 | * If ownes no valid ASID yet, cannot possibly have gotten | 435 | * If ownes no valid ASID yet, cannot possibly have gotten |
421 | * this page into the cache. | 436 | * this page into the cache. |
422 | */ | 437 | */ |
423 | if (cpu_context(smp_processor_id(), mm) == 0) | 438 | if (!has_valid_asid(mm)) |
424 | return; | 439 | return; |
425 | 440 | ||
426 | addr &= PAGE_MASK; | 441 | addr &= PAGE_MASK; |