Skip to content

Commit

Permalink
[POWERPC] spufs: fix assignment of node numbers
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Arnd Bergmann authored and Arnd Bergmann committed Dec 19, 2006
1 parent 6e22ba6 commit ccb4911
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions arch/powerpc/platforms/cell/spu_priv1_mmio.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
static DEFINE_MUTEX(add_spumem_mutex);

struct spu_pdata {
int nid;
struct device_node *devnode;
struct spu_priv1 __iomem *priv1;
};
Expand All @@ -58,15 +57,6 @@ struct device_node *spu_devnode(struct spu *spu)

EXPORT_SYMBOL_GPL(spu_devnode);

static int __init find_spu_node_id(struct device_node *spe)
{
const unsigned int *id;
struct device_node *cpu;
cpu = spe->parent->parent;
id = get_property(cpu, "node-id", NULL);
return id ? *id : 0;
}

static int __init cell_spuprop_present(struct spu *spu, struct device_node *spe,
const char *prop)
{
Expand All @@ -87,7 +77,7 @@ static int __init cell_spuprop_present(struct spu *spu, struct device_node *spe,
start_pfn = p->address >> PAGE_SHIFT;
nr_pages = ((unsigned long)p->len + PAGE_SIZE - 1) >> PAGE_SHIFT;

pgdata = NODE_DATA(spu_get_pdata(spu)->nid);
pgdata = NODE_DATA(spu->node);
zone = pgdata->node_zones;

/* XXX rethink locking here */
Expand Down Expand Up @@ -140,15 +130,23 @@ static int __init spu_map_interrupts_old(struct spu *spu,
{
unsigned int isrc;
const u32 *tmp;
int nid;

/* Get the interrupt source unit from the device-tree */
tmp = get_property(np, "isrc", NULL);
if (!tmp)
return -ENODEV;
isrc = tmp[0];

tmp = get_property(np->parent->parent, "node-id", NULL);
if (!tmp) {
printk(KERN_WARNING "%s: can't find node-id\n", __FUNCTION__);
nid = spu->node;
} else
nid = tmp[0];

/* Add the node number */
isrc |= spu->node << IIC_IRQ_NODE_SHIFT;
isrc |= nid << IIC_IRQ_NODE_SHIFT;

/* Now map interrupts of all 3 classes */
spu->irqs[0] = irq_create_mapping(NULL, IIC_IRQ_CLASS_0 | isrc);
Expand Down Expand Up @@ -262,7 +260,7 @@ static int spu_map_resource(struct spu *spu, int nr,
start_pfn = resource.start >> PAGE_SHIFT;
nr_pages = (len + PAGE_SIZE - 1) >> PAGE_SHIFT;

pgdata = NODE_DATA(spu_get_pdata(spu)->nid);
pgdata = NODE_DATA(spu->node);
zone = pgdata->node_zones;

/* XXX rethink locking here */
Expand Down Expand Up @@ -360,7 +358,7 @@ static int __init of_create_spu(struct spu *spu, void *data)
}
spu_get_pdata(spu)->devnode = of_node_get(spe);

spu->node = find_spu_node_id(spe);
spu->node = of_node_to_nid(spe);
if (spu->node >= MAX_NUMNODES) {
printk(KERN_WARNING "SPE %s on node %d ignored,"
" node number too big\n", spe->full_name, spu->node);
Expand All @@ -369,10 +367,6 @@ static int __init of_create_spu(struct spu *spu, void *data)
goto out_free;
}

spu_get_pdata(spu)->nid = of_node_to_nid(spe);
if (spu_get_pdata(spu)->nid == -1)
spu_get_pdata(spu)->nid = 0;

ret = spu_map_device(spu);
/* try old method */
if (ret)
Expand Down

0 comments on commit ccb4911

Please sign in to comment.