1 /* MN10300 MMU context allocation and management
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
11 #include <linux/sched.h>
13 #include <asm/mmu_context.h>
14 #include <asm/tlbflush.h>
16 #ifdef CONFIG_MN10300_TLB_USE_PIDR
18 * list of the MMU contexts last allocated on each CPU
20 unsigned long mmu_context_cache[NR_CPUS] = {
22 MMU_CONTEXT_FIRST_VERSION * 2 - (1 - MMU_CONTEXT_TLBPID_LOCK_NR),
24 #endif /* CONFIG_MN10300_TLB_USE_PIDR */
27 * preemptively set a TLB entry
29 void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
31 unsigned long pteu, ptel, cnx, flags;
35 ptel = pte_val(pte) & ~(xPTEL_UNUSED1 | xPTEL_UNUSED2);
37 /* make sure the context doesn't migrate and defend against
38 * interference from vmalloc'd regions */
39 local_irq_save(flags);
41 cnx = ~MMU_NO_CONTEXT;
42 #ifdef CONFIG_MN10300_TLB_USE_PIDR
43 cnx = mm_context(vma->vm_mm);
46 if (cnx != MMU_NO_CONTEXT) {
48 #ifdef CONFIG_MN10300_TLB_USE_PIDR
49 pteu |= cnx & MMU_CONTEXT_TLBPID_MASK;
51 if (!(pte_val(pte) & _PAGE_NX)) {
61 local_irq_restore(flags);