aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/cell/spufs/switch.c
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:05 -0500
commit684bd614015188561197342fd336292e9e2ce196 (patch)
tree89307cd386307b6bdfa9c65165a8d0fc95eb77d5 /arch/powerpc/platforms/cell/spufs/switch.c
parentf6eb7d7ffef3e2fa40b0161c30486cb87203758d (diff)
[POWERPC] cell: handle SPE kernel mappings that cross segment boundaries
Currently, we have a possibilty that the SLBs setup during context switch don't cover the entirety of the necessary lscsa and code regions, if these regions cross a segment boundary. This change checks the start and end of each region, and inserts a SLB entry for each, if unique. We also remove the assumption that the spu_save_code and spu_restore_code reside in the same segment, by using the specific code array for save and restore. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/powerpc/platforms/cell/spufs/switch.c')
-rw-r--r--arch/powerpc/platforms/cell/spufs/switch.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/switch.c b/arch/powerpc/platforms/cell/spufs/switch.c
index 96f55148a408..8cbc6574820f 100644
--- a/arch/powerpc/platforms/cell/spufs/switch.c
+++ b/arch/powerpc/platforms/cell/spufs/switch.c
@@ -691,7 +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 setup_mfc_slbs(struct spu_state *csa, struct spu *spu) 694static inline void setup_mfc_slbs(struct spu_state *csa, struct spu *spu,
695 unsigned int *code, int code_size)
695{ 696{
696 /* Save, Step 47: 697 /* Save, Step 47:
697 * Restore, Step 30. 698 * Restore, Step 30.
@@ -708,7 +709,7 @@ static inline void setup_mfc_slbs(struct spu_state *csa, struct spu *spu)
708 * translation is desired by OS environment). 709 * translation is desired by OS environment).
709 */ 710 */
710 spu_invalidate_slbs(spu); 711 spu_invalidate_slbs(spu);
711 spu_setup_kernel_slbs(spu, csa->lscsa, &spu_save_code); 712 spu_setup_kernel_slbs(spu, csa->lscsa, code, code_size);
712} 713}
713 714
714static inline void set_switch_active(struct spu_state *csa, struct spu *spu) 715static inline void set_switch_active(struct spu_state *csa, struct spu *spu)
@@ -1835,7 +1836,8 @@ static void save_lscsa(struct spu_state *prev, struct spu *spu)
1835 */ 1836 */
1836 1837
1837 resume_mfc_queue(prev, spu); /* Step 46. */ 1838 resume_mfc_queue(prev, spu); /* Step 46. */
1838 setup_mfc_slbs(prev, spu); /* Step 47. */ 1839 /* Step 47. */
1840 setup_mfc_slbs(prev, spu, spu_save_code, sizeof(spu_save_code));
1839 set_switch_active(prev, spu); /* Step 48. */ 1841 set_switch_active(prev, spu); /* Step 48. */
1840 enable_interrupts(prev, spu); /* Step 49. */ 1842 enable_interrupts(prev, spu); /* Step 49. */
1841 save_ls_16kb(prev, spu); /* Step 50. */ 1843 save_ls_16kb(prev, spu); /* Step 50. */
@@ -1940,7 +1942,8 @@ static void restore_lscsa(struct spu_state *next, struct spu *spu)
1940 setup_spu_status_part1(next, spu); /* Step 27. */ 1942 setup_spu_status_part1(next, spu); /* Step 27. */
1941 setup_spu_status_part2(next, spu); /* Step 28. */ 1943 setup_spu_status_part2(next, spu); /* Step 28. */
1942 restore_mfc_rag(next, spu); /* Step 29. */ 1944 restore_mfc_rag(next, spu); /* Step 29. */
1943 setup_mfc_slbs(next, spu); /* Step 30. */ 1945 /* Step 30. */
1946 setup_mfc_slbs(next, spu, spu_restore_code, sizeof(spu_restore_code));
1944 set_spu_npc(next, spu); /* Step 31. */ 1947 set_spu_npc(next, spu); /* Step 31. */
1945 set_signot1(next, spu); /* Step 32. */ 1948 set_signot1(next, spu); /* Step 32. */
1946 set_signot2(next, spu); /* Step 33. */ 1949 set_signot2(next, spu); /* Step 33. */