aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm/slb.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/mm/slb.c')
-rw-r--r--arch/powerpc/mm/slb.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
index ffc8ed4de62d..6a8bf6c6000e 100644
--- a/arch/powerpc/mm/slb.c
+++ b/arch/powerpc/mm/slb.c
@@ -60,19 +60,19 @@ static inline void create_slbe(unsigned long ea, unsigned long flags,
60 : "memory" ); 60 : "memory" );
61} 61}
62 62
63static void slb_flush_and_rebolt(void) 63void slb_flush_and_rebolt(void)
64{ 64{
65 /* If you change this make sure you change SLB_NUM_BOLTED 65 /* If you change this make sure you change SLB_NUM_BOLTED
66 * appropriately too. */ 66 * appropriately too. */
67 unsigned long linear_llp, virtual_llp, lflags, vflags; 67 unsigned long linear_llp, vmalloc_llp, lflags, vflags;
68 unsigned long ksp_esid_data; 68 unsigned long ksp_esid_data;
69 69
70 WARN_ON(!irqs_disabled()); 70 WARN_ON(!irqs_disabled());
71 71
72 linear_llp = mmu_psize_defs[mmu_linear_psize].sllp; 72 linear_llp = mmu_psize_defs[mmu_linear_psize].sllp;
73 virtual_llp = mmu_psize_defs[mmu_virtual_psize].sllp; 73 vmalloc_llp = mmu_psize_defs[mmu_vmalloc_psize].sllp;
74 lflags = SLB_VSID_KERNEL | linear_llp; 74 lflags = SLB_VSID_KERNEL | linear_llp;
75 vflags = SLB_VSID_KERNEL | virtual_llp; 75 vflags = SLB_VSID_KERNEL | vmalloc_llp;
76 76
77 ksp_esid_data = mk_esid_data(get_paca()->kstack, 2); 77 ksp_esid_data = mk_esid_data(get_paca()->kstack, 2);
78 if ((ksp_esid_data & ESID_MASK) == PAGE_OFFSET) 78 if ((ksp_esid_data & ESID_MASK) == PAGE_OFFSET)
@@ -122,9 +122,6 @@ void switch_slb(struct task_struct *tsk, struct mm_struct *mm)
122 122
123 get_paca()->slb_cache_ptr = 0; 123 get_paca()->slb_cache_ptr = 0;
124 get_paca()->context = mm->context; 124 get_paca()->context = mm->context;
125#ifdef CONFIG_PPC_64K_PAGES
126 get_paca()->pgdir = mm->pgd;
127#endif /* CONFIG_PPC_64K_PAGES */
128 125
129 /* 126 /*
130 * preload some userspace segments into the SLB. 127 * preload some userspace segments into the SLB.
@@ -167,11 +164,10 @@ static inline void patch_slb_encoding(unsigned int *insn_addr,
167 164
168void slb_initialize(void) 165void slb_initialize(void)
169{ 166{
170 unsigned long linear_llp, virtual_llp; 167 unsigned long linear_llp, vmalloc_llp, io_llp;
171 static int slb_encoding_inited; 168 static int slb_encoding_inited;
172 extern unsigned int *slb_miss_kernel_load_linear; 169 extern unsigned int *slb_miss_kernel_load_linear;
173 extern unsigned int *slb_miss_kernel_load_virtual; 170 extern unsigned int *slb_miss_kernel_load_io;
174 extern unsigned int *slb_miss_user_load_normal;
175#ifdef CONFIG_HUGETLB_PAGE 171#ifdef CONFIG_HUGETLB_PAGE
176 extern unsigned int *slb_miss_user_load_huge; 172 extern unsigned int *slb_miss_user_load_huge;
177 unsigned long huge_llp; 173 unsigned long huge_llp;
@@ -181,18 +177,19 @@ void slb_initialize(void)
181 177
182 /* Prepare our SLB miss handler based on our page size */ 178 /* Prepare our SLB miss handler based on our page size */
183 linear_llp = mmu_psize_defs[mmu_linear_psize].sllp; 179 linear_llp = mmu_psize_defs[mmu_linear_psize].sllp;
184 virtual_llp = mmu_psize_defs[mmu_virtual_psize].sllp; 180 io_llp = mmu_psize_defs[mmu_io_psize].sllp;
181 vmalloc_llp = mmu_psize_defs[mmu_vmalloc_psize].sllp;
182 get_paca()->vmalloc_sllp = SLB_VSID_KERNEL | vmalloc_llp;
183
185 if (!slb_encoding_inited) { 184 if (!slb_encoding_inited) {
186 slb_encoding_inited = 1; 185 slb_encoding_inited = 1;
187 patch_slb_encoding(slb_miss_kernel_load_linear, 186 patch_slb_encoding(slb_miss_kernel_load_linear,
188 SLB_VSID_KERNEL | linear_llp); 187 SLB_VSID_KERNEL | linear_llp);
189 patch_slb_encoding(slb_miss_kernel_load_virtual, 188 patch_slb_encoding(slb_miss_kernel_load_io,
190 SLB_VSID_KERNEL | virtual_llp); 189 SLB_VSID_KERNEL | io_llp);
191 patch_slb_encoding(slb_miss_user_load_normal,
192 SLB_VSID_USER | virtual_llp);
193 190
194 DBG("SLB: linear LLP = %04x\n", linear_llp); 191 DBG("SLB: linear LLP = %04x\n", linear_llp);
195 DBG("SLB: virtual LLP = %04x\n", virtual_llp); 192 DBG("SLB: io LLP = %04x\n", io_llp);
196#ifdef CONFIG_HUGETLB_PAGE 193#ifdef CONFIG_HUGETLB_PAGE
197 patch_slb_encoding(slb_miss_user_load_huge, 194 patch_slb_encoding(slb_miss_user_load_huge,
198 SLB_VSID_USER | huge_llp); 195 SLB_VSID_USER | huge_llp);
@@ -207,7 +204,7 @@ void slb_initialize(void)
207 unsigned long lflags, vflags; 204 unsigned long lflags, vflags;
208 205
209 lflags = SLB_VSID_KERNEL | linear_llp; 206 lflags = SLB_VSID_KERNEL | linear_llp;
210 vflags = SLB_VSID_KERNEL | virtual_llp; 207 vflags = SLB_VSID_KERNEL | vmalloc_llp;
211 208
212 /* Invalidate the entire SLB (even slot 0) & all the ERATS */ 209 /* Invalidate the entire SLB (even slot 0) & all the ERATS */
213 asm volatile("isync":::"memory"); 210 asm volatile("isync":::"memory");
@@ -215,7 +212,6 @@ void slb_initialize(void)
215 asm volatile("isync; slbia; isync":::"memory"); 212 asm volatile("isync; slbia; isync":::"memory");
216 create_slbe(PAGE_OFFSET, lflags, 0); 213 create_slbe(PAGE_OFFSET, lflags, 0);
217 214
218 /* VMALLOC space has 4K pages always for now */
219 create_slbe(VMALLOC_START, vflags, 1); 215 create_slbe(VMALLOC_START, vflags, 1);
220 216
221 /* We don't bolt the stack for the time being - we're in boot, 217 /* We don't bolt the stack for the time being - we're in boot,