[Cbe-oss-dev] [PATCH] spufs: Avoid unexpected restaring MFC in context saving (take 2)

Kazunori Asayama asayama at sm.sony.co.jp
Thu Jul 5 13:17:14 EST 2007


The current SPU context saving procedure in SPUFS unexpectedly
restarts MFC when halting decrementer, because MFC_CNTL[Dh] is set
without MFC_CNTL[Sm]. This bug causes, for example, saving broken DMA
queues. Here is a patch to fix the problem.

The only difference from the previous patch is the name of "Suspend
Mask" (Sm) bit, per Jeremy Kerr's suggestion.

Signed-off-by: Kazunori Asayama <asayama at sm.sony.co.jp>

---
 arch/powerpc/platforms/cell/spufs/switch.c |    3 ++-
 include/asm-powerpc/spu.h                  |    1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

Index: b/arch/powerpc/platforms/cell/spufs/switch.c
===================================================================
--- a/arch/powerpc/platforms/cell/spufs/switch.c	2007-06-29 17:15:14.000000000 +0900
+++ b/arch/powerpc/platforms/cell/spufs/switch.c	2007-07-04 10:22:09.000000000 +0900
@@ -271,7 +271,8 @@ static inline void halt_mfc_decr(struct 
 	 *     Write MFC_CNTL[Dh] set to a '1' to halt
 	 *     the decrementer.
 	 */
-	out_be64(&priv2->mfc_control_RW, MFC_CNTL_DECREMENTER_HALTED);
+	out_be64(&priv2->mfc_control_RW,
+		 MFC_CNTL_DECREMENTER_HALTED | MFC_CNTL_SUSPEND_MASK);
 	eieio();
 }
 
Index: b/include/asm-powerpc/spu.h
===================================================================
--- a/include/asm-powerpc/spu.h	2007-06-18 15:42:02.000000000 +0900
+++ b/include/asm-powerpc/spu.h	2007-07-04 10:23:34.000000000 +0900
@@ -380,6 +380,7 @@ struct spu_priv2 {
 #define MFC_CNTL_RESUME_DMA_QUEUE		(0ull << 0)
 #define MFC_CNTL_SUSPEND_DMA_QUEUE		(1ull << 0)
 #define MFC_CNTL_SUSPEND_DMA_QUEUE_MASK		(1ull << 0)
+#define MFC_CNTL_SUSPEND_MASK			(1ull << 4)
 #define MFC_CNTL_NORMAL_DMA_QUEUE_OPERATION	(0ull << 8)
 #define MFC_CNTL_SUSPEND_IN_PROGRESS		(1ull << 8)
 #define MFC_CNTL_SUSPEND_COMPLETE		(3ull << 8)



More information about the cbe-oss-dev mailing list