[PATCH 6/16] cell: abstract spu management routines

Geoff Levand geoffrey.levand at am.sony.com
Tue Nov 14 21:50:57 EST 2006


Arnd Bergmann wrote:
> On Tuesday 14 November 2006 04:44, Michael Ellerman wrote:
>> OK, back to the task at hand :) �For the moment I'd rather see you leave
>> out dump_data_fields(), as neither HV or baremetal implementations do
>> anything. Just put the offending xmon code inside an #ifdef
>> CONFIG_PPC_CELL_NATIVE. eg:
>> 
>> Index: cell/arch/powerpc/xmon/xmon.c
>> ===================================================================
>> --- cell.orig/arch/powerpc/xmon/xmon.c �2006-11-14 14:43:11.000000000 +1100
>> +++ cell/arch/powerpc/xmon/xmon.c � � � 2006-11-14 14:42:35.000000000 +1100
>> @@ -2807,12 +2807,11 @@ static void dump_spu_fields(struct spu *
>> � � � � � � � � � � � � in_be32(&spu->problem->spu_status_R));
>> � � � � DUMP_VALUE("0x%x", problem->spu_npc_RW,
>> � � � � � � � � � � � � in_be32(&spu->problem->spu_npc_RW));
>> +#ifdef CONFIG_PPC_CELL_NATIVE
>> � � � � DUMP_FIELD(spu, "0x%p", priv1);
>> -
>> - � � � if (spu->priv1) {
>> - � � � � � � � DUMP_VALUE("0x%lx", priv1->mfc_sr1_RW,
>> - � � � � � � � � � � � � � � � in_be64(&spu->priv1->mfc_sr1_RW));
>> - � � � }
>> + � � � DUMP_VALUE("0x%lx", priv1->mfc_sr1_RW,
>> + � � � � � � � � � � � in_be64(&spu->priv1->mfc_sr1_RW));
>> +#endif
> 
> Oops. Null pointer dereference.
> 
> You can't do this if you want to compile in both native and PS3PF
> support in a single kernel. I think your original code that prints
> priv1 and the sr1 only if priv1 exists is fine on both ways.

No, that won't work either since I moved priv1 to struct spu_pdata.

+struct spu_pdata {
+	int nid;
+	struct device_node *devnode;
+	struct spu_priv1 __iomem *priv1;
+};

The only way I see this working is to have a platform specific
routine to dump those spu_pdata variables.  The problem is that
only the spu platform code knows about the variables, and only the
xmon code knows how to do the dump.  That is why I suggested earlier
to re-work the xmon code to make a dump routine with global scope
that can be called from the various spu platform 
spu_dump_pdata_fields() routines.

Note that this is not specific to the native support, since I want
to hook my platform code into xmon also, and I need to somehow
dump my variables.  So the solution is not to add priv1 back into
struct spu.

-Geoff


More information about the Linuxppc-dev mailing list