[Cbe-oss-dev] [PATCH 2:6] spufs: fix spu status read in spu_stopped
Luke Browning
lukebr at linux.vnet.ibm.com
Tue May 13 00:37:04 EST 2008
Fix spu status read in spu_stopped()
If the spu is stopping, re-read the register to get the stopped value.
SPU status is a loop control variable in the calling routine.
Signed-off-by: Luke Browning <lukebrowning at us.ibm.com>
---
Index: spufs/arch/powerpc/platforms/cell/spufs/run.c
===================================================================
--- spufs.orig/arch/powerpc/platforms/cell/spufs/run.c
+++ spufs/arch/powerpc/platforms/cell/spufs/run.c
@@ -49,16 +49,21 @@ void spufs_stop_callback(struct spu *spu
int spu_stopped(struct spu_context *ctx, u32 *stat)
{
u64 dsisr;
- u32 stopped;
+ u32 stopped, status;
- *stat = ctx->ops->status_read(ctx);
+ stopped = SPU_STATUS_INVALID_INSTR | SPU_STATUS_SINGLE_STEP |
+ SPU_STATUS_STOPPED_BY_HALT | SPU_STATUS_STOPPED_BY_STOP;
- if (test_bit(SPU_SCHED_NOTIFY_ACTIVE, &ctx->sched_flags))
+ do {
+ status = ctx->ops->status_read(ctx);
+ } while ((status & SPU_STATUS_RUNNING) && (status & stopped));
+
+ *stat = status;
+
+ if (status & stopped)
return 1;
- stopped = SPU_STATUS_INVALID_INSTR | SPU_STATUS_SINGLE_STEP |
- SPU_STATUS_STOPPED_BY_HALT | SPU_STATUS_STOPPED_BY_STOP;
- if (!(*stat & SPU_STATUS_RUNNING) && (*stat & stopped))
+ if (test_bit(SPU_SCHED_NOTIFY_ACTIVE, &ctx->sched_flags))
return 1;
dsisr = ctx->csa.class_0_dsisr;
More information about the cbe-oss-dev
mailing list