This source file includes following definitions.
- flush_icache_all
- flush_icache_mm
- flush_icache_pte
1
2
3
4
5
6 #include <asm/pgtable.h>
7 #include <asm/cacheflush.h>
8
9 #ifdef CONFIG_SMP
10
11 #include <asm/sbi.h>
12
13 void flush_icache_all(void)
14 {
15 sbi_remote_fence_i(NULL);
16 }
17 EXPORT_SYMBOL(flush_icache_all);
18
19
20
21
22
23
24
25
26
27
28
29 void flush_icache_mm(struct mm_struct *mm, bool local)
30 {
31 unsigned int cpu;
32 cpumask_t others, hmask, *mask;
33
34 preempt_disable();
35
36
37 mask = &mm->context.icache_stale_mask;
38 cpumask_setall(mask);
39
40 cpu = smp_processor_id();
41 cpumask_clear_cpu(cpu, mask);
42 local_flush_icache_all();
43
44
45
46
47
48 cpumask_andnot(&others, mm_cpumask(mm), cpumask_of(cpu));
49 local |= cpumask_empty(&others);
50 if (mm != current->active_mm || !local) {
51 riscv_cpuid_to_hartid_mask(&others, &hmask);
52 sbi_remote_fence_i(hmask.bits);
53 } else {
54
55
56
57
58
59
60
61
62 smp_mb();
63 }
64
65 preempt_enable();
66 }
67
68 #endif
69
70 void flush_icache_pte(pte_t pte)
71 {
72 struct page *page = pte_page(pte);
73
74 if (!test_and_set_bit(PG_dcache_clean, &page->flags))
75 flush_icache_all();
76 }