[Cbe-oss-dev] [PATCH 2/2] ps3: always set master run control bit in mfc_sr1_set

Michael Ellerman michael at ellerman.id.au
Fri Sep 7 19:07:58 EST 2007


On Fri, 2007-09-07 at 18:28 +1000, Jeremy Kerr wrote:
> At present, running any SPE program on the ps3 will trigger a BUG_ON
> when spufs_run_spu tries to clear the master run control bit, as lv1
> does not make the master run control available to Linux.
> 
> This change makes SPE apps work again by disabling changes to the
> master run control on PS3. Although we don't have the facility to
> disable a SPE with supervisor-level privileges, it's better than
> hitting the BUG_ON unconditionally.
> 
> Signed-off-by: Jeremy Kerr <jk at ozlabs.org>
> 
> ---
>  arch/powerpc/platforms/ps3/spu.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/powerpc/platforms/ps3/spu.c b/arch/powerpc/platforms/ps3/spu.c
> index ac2a4b8..d1630a0 100644
> --- a/arch/powerpc/platforms/ps3/spu.c
> +++ b/arch/powerpc/platforms/ps3/spu.c
> @@ -505,6 +505,8 @@ static void mfc_sr1_set(struct spu *spu, u64 sr1)
>  	static const u64 allowed = ~(MFC_STATE1_LOCAL_STORAGE_DECODE_MASK
>  		| MFC_STATE1_PROBLEM_STATE_MASK);
>  
> +	sr1 |= MFC_STATE1_MASTER_RUN_CONTROL_MASK;
> +
>  	BUG_ON((sr1 & allowed) != (spu_pdata(spu)->cache.sr1 & allowed));
>  
>  	spu_pdata(spu)->cache.sr1 = sr1;

You're assuming it's set in cache.sr1, which is probably OK, but ..

Wouldn't this be safer:

sr1 &= ~MFC_STATE1_MASTER_RUN_CONTROL_MASK;
sr1 |= (MFC_STATE1_MASTER_RUN_CONTROL_MASK & cache.sr1)

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/cbe-oss-dev/attachments/20070907/8433bd74/attachment.pgp>


More information about the cbe-oss-dev mailing list