Skip to content

Commit

Permalink
powerpc/spufs: wait for stable spu status in spu_stopped()
Browse files Browse the repository at this point in the history
If the spu is stopping (ie, the SPU_STATUS_RUNNING bit is still set),
re-read the register to get the final stopped value.

Signed-off-by: Luke Browning <lukebrowning@us.ibm.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
  • Loading branch information
Luke Browning authored and Jeremy Kerr committed Jun 16, 2008
1 parent d563923 commit d84050f
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions arch/powerpc/platforms/cell/spufs/run.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,22 @@ int spu_stopped(struct spu_context *ctx, u32 *stat)
u64 dsisr;
u32 stopped;

*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))
top:
*stat = ctx->ops->status_read(ctx);
if (*stat & stopped) {
/*
* If the spu hasn't finished stopping, we need to
* re-read the register to get the stopped value.
*/
if (*stat & SPU_STATUS_RUNNING)
goto top;
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;
Expand Down

0 comments on commit d84050f

Please sign in to comment.