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;