Subject: spufs: Avoid unexpected restaring MFC in context saving (take 2) From: Kazunori Asayama 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 Acked-by: Jeremy Kerr Signed-off-by: Arnd Bergmann --- arch/powerpc/platforms/cell/spufs/switch.c | 3 ++- include/asm-powerpc/spu.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) Index: linux-2.6/arch/powerpc/platforms/cell/spufs/switch.c =================================================================== --- linux-2.6.orig/arch/powerpc/platforms/cell/spufs/switch.c +++ linux-2.6/arch/powerpc/platforms/cell/spufs/switch.c @@ -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: linux-2.6/include/asm-powerpc/spu.h =================================================================== --- linux-2.6.orig/include/asm-powerpc/spu.h +++ linux-2.6/include/asm-powerpc/spu.h @@ -439,6 +439,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)