[Cbe-oss-dev] PATCH [1/7] add backing ops for privcntl register
Luke Browning
lukebr at linux.vnet.ibm.com
Thu Nov 1 11:07:03 EST 2007
This patch encapsulates the spu_privcntl_RW register so that it can
be written through backing ops. This is necessary so that spu contexts
can be initialized and queued to the scheduler in spufs_run_spu.
Signed-off-by: Luke Browning <lukebr at linux.vnet.ibm.com>
---
Index: linux-2.6.22/arch/powerpc/platforms/cell/spufs/backing_ops.c
===================================================================
--- linux-2.6.22.orig/arch/powerpc/platforms/cell/spufs/backing_ops.c 2007-10-22 14:05:20.000000000 -0300
+++ linux-2.6.22/arch/powerpc/platforms/cell/spufs/backing_ops.c 2007-10-22 14:06:41.000000000 -0300
@@ -267,6 +267,11 @@
return ctx->csa.lscsa->ls;
}
+static void spu_backing_privcntl_write(struct spu_context *ctx, u64 val)
+{
+ ctx->csa.priv2.spu_privcntl_RW = val;
+}
+
static u32 spu_backing_runcntl_read(struct spu_context *ctx)
{
return ctx->csa.prob.spu_runcntl_RW;
@@ -383,6 +388,7 @@
.npc_write = spu_backing_npc_write,
.status_read = spu_backing_status_read,
.get_ls = spu_backing_get_ls,
+ .privcntl_write = spu_backing_privcntl_write,
.runcntl_read = spu_backing_runcntl_read,
.runcntl_write = spu_backing_runcntl_write,
.runcntl_stop = spu_backing_runcntl_stop,
Index: linux-2.6.22/arch/powerpc/platforms/cell/spufs/hw_ops.c
===================================================================
--- linux-2.6.22.orig/arch/powerpc/platforms/cell/spufs/hw_ops.c 2007-10-22 14:05:20.000000000 -0300
+++ linux-2.6.22/arch/powerpc/platforms/cell/spufs/hw_ops.c 2007-10-22 14:15:13.000000000 -0300
@@ -206,6 +206,11 @@
return ctx->spu->local_store;
}
+static void spu_hw_privcntl_write(struct spu_context *ctx, u64 val)
+{
+ out_be64(&ctx->spu->priv2->spu_privcntl_RW, val);
+}
+
static u32 spu_hw_runcntl_read(struct spu_context *ctx)
{
return in_be32(&ctx->spu->problem->spu_runcntl_RW);
@@ -215,7 +220,8 @@
{
spin_lock_irq(&ctx->spu->register_lock);
if (val & SPU_RUNCNTL_ISOLATE)
- out_be64(&ctx->spu->priv2->spu_privcntl_RW, 4LL);
+ spu_hw_privcntl_write(ctx,
+ SPU_PRIVCNT_LOAD_REQUEST_ENABLE_MASK);
out_be32(&ctx->spu->problem->spu_runcntl_RW, val);
spin_unlock_irq(&ctx->spu->register_lock);
}
@@ -328,6 +334,7 @@
.npc_write = spu_hw_npc_write,
.status_read = spu_hw_status_read,
.get_ls = spu_hw_get_ls,
+ .privcntl_write = spu_hw_privcntl_write,
.runcntl_read = spu_hw_runcntl_read,
.runcntl_write = spu_hw_runcntl_write,
.runcntl_stop = spu_hw_runcntl_stop,
Index: linux-2.6.22/arch/powerpc/platforms/cell/spufs/run.c
===================================================================
--- linux-2.6.22.orig/arch/powerpc/platforms/cell/spufs/run.c 2007-10-22 14:05:20.000000000 -0300
+++ linux-2.6.22/arch/powerpc/platforms/cell/spufs/run.c 2007-10-22 17:06:23.000000000 -0300
@@ -128,11 +128,11 @@
static int spu_run_init(struct spu_context *ctx, u32 * npc)
{
+ unsigned long runcntl;
spuctx_switch_state(ctx, SPUCTX_UTIL_SYSTEM);
if (ctx->flags & SPU_CREATE_ISOLATE) {
- unsigned long runcntl;
if (!(ctx->ops->status_read(ctx) & SPU_STATUS_ISOLATED_STATE)) {
int ret = spu_setup_isolated(ctx);
@@ -146,16 +146,21 @@
(SPU_RUNCNTL_RUNNABLE | SPU_RUNCNTL_ISOLATE);
if (runcntl == 0)
runcntl = SPU_RUNCNTL_RUNNABLE;
- ctx->ops->runcntl_write(ctx, runcntl);
} else {
- unsigned long mode = SPU_PRIVCNTL_MODE_NORMAL;
- ctx->ops->npc_write(ctx, *npc);
+ unsigned long privcntl;
+
if (test_thread_flag(TIF_SINGLESTEP))
- mode = SPU_PRIVCNTL_MODE_SINGLE_STEP;
- out_be64(&ctx->spu->priv2->spu_privcntl_RW, mode);
- ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_RUNNABLE);
+ privcntl = SPU_PRIVCNTL_MODE_SINGLE_STEP;
+ else
+ privcntl = SPU_PRIVCNTL_MODE_NORMAL;
+ runcntl = SPU_RUNCNTL_RUNNABLE;
+
+ ctx->ops->npc_write(ctx, *npc);
+ ctx->ops->privcntl_write(ctx, privcntl);
}
+ ctx->ops->runcntl_write(ctx, runcntl);
+
spuctx_switch_state(ctx, SPUCTX_UTIL_USER);
return 0;
Index: linux-2.6.22/arch/powerpc/platforms/cell/spufs/spufs.h
===================================================================
--- linux-2.6.22.orig/arch/powerpc/platforms/cell/spufs/spufs.h 2007-10-22 14:05:20.000000000 -0300
+++ linux-2.6.22/arch/powerpc/platforms/cell/spufs/spufs.h 2007-10-22 14:16:21.000000000 -0300
@@ -184,6 +184,7 @@
void (*npc_write) (struct spu_context * ctx, u32 data);
u32(*status_read) (struct spu_context * ctx);
char*(*get_ls) (struct spu_context * ctx);
+ void (*privcntl_write) (struct spu_context *ctx, u64 data);
u32 (*runcntl_read) (struct spu_context * ctx);
void (*runcntl_write) (struct spu_context * ctx, u32 data);
void (*runcntl_stop) (struct spu_context * ctx);
More information about the cbe-oss-dev
mailing list