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

TOMOYO Linux Cross Reference
Linux/arch/tile/kernel/tlb.c

Version: ~ [ linux-5.2-rc1 ] ~ [ linux-5.1.2 ] ~ [ linux-5.0.16 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.43 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.119 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.176 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.179 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.139 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.67 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.39.4 ] ~ [ linux-2.6.38.8 ] ~ [ linux-2.6.37.6 ] ~ [ linux-2.6.36.4 ] ~ [ linux-2.6.35.14 ] ~ [ linux-2.6.34.15 ] ~ [ linux-2.6.33.20 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * Copyright 2010 Tilera Corporation. All Rights Reserved.
  3  *
  4  *   This program is free software; you can redistribute it and/or
  5  *   modify it under the terms of the GNU General Public License
  6  *   as published by the Free Software Foundation, version 2.
  7  *
  8  *   This program is distributed in the hope that it will be useful, but
  9  *   WITHOUT ANY WARRANTY; without even the implied warranty of
 10  *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
 11  *   NON INFRINGEMENT.  See the GNU General Public License for
 12  *   more details.
 13  *
 14  */
 15 
 16 #include <linux/cpumask.h>
 17 #include <linux/module.h>
 18 #include <asm/tlbflush.h>
 19 #include <asm/homecache.h>
 20 #include <hv/hypervisor.h>
 21 
 22 /* From tlbflush.h */
 23 DEFINE_PER_CPU(int, current_asid);
 24 int min_asid, max_asid;
 25 
 26 /*
 27  * Note that we flush the L1I (for VM_EXEC pages) as well as the TLB
 28  * so that when we are unmapping an executable page, we also flush it.
 29  * Combined with flushing the L1I at context switch time, this means
 30  * we don't have to do any other icache flushes.
 31  */
 32 
 33 void flush_tlb_mm(struct mm_struct *mm)
 34 {
 35         HV_Remote_ASID asids[NR_CPUS];
 36         int i = 0, cpu;
 37         for_each_cpu(cpu, mm_cpumask(mm)) {
 38                 HV_Remote_ASID *asid = &asids[i++];
 39                 asid->y = cpu / smp_topology.width;
 40                 asid->x = cpu % smp_topology.width;
 41                 asid->asid = per_cpu(current_asid, cpu);
 42         }
 43         flush_remote(0, HV_FLUSH_EVICT_L1I, mm_cpumask(mm),
 44                      0, 0, 0, NULL, asids, i);
 45 }
 46 
 47 void flush_tlb_current_task(void)
 48 {
 49         flush_tlb_mm(current->mm);
 50 }
 51 
 52 void flush_tlb_page_mm(const struct vm_area_struct *vma, struct mm_struct *mm,
 53                        unsigned long va)
 54 {
 55         unsigned long size = hv_page_size(vma);
 56         int cache = (vma->vm_flags & VM_EXEC) ? HV_FLUSH_EVICT_L1I : 0;
 57         flush_remote(0, cache, mm_cpumask(mm),
 58                      va, size, size, mm_cpumask(mm), NULL, 0);
 59 }
 60 
 61 void flush_tlb_page(const struct vm_area_struct *vma, unsigned long va)
 62 {
 63         flush_tlb_page_mm(vma, vma->vm_mm, va);
 64 }
 65 EXPORT_SYMBOL(flush_tlb_page);
 66 
 67 void flush_tlb_range(const struct vm_area_struct *vma,
 68                      unsigned long start, unsigned long end)
 69 {
 70         unsigned long size = hv_page_size(vma);
 71         struct mm_struct *mm = vma->vm_mm;
 72         int cache = (vma->vm_flags & VM_EXEC) ? HV_FLUSH_EVICT_L1I : 0;
 73         flush_remote(0, cache, mm_cpumask(mm), start, end - start, size,
 74                      mm_cpumask(mm), NULL, 0);
 75 }
 76 
 77 void flush_tlb_all(void)
 78 {
 79         int i;
 80         for (i = 0; ; ++i) {
 81                 HV_VirtAddrRange r = hv_inquire_virtual(i);
 82                 if (r.size == 0)
 83                         break;
 84                 flush_remote(0, HV_FLUSH_EVICT_L1I, cpu_online_mask,
 85                              r.start, r.size, PAGE_SIZE, cpu_online_mask,
 86                              NULL, 0);
 87                 flush_remote(0, 0, NULL,
 88                              r.start, r.size, HPAGE_SIZE, cpu_online_mask,
 89                              NULL, 0);
 90         }
 91 }
 92 
 93 void flush_tlb_kernel_range(unsigned long start, unsigned long end)
 94 {
 95         flush_remote(0, HV_FLUSH_EVICT_L1I, cpu_online_mask,
 96                      start, end - start, PAGE_SIZE, cpu_online_mask, NULL, 0);
 97 }
 98 

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

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | 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.

osdn.jp