[POWERPC] spufs: fix MFC command queue purge
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 23 Jun 2006 18:57:48 +0000 (20:57 +0200)
committerPaul Mackerras <paulus@samba.org>
Wed, 28 Jun 2006 01:59:48 +0000 (11:59 +1000)
commit910ab66b1c94a2758725874d389136cf9acdc04c
tree79d35d7b83af309e13e4e028b72bd893e0433695
parent23cc770107c2d27dd1f5dee53177ea1163ee9295
[POWERPC] spufs: fix MFC command queue purge

In the context save/restore code, the SPU MFC command queue purge
code has a bug:

static inline void wait_purge_complete(struct spu_state *csa, struct
       spu *spu)
{
    struct spu_priv2 __iomem *priv2 = spu->priv2;

    /* Save, Step 28:
     *     Poll MFC_CNTL[Ps] until value '11' is
     *     read
     *      (purge complete).
     */
    POLL_WHILE_FALSE(in_be64(&priv2->mfc_control_RW)
     & MFC_CNTL_PURGE_DMA_COMPLETE);
}

This will exit as soon as _one_ of the 2 bits that compose
MFC_CNTL_PURGE_DMA_COMPLETE is set, and one of them happens to be
"purge in progress"...  which means that we'll happily continue
restoring the MFC while it's being purged at the same time.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/platforms/cell/spufs/switch.c