1 // SPDX-License-Identifier: GPL-2.0-only
3 * Hexagon Virtual Machine TLB functions
5 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
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.
14 #include <linux/sched.h>
16 #include <asm/hexagon_vm.h>
17 #include <asm/tlbflush.h>
20 * Initial VM implementation has only one map active at a time, with
21 * TLB purgings on changes. So either we're nuking the current map,
22 * or it's a no-op. This operation is messy on true SMPs where other
23 * processors must be induced to flush the copies in their local TLBs,
24 * but Hexagon thread-based virtual processors share the same MMU.
26 void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
29 struct mm_struct *mm = vma->vm_mm;
31 if (mm->context.ptbase == current->active_mm->context.ptbase)
32 __vmclrmap((void *)start, end - start);
36 * Flush a page from the kernel virtual map - used by highmem
38 void flush_tlb_one(unsigned long vaddr)
40 __vmclrmap((void *)vaddr, PAGE_SIZE);
44 * Flush all TLBs across all CPUs, virtual or real.
45 * A single Hexagon core has 6 thread contexts but
48 void tlb_flush_all(void)
50 /* should probably use that fixaddr end or whateve label */
51 __vmclrmap(0, 0xffff0000);
55 * Flush TLB entries associated with a given mm_struct mapping.
57 void flush_tlb_mm(struct mm_struct *mm)
59 /* Current Virtual Machine has only one map active at a time */
60 if (current->active_mm->context.ptbase == mm->context.ptbase)
65 * Flush TLB state associated with a page of a vma.
67 void flush_tlb_page(struct vm_area_struct *vma, unsigned long vaddr)
69 struct mm_struct *mm = vma->vm_mm;
71 if (mm->context.ptbase == current->active_mm->context.ptbase)
72 __vmclrmap((void *)vaddr, PAGE_SIZE);
76 * Flush TLB entries associated with a kernel address range.
77 * Like flush range, but without the check on the vma->vm_mm.
79 void flush_tlb_kernel_range(unsigned long start, unsigned long end)
81 __vmclrmap((void *)start, end - start);