#undef DEBUG
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/sched.h>
#include <asm/mmu_context.h>
#include <asm/spu.h>
#include <asm/spu_csa.h>
+#include <asm/spu_priv1.h>
#include "spufs.h"
#define SPU_MIN_TIMESLICE (100 * HZ / 1000)
spu->ibox_callback = spufs_ibox_callback;
spu->wbox_callback = spufs_wbox_callback;
spu->stop_callback = spufs_stop_callback;
+ spu->mfc_callback = spufs_mfc_callback;
mb();
spu_unmap_mappings(ctx);
spu_restore(&ctx->csa, spu);
spu->ibox_callback = NULL;
spu->wbox_callback = NULL;
spu->stop_callback = NULL;
+ spu->mfc_callback = NULL;
spu->mm = NULL;
spu->pid = 0;
spu->prio = MAX_PRIO;
down_write(&ctx->state_sema);
spu = ctx->spu;
- if (spu && (ctx->flags & SPU_CONTEXT_PREEMPT)) {
+ if (spu && test_bit(SPU_CONTEXT_PREEMPT, &ctx->flags)) {
if (atomic_read(&spu->rq->prio.nr_blocked)) {
pr_debug("%s: spu=%d\n", __func__, spu->number);
ctx->ops->runcntl_stop(ctx);
spu_deactivate(ctx);
wake_up_all(&ctx->stop_wq);
} else {
- clear_bit(SPU_CONTEXT_PREEMPT_nr, &ctx->flags);
+ clear_bit(SPU_CONTEXT_PREEMPT, &ctx->flags);
}
}
up_write(&ctx->state_sema);
unsigned long now = jiffies;
unsigned long expire = spu->timestamp + SPU_MIN_TIMESLICE;
- set_bit(SPU_CONTEXT_PREEMPT_nr, &ctx->flags);
+ set_bit(SPU_CONTEXT_PREEMPT, &ctx->flags);
INIT_WORK(&ctx->reap_work, spu_reaper, ctx);
if (time_after(now, expire))
schedule_work(&ctx->reap_work);
list_for_each(p, &rq->active_list) {
struct spu *spu = list_entry(p, struct spu, sched_list);
struct spu_context *ctx = spu->ctx;
- if (!(ctx->flags & SPU_CONTEXT_PREEMPT)) {
+ if (!test_bit(SPU_CONTEXT_PREEMPT, &ctx->flags)) {
if (!worst || (spu->prio > worst->prio)) {
worst = spu;
}
if (!spu)
return (signal_pending(current)) ? -ERESTARTSYS : -EAGAIN;
bind_context(spu, ctx);
+ /*
+ * We're likely to wait for interrupts on the same
+ * CPU that we are now on, so send them here.
+ */
+ spu_cpu_affinity_set(spu, raw_smp_processor_id());
put_active_spu(spu);
return 0;
}