aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2007-12-04 21:49:31 -0500
committerArnd Bergmann <arnd@arndb.de>2007-12-18 19:00:04 -0500
commit4d43466d567a6620f4f6d8576e1bed5d7cf4c28d (patch)
tree7d7ab7164196a0c39c4e4bfef89bf988c7d68571 /arch/powerpc/platforms
parent58bd403c3c79dd41acf5af2d170bd4e0872bb326 (diff)
[POWERPC] cell: use spu_load_slb for SLB setup
Now that we have a helper function to setup a SPU SLB, use it for __spu_trap_data_seq. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index 2ec1d38829dd..8398af6b5c0b 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -169,9 +169,8 @@ static inline void spu_load_slb(struct spu *spu, int slbe, struct spu_slb *slb)
169 169
170static int __spu_trap_data_seg(struct spu *spu, unsigned long ea) 170static int __spu_trap_data_seg(struct spu *spu, unsigned long ea)
171{ 171{
172 struct spu_priv2 __iomem *priv2 = spu->priv2;
173 struct mm_struct *mm = spu->mm; 172 struct mm_struct *mm = spu->mm;
174 u64 esid, vsid, llp; 173 struct spu_slb slb;
175 int psize; 174 int psize;
176 175
177 pr_debug("%s\n", __FUNCTION__); 176 pr_debug("%s\n", __FUNCTION__);
@@ -183,7 +182,7 @@ static int __spu_trap_data_seg(struct spu *spu, unsigned long ea)
183 printk("%s: invalid access during switch!\n", __func__); 182 printk("%s: invalid access during switch!\n", __func__);
184 return 1; 183 return 1;
185 } 184 }
186 esid = (ea & ESID_MASK) | SLB_ESID_V; 185 slb.esid = (ea & ESID_MASK) | SLB_ESID_V;
187 186
188 switch(REGION_ID(ea)) { 187 switch(REGION_ID(ea)) {
189 case USER_REGION_ID: 188 case USER_REGION_ID:
@@ -192,21 +191,21 @@ static int __spu_trap_data_seg(struct spu *spu, unsigned long ea)
192#else 191#else
193 psize = mm->context.user_psize; 192 psize = mm->context.user_psize;
194#endif 193#endif
195 vsid = (get_vsid(mm->context.id, ea, MMU_SEGSIZE_256M) << SLB_VSID_SHIFT) | 194 slb.vsid = (get_vsid(mm->context.id, ea, MMU_SEGSIZE_256M)
196 SLB_VSID_USER; 195 << SLB_VSID_SHIFT) | SLB_VSID_USER;
197 break; 196 break;
198 case VMALLOC_REGION_ID: 197 case VMALLOC_REGION_ID:
199 if (ea < VMALLOC_END) 198 if (ea < VMALLOC_END)
200 psize = mmu_vmalloc_psize; 199 psize = mmu_vmalloc_psize;
201 else 200 else
202 psize = mmu_io_psize; 201 psize = mmu_io_psize;
203 vsid = (get_kernel_vsid(ea, MMU_SEGSIZE_256M) << SLB_VSID_SHIFT) | 202 slb.vsid = (get_kernel_vsid(ea, MMU_SEGSIZE_256M)
204 SLB_VSID_KERNEL; 203 << SLB_VSID_SHIFT) | SLB_VSID_KERNEL;
205 break; 204 break;
206 case KERNEL_REGION_ID: 205 case KERNEL_REGION_ID:
207 psize = mmu_linear_psize; 206 psize = mmu_linear_psize;
208 vsid = (get_kernel_vsid(ea, MMU_SEGSIZE_256M) << SLB_VSID_SHIFT) | 207 slb.vsid = (get_kernel_vsid(ea, MMU_SEGSIZE_256M)
209 SLB_VSID_KERNEL; 208 << SLB_VSID_SHIFT) | SLB_VSID_KERNEL;
210 break; 209 break;
211 default: 210 default:
212 /* Future: support kernel segments so that drivers 211 /* Future: support kernel segments so that drivers
@@ -215,11 +214,9 @@ static int __spu_trap_data_seg(struct spu *spu, unsigned long ea)
215 pr_debug("invalid region access at %016lx\n", ea); 214 pr_debug("invalid region access at %016lx\n", ea);
216 return 1; 215 return 1;
217 } 216 }
218 llp = mmu_psize_defs[psize].sllp; 217 slb.vsid |= mmu_psize_defs[psize].sllp;
219 218
220 out_be64(&priv2->slb_index_W, spu->slb_replace); 219 spu_load_slb(spu, spu->slb_replace, &slb);
221 out_be64(&priv2->slb_vsid_RW, vsid | llp);
222 out_be64(&priv2->slb_esid_RW, esid);
223 220
224 spu->slb_replace++; 221 spu->slb_replace++;
225 if (spu->slb_replace >= 8) 222 if (spu->slb_replace >= 8)