mm: make wait_on_page_writeback() wait for multiple pending writebacks
[linux/fpc-iii.git] / arch / hexagon / mm / vm_tlb.c
blob53482f2a9ff9419d888c12ca5d4ce192a6f65c17
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Hexagon Virtual Machine TLB functions
5 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
6 */
8 /*
9 * The Hexagon Virtual Machine conceals the real workings of
10 * the TLB, but there are one or two functions that need to
11 * be instantiated for it, differently from a native build.
13 #include <linux/mm.h>
14 #include <linux/sched.h>
15 #include <asm/page.h>
16 #include <asm/hexagon_vm.h>
19 * Initial VM implementation has only one map active at a time, with
20 * TLB purgings on changes. So either we're nuking the current map,
21 * or it's a no-op. This operation is messy on true SMPs where other
22 * processors must be induced to flush the copies in their local TLBs,
23 * but Hexagon thread-based virtual processors share the same MMU.
25 void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
26 unsigned long end)
28 struct mm_struct *mm = vma->vm_mm;
30 if (mm->context.ptbase == current->active_mm->context.ptbase)
31 __vmclrmap((void *)start, end - start);
35 * Flush a page from the kernel virtual map - used by highmem
37 void flush_tlb_one(unsigned long vaddr)
39 __vmclrmap((void *)vaddr, PAGE_SIZE);
43 * Flush all TLBs across all CPUs, virtual or real.
44 * A single Hexagon core has 6 thread contexts but
45 * only one TLB.
47 void tlb_flush_all(void)
49 /* should probably use that fixaddr end or whateve label */
50 __vmclrmap(0, 0xffff0000);
54 * Flush TLB entries associated with a given mm_struct mapping.
56 void flush_tlb_mm(struct mm_struct *mm)
58 /* Current Virtual Machine has only one map active at a time */
59 if (current->active_mm->context.ptbase == mm->context.ptbase)
60 tlb_flush_all();
64 * Flush TLB state associated with a page of a vma.
66 void flush_tlb_page(struct vm_area_struct *vma, unsigned long vaddr)
68 struct mm_struct *mm = vma->vm_mm;
70 if (mm->context.ptbase == current->active_mm->context.ptbase)
71 __vmclrmap((void *)vaddr, PAGE_SIZE);
75 * Flush TLB entries associated with a kernel address range.
76 * Like flush range, but without the check on the vma->vm_mm.
78 void flush_tlb_kernel_range(unsigned long start, unsigned long end)
80 __vmclrmap((void *)start, end - start);