File tree Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
#include <linux/mm.h>
4
4
#include <linux/smp.h>
5
+ #include <linux/sched.h>
5
6
#include <asm/sbi.h>
6
7
7
8
void flush_tlb_all (void )
8
9
{
9
10
sbi_remote_sfence_vma (NULL , 0 , -1 );
10
11
}
11
12
13
+ /*
14
+ * This function must not be called with cmask being null.
15
+ * Kernel may panic if cmask is NULL.
16
+ */
12
17
static void __sbi_tlb_flush_range (struct cpumask * cmask , unsigned long start ,
13
18
unsigned long size )
14
19
{
15
20
struct cpumask hmask ;
21
+ unsigned int cpuid ;
16
22
17
- riscv_cpuid_to_hartid_mask (cmask , & hmask );
18
- sbi_remote_sfence_vma (hmask .bits , start , size );
23
+ if (cpumask_empty (cmask ))
24
+ return ;
25
+
26
+ cpuid = get_cpu ();
27
+
28
+ if (cpumask_any_but (cmask , cpuid ) >= nr_cpu_ids ) {
29
+ /* local cpu is the only cpu present in cpumask */
30
+ if (size <= PAGE_SIZE )
31
+ local_flush_tlb_page (start );
32
+ else
33
+ local_flush_tlb_all ();
34
+ } else {
35
+ riscv_cpuid_to_hartid_mask (cmask , & hmask );
36
+ sbi_remote_sfence_vma (cpumask_bits (& hmask ), start , size );
37
+ }
38
+
39
+ put_cpu ();
19
40
}
20
41
21
42
void flush_tlb_mm (struct mm_struct * mm )
You can’t perform that action at this time.
0 commit comments