From: Arnd Bergmann <arnd@arndb•de>
To: Paul Mackerras <paulus@samba•org>
Cc: linuxppc-dev@ozlabs•org, cbe-oss-dev@ozlabs•org,
Arnd Bergmann <arnd.bergmann@de•ibm.com>
Subject: [patch 5/6] spufs: fix assignment of node numbers
Date: Tue, 19 Dec 2006 15:32:45 +0100 [thread overview]
Message-ID: <20061219143452.914688000@arndb.de> (raw)
In-Reply-To: 20061219143240.705255000@arndb.de
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>
Index: linux-2.6/arch/powerpc/platforms/cell/spu_priv1_mmio.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/cell/spu_priv1_mmio.c
+++ linux-2.6/arch/powerpc/platforms/cell/spu_priv1_mmio.c
@@ -40,7 +40,6 @@
static DEFINE_MUTEX(add_spumem_mutex);
struct spu_pdata {
- int nid;
struct device_node *devnode;
struct spu_priv1 __iomem *priv1;
};
@@ -58,15 +57,6 @@ struct device_node *spu_devnode(struct s
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)
{
@@ -87,7 +77,7 @@ static int __init cell_spuprop_present(s
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 */
@@ -140,6 +130,7 @@ static int __init spu_map_interrupts_old
{
unsigned int isrc;
const u32 *tmp;
+ int nid;
/* Get the interrupt source unit from the device-tree */
tmp = get_property(np, "isrc", NULL);
@@ -147,8 +138,15 @@ static int __init spu_map_interrupts_old
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);
@@ -262,7 +260,7 @@ static int spu_map_resource(struct spu *
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 */
@@ -360,7 +358,7 @@ static int __init of_create_spu(struct s
}
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);
@@ -369,10 +367,6 @@ static int __init of_create_spu(struct s
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)
--
next prev parent reply other threads:[~2006-12-19 14:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20061219143240.705255000@arndb.de>
2006-12-19 14:32 ` [patch 1/6] cell: update cell_defconfig Arnd Bergmann
2006-12-19 14:32 ` [patch 2/6] cell: add forward struct declarations to spu.h Arnd Bergmann
2006-12-19 14:32 ` [patch 3/6] cell: Enable spider workarounds on all PCI buses Arnd Bergmann
2006-12-19 20:37 ` Benjamin Herrenschmidt
2006-12-19 14:32 ` [patch 4/6] cell: Fix spufs with "new style" device-tree Arnd Bergmann
2006-12-19 14:32 ` Arnd Bergmann [this message]
2006-12-19 14:32 ` [patch 6/6] powerpc: add scanning of ebc bus to of_platform Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061219143452.914688000@arndb.de \
--to=arnd@arndb$(echo .)de \
--cc=arnd.bergmann@de$(echo .)ibm.com \
--cc=cbe-oss-dev@ozlabs$(echo .)org \
--cc=linuxppc-dev@ozlabs$(echo .)org \
--cc=paulus@samba$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox