[Cbe-oss-dev] [patch 4/6] spufs: wrap cpu affinity

Geoff Levand geoffrey.levand at am.sony.com
Thu Apr 27 07:52:44 EST 2006


This changes the hypervisor abstraction of setting cpu affinity to a
higher level to avoid platform dependent interrupt controller
routines.  I replaced spu_priv1_ops:spu_int_route_set() with a
new routine spu_priv1_ops:spu_set_cpu_affinity().

As a by-product, this change eliminated what looked like an
existing bug in the set affinity code where spu_int_route_set()
mistakenly called int_stat_get().


Signed-off-by: Geoff Levand <geoffrey.levand at am.sony.com>

--


Index: cell--alp--1/arch/powerpc/platforms/cell/spu_base.c
===================================================================
--- cell--alp--1.orig/arch/powerpc/platforms/cell/spu_base.c	2006-04-26 11:57:12.000000000 -0700
+++ cell--alp--1/arch/powerpc/platforms/cell/spu_base.c	2006-04-26 12:01:41.000000000 -0700
@@ -524,9 +524,7 @@

 void spu_irq_setaffinity(struct spu *spu, int cpu)
 {
-	u64 target = iic_get_target_id(cpu);
-	u64 route = target << 48 | target << 32 | target << 16;
-	spu_int_route_set(spu, route);
+	spu_set_cpu_affinity(spu, cpu);
 }
 EXPORT_SYMBOL_GPL(spu_irq_setaffinity);

Index: cell--alp--1/arch/powerpc/platforms/cell/spu_priv1.c
===================================================================
--- cell--alp--1.orig/arch/powerpc/platforms/cell/spu_priv1.c	2006-04-26 11:57:12.000000000 -0700
+++ cell--alp--1/arch/powerpc/platforms/cell/spu_priv1.c	2006-04-26 12:56:04.000000000 -0700
@@ -61,8 +61,10 @@
 	return in_be64(&spu->priv1->int_stat_RW[class]);
 }

-static void int_route_set(struct spu *spu, u64 route)
+static void set_cpu_affinity(struct spu *spu, int cpu)
 {
+	u64 target = iic_get_target_id(cpu);
+	u64 route = target << 48 | target << 32 | target << 16;
 	out_be64(&spu->priv1->int_route_RW, route);
 }

@@ -148,7 +150,7 @@
 	.int_mask_get = int_mask_get,
 	.int_stat_clear = int_stat_clear,
 	.int_stat_get = int_stat_get,
-	.int_route_set = int_route_set,
+	.set_cpu_affinity = set_cpu_affinity,
 	.mfc_dar_get = mfc_dar_get,
 	.mfc_dsisr_get = mfc_dsisr_get,
 	.mfc_dsisr_set = mfc_dsisr_set,
Index: cell--alp--1/include/asm-powerpc/spu_priv1.h
===================================================================
--- cell--alp--1.orig/include/asm-powerpc/spu_priv1.h	2006-04-26 11:57:12.000000000 -0700
+++ cell--alp--1/include/asm-powerpc/spu_priv1.h	2006-04-26 12:05:11.000000000 -0700
@@ -33,7 +33,7 @@
 	u64 (*int_mask_get) (struct spu *spu, int class);
 	void (*int_stat_clear) (struct spu *spu, int class, u64 stat);
 	u64 (*int_stat_get) (struct spu *spu, int class);
-	void (*int_route_set) (struct spu *spu, u64 route);
+	void (*set_cpu_affinity) (struct spu *spu, int cpu);
 	u64 (*mfc_dar_get) (struct spu *spu);
 	u64 (*mfc_dsisr_get) (struct spu *spu);
 	void (*mfc_dsisr_set) (struct spu *spu, u64 dsisr);
@@ -89,9 +89,9 @@
 }

 static inline void
-spu_int_route_set (struct spu *spu, u64 route)
+spu_set_cpu_affinity (struct spu *spu, int cpu)
 {
-	spu_priv1_ops->int_stat_get(spu, route);
+	spu_priv1_ops->set_cpu_affinity(spu, cpu);
 }

 static inline u64




More information about the cbe-oss-dev mailing list