aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/cell/spufs
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
commit58bd403c3c79dd41acf5af2d170bd4e0872bb326 (patch)
tree64e30777f28b9378d690e224aefbaac27be79d7b /arch/powerpc/platforms/cell/spufs
parenta0a7ae8939e3fdecf5478ddba54562e23de7ca1d (diff)
[POWERPC] cell: handle kernel SLB setup in spu_base.c
Currently, the SPU context switch code (spufs/switch.c) sets up the SPU's SLBs directly, which requires some low-level mm stuff. This change moves the kernel SLB setup to spu_base.c, by exposing a function spu_setup_kernel_slbs() to do this setup. This allows us to remove the low-level mm code from switch.c, making it possible to later move switch.c to the spufs module. Also, add a struct spu_slb for the cases where we need to deal with SLB entries. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/powerpc/platforms/cell/spufs')
-rw-r--r--arch/powerpc/platforms/cell/spufs/switch.c33
1 files changed, 1 insertions, 32 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/switch.c b/arch/powerpc/platforms/cell/spufs/switch.c
index 3d64c81cc6e..96f55148a40 100644
--- a/arch/powerpc/platforms/cell/spufs/switch.c
+++ b/arch/powerpc/platforms/cell/spufs/switch.c
@@ -691,35 +691,8 @@ static inline void resume_mfc_queue(struct spu_state *csa, struct spu *spu)
691 out_be64(&priv2->mfc_control_RW, MFC_CNTL_RESUME_DMA_QUEUE); 691 out_be64(&priv2->mfc_control_RW, MFC_CNTL_RESUME_DMA_QUEUE);
692} 692}
693 693
694static inline void get_kernel_slb(u64 ea, u64 slb[2])
695{
696 u64 llp;
697
698 if (REGION_ID(ea) == KERNEL_REGION_ID)
699 llp = mmu_psize_defs[mmu_linear_psize].sllp;
700 else
701 llp = mmu_psize_defs[mmu_virtual_psize].sllp;
702 slb[0] = (get_kernel_vsid(ea, MMU_SEGSIZE_256M) << SLB_VSID_SHIFT) |
703 SLB_VSID_KERNEL | llp;
704 slb[1] = (ea & ESID_MASK) | SLB_ESID_V;
705}
706
707static inline void load_mfc_slb(struct spu *spu, u64 slb[2], int slbe)
708{
709 struct spu_priv2 __iomem *priv2 = spu->priv2;
710
711 out_be64(&priv2->slb_index_W, slbe);
712 eieio();
713 out_be64(&priv2->slb_vsid_RW, slb[0]);
714 out_be64(&priv2->slb_esid_RW, slb[1]);
715 eieio();
716}
717
718static inline void setup_mfc_slbs(struct spu_state *csa, struct spu *spu) 694static inline void setup_mfc_slbs(struct spu_state *csa, struct spu *spu)
719{ 695{
720 u64 code_slb[2];
721 u64 lscsa_slb[2];
722
723 /* Save, Step 47: 696 /* Save, Step 47:
724 * Restore, Step 30. 697 * Restore, Step 30.
725 * If MFC_SR1[R]=1, write 0 to SLB_Invalidate_All 698 * If MFC_SR1[R]=1, write 0 to SLB_Invalidate_All
@@ -735,11 +708,7 @@ static inline void setup_mfc_slbs(struct spu_state *csa, struct spu *spu)
735 * translation is desired by OS environment). 708 * translation is desired by OS environment).
736 */ 709 */
737 spu_invalidate_slbs(spu); 710 spu_invalidate_slbs(spu);
738 get_kernel_slb((unsigned long)&spu_save_code[0], code_slb); 711 spu_setup_kernel_slbs(spu, csa->lscsa, &spu_save_code);
739 get_kernel_slb((unsigned long)csa->lscsa, lscsa_slb);
740 load_mfc_slb(spu, code_slb, 0);
741 if ((lscsa_slb[0] != code_slb[0]) || (lscsa_slb[1] != code_slb[1]))
742 load_mfc_slb(spu, lscsa_slb, 1);
743} 712}
744 713
745static inline void set_switch_active(struct spu_state *csa, struct spu *spu) 714static inline void set_switch_active(struct spu_state *csa, struct spu *spu)