Lines Matching +full:ctx +full:- +full:asid
1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <asm-generic/mm_hooks.h>
30 mm_context_t ctx; in get_mmu_context() local
32 if (mm->context != NO_CONTEXT) in get_mmu_context()
38 ctx = next_mmu_context; in get_mmu_context()
39 while (test_and_set_bit(ctx, context_map)) { in get_mmu_context()
40 ctx = find_next_zero_bit(context_map, LAST_CONTEXT+1, ctx); in get_mmu_context()
41 if (ctx > LAST_CONTEXT) in get_mmu_context()
42 ctx = 0; in get_mmu_context()
44 next_mmu_context = (ctx + 1) & LAST_CONTEXT; in get_mmu_context()
45 mm->context = ctx; in get_mmu_context()
46 context_mm[ctx] = mm; in get_mmu_context()
52 #define init_new_context(tsk, mm) (((mm)->context = NO_CONTEXT), 0)
60 if (mm->context != NO_CONTEXT) { in destroy_context()
61 clear_bit(mm->context, context_map); in destroy_context()
62 mm->context = NO_CONTEXT; in destroy_context()
69 __asm__ __volatile__ ("movec %0,%%asid" : : "d" (context)); in set_context()
75 get_mmu_context(tsk->mm); in switch_mm()
76 set_context(tsk->mm->context, next->pgd); in switch_mm()
80 * After we have set current->mm to a new value, this activates
88 set_context(mm->context, mm->pgd); in activate_mm()
97 int asid; in load_ksp_mmu() local
106 mmuar = task->thread.ksp; in load_ksp_mmu()
117 pr_info("load_ksp_mmu: non-kernel mm found: 0x%p\n", task->mm); in load_ksp_mmu()
118 mm = task->mm; in load_ksp_mmu()
146 asid = mm->context & 0xff; in load_ksp_mmu()
150 mmu_write(MMUTR, (mmuar & PAGE_MASK) | (asid << MMUTR_IDN) | in load_ksp_mmu()
151 (((int)(pte->pte) & (int)CF_PAGE_MMUTR_MASK) in load_ksp_mmu()
155 ((pte->pte) & CF_PAGE_MMUDR_MASK) | MMUDR_SZ_8KB | MMUDR_X); in load_ksp_mmu()
181 mm->context = SUN3_INVALID_CONTEXT; in init_new_context()
189 if (mm->context == SUN3_INVALID_CONTEXT) in get_mmu_context()
190 mm->context = get_free_context(mm); in get_mmu_context()
197 if (mm->context != SUN3_INVALID_CONTEXT) in destroy_context()
198 clear_context(mm->context); in destroy_context()
204 sun3_put_context(mm->context); in activate_context()
210 activate_context(tsk->mm); in switch_mm()
230 mm->context = virt_to_phys(mm->pgd); in init_new_context()
237 0x80000000 | _PAGE_TABLE, mm->context in switch_mm_0230()
250 /* Switch the root pointer. For a 030-only kernel, in switch_mm_0230()
275 asm volatile ("movec %0,%%urp" : : "r" (mm->context)); in switch_mm_0460()
305 next_mm->context = virt_to_phys(next_mm->pgd); in activate_mm()
315 #include <asm-generic/mmu_context.h>
319 #include <asm-generic/nommu_context.h>