diff options
author | Arnd Bergmann <arnd@arndb.de> | 2006-12-19 09:32:45 -0500 |
---|---|---|
committer | Arnd Bergmann <arnd@klappe.arndb.de> | 2006-12-19 09:35:39 -0500 |
commit | ccb4911598172a131b6a2d99d7eecfcee1ecc8f7 (patch) | |
tree | d8c0a7560a83a04c7341b3f7ef0439013fe8ca1e /arch/powerpc/platforms | |
parent | 6e22ba63f01b9bdcd1f29251a95047d310526207 (diff) |
[POWERPC] spufs: fix assignment of node numbers
The difference between 'nid' and 'node' fields in an
spu structure was used incorrectly. The common 'node'
number now reflects the NUMA node, and it is used
in other places in the code as well.
The 'nid' value is meaningful only in one place, namely
the computation of the interrupt numbers based on the
physical location of an spu. Consequently, we look it
up directly in the place where it is used now.
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r-- | arch/powerpc/platforms/cell/spu_priv1_mmio.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/arch/powerpc/platforms/cell/spu_priv1_mmio.c b/arch/powerpc/platforms/cell/spu_priv1_mmio.c index c805e63b7d5c..910a926b61a2 100644 --- a/arch/powerpc/platforms/cell/spu_priv1_mmio.c +++ b/arch/powerpc/platforms/cell/spu_priv1_mmio.c | |||
@@ -40,7 +40,6 @@ | |||
40 | static DEFINE_MUTEX(add_spumem_mutex); | 40 | static DEFINE_MUTEX(add_spumem_mutex); |
41 | 41 | ||
42 | struct spu_pdata { | 42 | struct spu_pdata { |
43 | int nid; | ||
44 | struct device_node *devnode; | 43 | struct device_node *devnode; |
45 | struct spu_priv1 __iomem *priv1; | 44 | struct spu_priv1 __iomem *priv1; |
46 | }; | 45 | }; |
@@ -58,15 +57,6 @@ struct device_node *spu_devnode(struct spu *spu) | |||
58 | 57 | ||
59 | EXPORT_SYMBOL_GPL(spu_devnode); | 58 | EXPORT_SYMBOL_GPL(spu_devnode); |
60 | 59 | ||
61 | static int __init find_spu_node_id(struct device_node *spe) | ||
62 | { | ||
63 | const unsigned int *id; | ||
64 | struct device_node *cpu; | ||
65 | cpu = spe->parent->parent; | ||
66 | id = get_property(cpu, "node-id", NULL); | ||
67 | return id ? *id : 0; | ||
68 | } | ||
69 | |||
70 | static int __init cell_spuprop_present(struct spu *spu, struct device_node *spe, | 60 | static int __init cell_spuprop_present(struct spu *spu, struct device_node *spe, |
71 | const char *prop) | 61 | const char *prop) |
72 | { | 62 | { |
@@ -87,7 +77,7 @@ static int __init cell_spuprop_present(struct spu *spu, struct device_node *spe, | |||
87 | start_pfn = p->address >> PAGE_SHIFT; | 77 | start_pfn = p->address >> PAGE_SHIFT; |
88 | nr_pages = ((unsigned long)p->len + PAGE_SIZE - 1) >> PAGE_SHIFT; | 78 | nr_pages = ((unsigned long)p->len + PAGE_SIZE - 1) >> PAGE_SHIFT; |
89 | 79 | ||
90 | pgdata = NODE_DATA(spu_get_pdata(spu)->nid); | 80 | pgdata = NODE_DATA(spu->node); |
91 | zone = pgdata->node_zones; | 81 | zone = pgdata->node_zones; |
92 | 82 | ||
93 | /* XXX rethink locking here */ | 83 | /* XXX rethink locking here */ |
@@ -140,6 +130,7 @@ static int __init spu_map_interrupts_old(struct spu *spu, | |||
140 | { | 130 | { |
141 | unsigned int isrc; | 131 | unsigned int isrc; |
142 | const u32 *tmp; | 132 | const u32 *tmp; |
133 | int nid; | ||
143 | 134 | ||
144 | /* Get the interrupt source unit from the device-tree */ | 135 | /* Get the interrupt source unit from the device-tree */ |
145 | tmp = get_property(np, "isrc", NULL); | 136 | tmp = get_property(np, "isrc", NULL); |
@@ -147,8 +138,15 @@ static int __init spu_map_interrupts_old(struct spu *spu, | |||
147 | return -ENODEV; | 138 | return -ENODEV; |
148 | isrc = tmp[0]; | 139 | isrc = tmp[0]; |
149 | 140 | ||
141 | tmp = get_property(np->parent->parent, "node-id", NULL); | ||
142 | if (!tmp) { | ||
143 | printk(KERN_WARNING "%s: can't find node-id\n", __FUNCTION__); | ||
144 | nid = spu->node; | ||
145 | } else | ||
146 | nid = tmp[0]; | ||
147 | |||
150 | /* Add the node number */ | 148 | /* Add the node number */ |
151 | isrc |= spu->node << IIC_IRQ_NODE_SHIFT; | 149 | isrc |= nid << IIC_IRQ_NODE_SHIFT; |
152 | 150 | ||
153 | /* Now map interrupts of all 3 classes */ | 151 | /* Now map interrupts of all 3 classes */ |
154 | spu->irqs[0] = irq_create_mapping(NULL, IIC_IRQ_CLASS_0 | isrc); | 152 | spu->irqs[0] = irq_create_mapping(NULL, IIC_IRQ_CLASS_0 | isrc); |
@@ -262,7 +260,7 @@ static int spu_map_resource(struct spu *spu, int nr, | |||
262 | start_pfn = resource.start >> PAGE_SHIFT; | 260 | start_pfn = resource.start >> PAGE_SHIFT; |
263 | nr_pages = (len + PAGE_SIZE - 1) >> PAGE_SHIFT; | 261 | nr_pages = (len + PAGE_SIZE - 1) >> PAGE_SHIFT; |
264 | 262 | ||
265 | pgdata = NODE_DATA(spu_get_pdata(spu)->nid); | 263 | pgdata = NODE_DATA(spu->node); |
266 | zone = pgdata->node_zones; | 264 | zone = pgdata->node_zones; |
267 | 265 | ||
268 | /* XXX rethink locking here */ | 266 | /* XXX rethink locking here */ |
@@ -360,7 +358,7 @@ static int __init of_create_spu(struct spu *spu, void *data) | |||
360 | } | 358 | } |
361 | spu_get_pdata(spu)->devnode = of_node_get(spe); | 359 | spu_get_pdata(spu)->devnode = of_node_get(spe); |
362 | 360 | ||
363 | spu->node = find_spu_node_id(spe); | 361 | spu->node = of_node_to_nid(spe); |
364 | if (spu->node >= MAX_NUMNODES) { | 362 | if (spu->node >= MAX_NUMNODES) { |
365 | printk(KERN_WARNING "SPE %s on node %d ignored," | 363 | printk(KERN_WARNING "SPE %s on node %d ignored," |
366 | " node number too big\n", spe->full_name, spu->node); | 364 | " node number too big\n", spe->full_name, spu->node); |
@@ -369,10 +367,6 @@ static int __init of_create_spu(struct spu *spu, void *data) | |||
369 | goto out_free; | 367 | goto out_free; |
370 | } | 368 | } |
371 | 369 | ||
372 | spu_get_pdata(spu)->nid = of_node_to_nid(spe); | ||
373 | if (spu_get_pdata(spu)->nid == -1) | ||
374 | spu_get_pdata(spu)->nid = 0; | ||
375 | |||
376 | ret = spu_map_device(spu); | 370 | ret = spu_map_device(spu); |
377 | /* try old method */ | 371 | /* try old method */ |
378 | if (ret) | 372 | if (ret) |