~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/sh/mm/tlbflush_32.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * TLB flushing operations for SH with an MMU.
  3  *
  4  *  Copyright (C) 1999  Niibe Yutaka
  5  *  Copyright (C) 2003  Paul Mundt
  6  *
  7  * This file is subject to the terms and conditions of the GNU General Public
  8  * License.  See the file "COPYING" in the main directory of this archive
  9  * for more details.
 10  */
 11 #include <linux/mm.h>
 12 #include <asm/mmu_context.h>
 13 #include <asm/tlbflush.h>
 14 
 15 void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
 16 {
 17         unsigned int cpu = smp_processor_id();
 18 
 19         if (vma->vm_mm && cpu_context(cpu, vma->vm_mm) != NO_CONTEXT) {
 20                 unsigned long flags;
 21                 unsigned long asid;
 22                 unsigned long saved_asid = MMU_NO_ASID;
 23 
 24                 asid = cpu_asid(cpu, vma->vm_mm);
 25                 page &= PAGE_MASK;
 26 
 27                 local_irq_save(flags);
 28                 if (vma->vm_mm != current->mm) {
 29                         saved_asid = get_asid();
 30                         set_asid(asid);
 31                 }
 32                 local_flush_tlb_one(asid, page);
 33                 if (saved_asid != MMU_NO_ASID)
 34                         set_asid(saved_asid);
 35                 local_irq_restore(flags);
 36         }
 37 }
 38 
 39 void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
 40                            unsigned long end)
 41 {
 42         struct mm_struct *mm = vma->vm_mm;
 43         unsigned int cpu = smp_processor_id();
 44 
 45         if (cpu_context(cpu, mm) != NO_CONTEXT) {
 46                 unsigned long flags;
 47                 int size;
 48 
 49                 local_irq_save(flags);
 50                 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
 51                 if (size > (MMU_NTLB_ENTRIES/4)) { /* Too many TLB to flush */
 52                         cpu_context(cpu, mm) = NO_CONTEXT;
 53                         if (mm == current->mm)
 54                                 activate_context(mm, cpu);
 55                 } else {
 56                         unsigned long asid;
 57                         unsigned long saved_asid = MMU_NO_ASID;
 58 
 59                         asid = cpu_asid(cpu, mm);
 60                         start &= PAGE_MASK;
 61                         end += (PAGE_SIZE - 1);
 62                         end &= PAGE_MASK;
 63                         if (mm != current->mm) {
 64                                 saved_asid = get_asid();
 65                                 set_asid(asid);
 66                         }
 67                         while (start < end) {
 68                                 local_flush_tlb_one(asid, start);
 69                                 start += PAGE_SIZE;
 70                         }
 71                         if (saved_asid != MMU_NO_ASID)
 72                                 set_asid(saved_asid);
 73                 }
 74                 local_irq_restore(flags);
 75         }
 76 }
 77 
 78 void local_flush_tlb_kernel_range(unsigned long start, unsigned long end)
 79 {
 80         unsigned int cpu = smp_processor_id();
 81         unsigned long flags;
 82         int size;
 83 
 84         local_irq_save(flags);
 85         size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
 86         if (size > (MMU_NTLB_ENTRIES/4)) { /* Too many TLB to flush */
 87                 local_flush_tlb_all();
 88         } else {
 89                 unsigned long asid;
 90                 unsigned long saved_asid = get_asid();
 91 
 92                 asid = cpu_asid(cpu, &init_mm);
 93                 start &= PAGE_MASK;
 94                 end += (PAGE_SIZE - 1);
 95                 end &= PAGE_MASK;
 96                 set_asid(asid);
 97                 while (start < end) {
 98                         local_flush_tlb_one(asid, start);
 99                         start += PAGE_SIZE;
100                 }
101                 set_asid(saved_asid);
102         }
103         local_irq_restore(flags);
104 }
105 
106 void local_flush_tlb_mm(struct mm_struct *mm)
107 {
108         unsigned int cpu = smp_processor_id();
109 
110         /* Invalidate all TLB of this process. */
111         /* Instead of invalidating each TLB, we get new MMU context. */
112         if (cpu_context(cpu, mm) != NO_CONTEXT) {
113                 unsigned long flags;
114 
115                 local_irq_save(flags);
116                 cpu_context(cpu, mm) = NO_CONTEXT;
117                 if (mm == current->mm)
118                         activate_context(mm, cpu);
119                 local_irq_restore(flags);
120         }
121 }
122 
123 void __flush_tlb_global(void)
124 {
125         unsigned long flags;
126 
127         local_irq_save(flags);
128 
129         /*
130          * This is the most destructive of the TLB flushing options,
131          * and will tear down all of the UTLB/ITLB mappings, including
132          * wired entries.
133          */
134         __raw_writel(__raw_readl(MMUCR) | MMUCR_TI, MMUCR);
135 
136         local_irq_restore(flags);
137 }
138 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php