1 /* MN10300 MMU context allocation and management
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
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>
17 * list of the MMU contexts last allocated on each CPU
19 unsigned long mmu_context_cache
[NR_CPUS
] = {
20 [0 ... NR_CPUS
- 1] = MMU_CONTEXT_FIRST_VERSION
* 2 - 1,
24 * flush the specified TLB entry
26 void flush_tlb_page(struct vm_area_struct
*vma
, unsigned long addr
)
28 unsigned long pteu
, cnx
, flags
;
32 /* make sure the context doesn't migrate and defend against
33 * interference from vmalloc'd regions */
34 local_irq_save(flags
);
36 cnx
= mm_context(vma
->vm_mm
);
38 if (cnx
!= MMU_NO_CONTEXT
) {
39 pteu
= addr
| (cnx
& 0x000000ffUL
);
48 local_irq_restore(flags
);
52 * preemptively set a TLB entry
54 void update_mmu_cache(struct vm_area_struct
*vma
, unsigned long addr
, pte_t pte
)
56 unsigned long pteu
, ptel
, cnx
, flags
;
59 ptel
= pte_val(pte
) & ~(xPTEL_UNUSED1
| xPTEL_UNUSED2
);
61 /* make sure the context doesn't migrate and defend against
62 * interference from vmalloc'd regions */
63 local_irq_save(flags
);
65 cnx
= mm_context(vma
->vm_mm
);
67 if (cnx
!= MMU_NO_CONTEXT
) {
68 pteu
= addr
| (cnx
& 0x000000ffUL
);
69 if (!(pte_val(pte
) & _PAGE_NX
)) {
79 local_irq_restore(flags
);