[POWERPC] spufs: Add SPU register lock
authorIshizaki Kou <kou.ishizaki@toshiba.co.jp>
Fri, 12 Jan 2007 00:52:41 +0000 (09:52 +0900)
committerPaul Mackerras <paulus@samba.org>
Wed, 24 Jan 2007 10:13:59 +0000 (21:13 +1100)
spu->register_lock should be held before accessing registers.

Signed-off-by: Kou Ishizaki <kou.ishizaki@toshiba.co.jp>
Acked-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/platforms/cell/spu_base.c

index bd7bffc3ddd08be19caf0a15572b5e727c6f0cd2..c43999a10deb76fd07cfc63146728210f3314a0b 100644 (file)
@@ -170,9 +170,11 @@ int
 spu_irq_class_0_bottom(struct spu *spu)
 {
        unsigned long stat, mask;
+       unsigned long flags;
 
        spu->class_0_pending = 0;
 
+       spin_lock_irqsave(&spu->register_lock, flags);
        mask = spu_int_mask_get(spu, 0);
        stat = spu_int_stat_get(spu, 0);
 
@@ -188,6 +190,7 @@ spu_irq_class_0_bottom(struct spu *spu)
                __spu_trap_error(spu);
 
        spu_int_stat_clear(spu, 0, stat);
+       spin_unlock_irqrestore(&spu->register_lock, flags);
 
        return (stat & 0x7) ? -EIO : 0;
 }