[Cbe-oss-dev] [PATCH] cell: move SPU affinity init code to a separate file

Geoff Levand geoffrey.levand at am.sony.com
Wed Jul 25 04:48:46 EST 2007


Andre Detsch wrote:
> Subject: cell - move SPU affinity init code to a separate file
> 
> From: Andre Detsch <adetsch at br.ibm.com>
> 
> This patch moves affinity initialization code from spu_base.c to a
> new spu_affinity.c file. This file is not compiled for PS3,
> fixing a linking issue which was happening when compiling for this
> platform.
> 
> SPU affinity initialization must be run _after_ spu_base.c
> initialization. This is ensured through the order of the object files 
> set in the Makefile.
> 
> Signed-off-by: Andre Detsch <adetsch at br.ibm.com>
> 
> Index: linux-2.6.22/arch/powerpc/platforms/cell/Makefile
> ===================================================================
> --- linux-2.6.22.orig/arch/powerpc/platforms/cell/Makefile
> +++ linux-2.6.22/arch/powerpc/platforms/cell/Makefile
> @@ -16,8 +16,8 @@ endif
>  spufs-modular-$(CONFIG_SPU_FS)		+= spu_syscalls.o
>  spu-priv1-$(CONFIG_PPC_CELL_NATIVE)	+= spu_priv1_mmio.o
>  
> -spu-manage-$(CONFIG_PPC_CELLEB)		+= spu_manage.o
> -spu-manage-$(CONFIG_PPC_CELL_NATIVE)	+= spu_manage.o
> +spu-manage-$(CONFIG_PPC_CELLEB)		+= spu_manage.o spu_affinity.o
> +spu-manage-$(CONFIG_PPC_CELL_NATIVE)	+= spu_manage.o spu_affinity.o


Note that when both CONFIG_PPC_CELL_NATIVE=y and CONFIG_PPC_PS3=y,
spu_affinity.o gets built.  There is nothing wrong with that in itself,
but I just want to point out the condition since the code below doesn't
handle it properly.


>  obj-$(CONFIG_SPU_BASE)			+= spu_callbacks.o spu_base.o \
>  					   spu_coredump.o \
> Index: linux-2.6.22/arch/powerpc/platforms/cell/spu_affinity.c
> ===================================================================
> --- /dev/null
> +++ linux-2.6.22/arch/powerpc/platforms/cell/spu_affinity.c
...
> +static void init_aff_fw_vicinity(void)
> +{
> +	int cbe;
> +
> +	/* sets has_mem_affinity for each spu, as long as the
> +	 * spu->aff_list list, linking each spu to its neighbors
> +	 */
> +	for (cbe = 0; cbe < MAX_NUMNODES; cbe++)
> +		init_aff_fw_vicinity_node(cbe);
> +}
> +
> +
> +


Too many line feeds here.


> +static int init_spu_affinity(void)
> +{
> +	if (of_has_vicinity()) {
> +		init_aff_fw_vicinity();
> +	} else {
> +		long root = of_get_flat_dt_root();
> +		if (of_flat_dt_is_compatible(root, "IBM,CPBW-1.0"))
> +			init_aff_QS20_harcoded();
> +	}
> +
> +	return 0;
> +}
> +
> +module_init(init_spu_affinity);


There is nothing here to prevent this code from executing
on the PS3.  module_init() will unconditionaly run
init_spu_affinity() for all platforms.  PS3 has no OF, and
when this code runs it will most likely fault.  Even if it
does run, it won't be doing the correct thing.

-Geoff





More information about the cbe-oss-dev mailing list