diff options
Diffstat (limited to 'arch/powerpc/mm/mmu_context_hash64.c')
-rw-r--r-- | arch/powerpc/mm/mmu_context_hash64.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/arch/powerpc/mm/mmu_context_hash64.c b/arch/powerpc/mm/mmu_context_hash64.c index dbeb86ac90c..b910d37aea1 100644 --- a/arch/powerpc/mm/mmu_context_hash64.c +++ b/arch/powerpc/mm/mmu_context_hash64.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/mm.h> | 18 | #include <linux/mm.h> |
19 | #include <linux/spinlock.h> | 19 | #include <linux/spinlock.h> |
20 | #include <linux/idr.h> | 20 | #include <linux/idr.h> |
21 | #include <linux/module.h> | ||
21 | 22 | ||
22 | #include <asm/mmu_context.h> | 23 | #include <asm/mmu_context.h> |
23 | 24 | ||
@@ -32,7 +33,7 @@ static DEFINE_IDR(mmu_context_idr); | |||
32 | #define NO_CONTEXT 0 | 33 | #define NO_CONTEXT 0 |
33 | #define MAX_CONTEXT ((1UL << 19) - 1) | 34 | #define MAX_CONTEXT ((1UL << 19) - 1) |
34 | 35 | ||
35 | int init_new_context(struct task_struct *tsk, struct mm_struct *mm) | 36 | int __init_new_context(void) |
36 | { | 37 | { |
37 | int index; | 38 | int index; |
38 | int err; | 39 | int err; |
@@ -57,22 +58,41 @@ again: | |||
57 | return -ENOMEM; | 58 | return -ENOMEM; |
58 | } | 59 | } |
59 | 60 | ||
61 | return index; | ||
62 | } | ||
63 | EXPORT_SYMBOL_GPL(__init_new_context); | ||
64 | |||
65 | int init_new_context(struct task_struct *tsk, struct mm_struct *mm) | ||
66 | { | ||
67 | int index; | ||
68 | |||
69 | index = __init_new_context(); | ||
70 | if (index < 0) | ||
71 | return index; | ||
72 | |||
60 | /* The old code would re-promote on fork, we don't do that | 73 | /* The old code would re-promote on fork, we don't do that |
61 | * when using slices as it could cause problem promoting slices | 74 | * when using slices as it could cause problem promoting slices |
62 | * that have been forced down to 4K | 75 | * that have been forced down to 4K |
63 | */ | 76 | */ |
64 | if (slice_mm_new_context(mm)) | 77 | if (slice_mm_new_context(mm)) |
65 | slice_set_user_psize(mm, mmu_virtual_psize); | 78 | slice_set_user_psize(mm, mmu_virtual_psize); |
79 | subpage_prot_init_new_context(mm); | ||
66 | mm->context.id = index; | 80 | mm->context.id = index; |
67 | 81 | ||
68 | return 0; | 82 | return 0; |
69 | } | 83 | } |
70 | 84 | ||
71 | void destroy_context(struct mm_struct *mm) | 85 | void __destroy_context(int context_id) |
72 | { | 86 | { |
73 | spin_lock(&mmu_context_lock); | 87 | spin_lock(&mmu_context_lock); |
74 | idr_remove(&mmu_context_idr, mm->context.id); | 88 | idr_remove(&mmu_context_idr, context_id); |
75 | spin_unlock(&mmu_context_lock); | 89 | spin_unlock(&mmu_context_lock); |
90 | } | ||
91 | EXPORT_SYMBOL_GPL(__destroy_context); | ||
76 | 92 | ||
93 | void destroy_context(struct mm_struct *mm) | ||
94 | { | ||
95 | __destroy_context(mm->context.id); | ||
96 | subpage_prot_free(mm); | ||
77 | mm->context.id = NO_CONTEXT; | 97 | mm->context.id = NO_CONTEXT; |
78 | } | 98 | } |