aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/hexagon/include/asm/fixmap.h73
-rw-r--r--arch/hexagon/include/asm/mmu.h37
-rw-r--r--arch/hexagon/include/asm/mmu_context.h100
-rw-r--r--arch/hexagon/include/asm/page.h157
-rw-r--r--arch/hexagon/include/asm/pgalloc.h146
-rw-r--r--arch/hexagon/include/asm/pgtable.h518
-rw-r--r--arch/hexagon/mm/pgalloc.c23
7 files changed, 1054 insertions, 0 deletions
diff --git a/arch/hexagon/include/asm/fixmap.h b/arch/hexagon/include/asm/fixmap.h
new file mode 100644
index 000000000000..b27f4941645b
--- /dev/null
+++ b/arch/hexagon/include/asm/fixmap.h
@@ -0,0 +1,73 @@
1/*
2 * Fixmap support for Hexagon - enough to support highmem features
3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and
8 * only version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301, USA.
19 */
20
21#ifndef _ASM_FIXMAP_H
22#define _ASM_FIXMAP_H
23
24/*
25 * A lot of the fixmap info is already in mem-layout.h
26 */
27#include <asm/mem-layout.h>
28
29/*
30 * Full fixmap support involves set_fixmap() functions, but
31 * these may not be needed if all we're after is an area for
32 * highmem kernel mappings.
33 */
34#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
35#define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
36
37extern void __this_fixmap_does_not_exist(void);
38
39/**
40 * fix_to_virt -- "index to address" translation.
41 *
42 * If anyone tries to use the idx directly without translation,
43 * we catch the bug with a NULL-deference kernel oops. Illegal
44 * ranges of incoming indices are caught too.
45 */
46static inline unsigned long fix_to_virt(const unsigned int idx)
47{
48 /*
49 * This branch gets completely eliminated after inlining,
50 * except when someone tries to use fixaddr indices in an
51 * illegal way. (such as mixing up address types or using
52 * out-of-range indices).
53 *
54 * If it doesn't get removed, the linker will complain
55 * loudly with a reasonably clear error message..
56 */
57 if (idx >= __end_of_fixed_addresses)
58 __this_fixmap_does_not_exist();
59
60 return __fix_to_virt(idx);
61}
62
63static inline unsigned long virt_to_fix(const unsigned long vaddr)
64{
65 BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
66 return __virt_to_fix(vaddr);
67}
68
69#define kmap_get_fixmap_pte(vaddr) \
70 pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k(vaddr), \
71 (vaddr)), (vaddr)), (vaddr))
72
73#endif
diff --git a/arch/hexagon/include/asm/mmu.h b/arch/hexagon/include/asm/mmu.h
new file mode 100644
index 000000000000..30a5d8d2659d
--- /dev/null
+++ b/arch/hexagon/include/asm/mmu.h
@@ -0,0 +1,37 @@
1/*
2 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16 * 02110-1301, USA.
17 */
18
19#ifndef _ASM_MMU_H
20#define _ASM_MMU_H
21
22#include <asm/vdso.h>
23
24/*
25 * Architecture-specific state for a mm_struct.
26 * For the Hexagon Virtual Machine, it can be a copy
27 * of the pointer to the page table base.
28 */
29struct mm_context {
30 unsigned long long generation;
31 unsigned long ptbase;
32 struct hexagon_vdso *vdso;
33};
34
35typedef struct mm_context mm_context_t;
36
37#endif
diff --git a/arch/hexagon/include/asm/mmu_context.h b/arch/hexagon/include/asm/mmu_context.h
new file mode 100644
index 000000000000..b4fe5a5411b6
--- /dev/null
+++ b/arch/hexagon/include/asm/mmu_context.h
@@ -0,0 +1,100 @@
1/*
2 * MM context support for the Hexagon architecture
3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and
8 * only version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301, USA.
19 */
20
21#ifndef _ASM_MMU_CONTEXT_H
22#define _ASM_MMU_CONTEXT_H
23
24#include <asm/setup.h>
25#include <asm/page.h>
26#include <asm/pgalloc.h>
27#include <asm/mem-layout.h>
28
29static inline void destroy_context(struct mm_struct *mm)
30{
31}
32
33/*
34 * VM port hides all TLB management, so "lazy TLB" isn't very
35 * meaningful. Even for ports to architectures with visble TLBs,
36 * this is almost invariably a null function.
37 */
38static inline void enter_lazy_tlb(struct mm_struct *mm,
39 struct task_struct *tsk)
40{
41}
42
43/*
44 * Architecture-specific actions, if any, for memory map deactivation.
45 */
46static inline void deactivate_mm(struct task_struct *tsk,
47 struct mm_struct *mm)
48{
49}
50
51/**
52 * init_new_context - initialize context related info for new mm_struct instance
53 * @tsk: pointer to a task struct
54 * @mm: pointer to a new mm struct
55 */
56static inline int init_new_context(struct task_struct *tsk,
57 struct mm_struct *mm)
58{
59 /* mm->context is set up by pgd_alloc */
60 return 0;
61}
62
63/*
64 * Switch active mm context
65 */
66static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
67 struct task_struct *tsk)
68{
69 int l1;
70
71 /*
72 * For virtual machine, we have to update system map if it's been
73 * touched.
74 */
75 if (next->context.generation < prev->context.generation) {
76 for (l1 = MIN_KERNEL_SEG; l1 <= max_kernel_seg; l1++)