Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d9dd421f authored by Jeremy Kerr's avatar Jeremy Kerr
Browse files

powerpc/spufs: fix npc setting for NOSCHED contexts



Currently, spu_run ignores the npc argument for contexts created with
SPU_CREATE_NOSCHED. While this is correct for isolated contexts,
there's no need to enforce the npc restriction on non-isolated NOSCHED
contexts.

This means that NOSCHED contexts can only ever run with an entry point
of 0x0.

This change to spu_run_init allows setting of the npc (and, while we're
at it, the privcntl) for non-isolated NOSCHED contexts. This allows
us to run NOSCHED contexts from any entry point.

Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
parent 2e1e9212
Loading
Loading
Loading
Loading
+8 −7
Original line number Original line Diff line number Diff line
@@ -206,11 +206,6 @@ static int spu_run_init(struct spu_context *ctx, u32 *npc)
			(SPU_RUNCNTL_RUNNABLE | SPU_RUNCNTL_ISOLATE);
			(SPU_RUNCNTL_RUNNABLE | SPU_RUNCNTL_ISOLATE);
		if (runcntl == 0)
		if (runcntl == 0)
			runcntl = SPU_RUNCNTL_RUNNABLE;
			runcntl = SPU_RUNCNTL_RUNNABLE;
	}

	if (ctx->flags & SPU_CREATE_NOSCHED) {
		spuctx_switch_state(ctx, SPU_UTIL_USER);
		ctx->ops->runcntl_write(ctx, runcntl);
	} else {
	} else {
		unsigned long privcntl;
		unsigned long privcntl;


@@ -219,10 +214,16 @@ static int spu_run_init(struct spu_context *ctx, u32 *npc)
		else
		else
			privcntl = SPU_PRIVCNTL_MODE_NORMAL;
			privcntl = SPU_PRIVCNTL_MODE_NORMAL;


		ctx->ops->npc_write(ctx, *npc);
		ctx->ops->privcntl_write(ctx, privcntl);
		ctx->ops->privcntl_write(ctx, privcntl);
		ctx->ops->npc_write(ctx, *npc);
	}

	ctx->ops->runcntl_write(ctx, runcntl);
	ctx->ops->runcntl_write(ctx, runcntl);


	if (ctx->flags & SPU_CREATE_NOSCHED) {
		spuctx_switch_state(ctx, SPU_UTIL_USER);
	} else {

		if (ctx->state == SPU_STATE_SAVED) {
		if (ctx->state == SPU_STATE_SAVED) {
			ret = spu_activate(ctx, 0);
			ret = spu_activate(ctx, 0);
			if (ret)
			if (ret)