Commit 8261aa60 authored by Jeremy Kerr's avatar Jeremy Kerr Committed by Linus Torvalds

[PATCH] powerpc: cell: Add numa id to struct spu

Add an nid member to the spu structure, and store the numa id of the spu there
on creation.
Signed-off-by: default avatarArnd Bergmann <arnd.bergmann@de.ibm.com>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 953039c8
...@@ -529,7 +529,7 @@ static int __init find_spu_node_id(struct device_node *spe) ...@@ -529,7 +529,7 @@ static int __init find_spu_node_id(struct device_node *spe)
return id ? *id : 0; return id ? *id : 0;
} }
static int __init cell_spuprop_present(struct device_node *spe, static int __init cell_spuprop_present(struct spu *spu, struct device_node *spe,
const char *prop) const char *prop)
{ {
static DEFINE_MUTEX(add_spumem_mutex); static DEFINE_MUTEX(add_spumem_mutex);
...@@ -541,7 +541,6 @@ static int __init cell_spuprop_present(struct device_node *spe, ...@@ -541,7 +541,6 @@ static int __init cell_spuprop_present(struct device_node *spe,
int proplen; int proplen;
unsigned long start_pfn, nr_pages; unsigned long start_pfn, nr_pages;
int node_id;
struct pglist_data *pgdata; struct pglist_data *pgdata;
struct zone *zone; struct zone *zone;
int ret; int ret;
...@@ -552,14 +551,7 @@ static int __init cell_spuprop_present(struct device_node *spe, ...@@ -552,14 +551,7 @@ static int __init cell_spuprop_present(struct device_node *spe,
start_pfn = p->address >> PAGE_SHIFT; start_pfn = p->address >> PAGE_SHIFT;
nr_pages = ((unsigned long)p->len + PAGE_SIZE - 1) >> PAGE_SHIFT; nr_pages = ((unsigned long)p->len + PAGE_SIZE - 1) >> PAGE_SHIFT;
/* pgdata = NODE_DATA(spu->nid);
* XXX need to get the correct NUMA node in here. This may
* be different from the spe::node_id property, e.g. when
* the host firmware is not NUMA aware.
*/
node_id = 0;
pgdata = NODE_DATA(node_id);
zone = pgdata->node_zones; zone = pgdata->node_zones;
/* XXX rethink locking here */ /* XXX rethink locking here */
...@@ -570,8 +562,8 @@ static int __init cell_spuprop_present(struct device_node *spe, ...@@ -570,8 +562,8 @@ static int __init cell_spuprop_present(struct device_node *spe,
return ret; return ret;
} }
static void __iomem * __init map_spe_prop(struct device_node *n, static void __iomem * __init map_spe_prop(struct spu *spu,
const char *name) struct device_node *n, const char *name)
{ {
struct address_prop { struct address_prop {
unsigned long address; unsigned long address;
...@@ -589,7 +581,7 @@ static void __iomem * __init map_spe_prop(struct device_node *n, ...@@ -589,7 +581,7 @@ static void __iomem * __init map_spe_prop(struct device_node *n,
prop = p; prop = p;
err = cell_spuprop_present(n, name); err = cell_spuprop_present(spu, n, name);
if (err && (err != -EEXIST)) if (err && (err != -EEXIST))
goto out; goto out;
...@@ -607,44 +599,45 @@ static void spu_unmap(struct spu *spu) ...@@ -607,44 +599,45 @@ static void spu_unmap(struct spu *spu)
iounmap((u8 __iomem *)spu->local_store); iounmap((u8 __iomem *)spu->local_store);
} }
static int __init spu_map_device(struct spu *spu, struct device_node *spe) static int __init spu_map_device(struct spu *spu, struct device_node *node)
{ {
char *prop; char *prop;
int ret; int ret;
ret = -ENODEV; ret = -ENODEV;
prop = get_property(spe, "isrc", NULL); prop = get_property(node, "isrc", NULL);
if (!prop) if (!prop)
goto out; goto out;
spu->isrc = *(unsigned int *)prop; spu->isrc = *(unsigned int *)prop;
spu->name = get_property(spe, "name", NULL); spu->name = get_property(node, "name", NULL);
if (!spu->name) if (!spu->name)
goto out; goto out;
prop = get_property(spe, "local-store", NULL); prop = get_property(node, "local-store", NULL);
if (!prop) if (!prop)
goto out; goto out;
spu->local_store_phys = *(unsigned long *)prop; spu->local_store_phys = *(unsigned long *)prop;
/* we use local store as ram, not io memory */ /* we use local store as ram, not io memory */
spu->local_store = (void __force *)map_spe_prop(spe, "local-store"); spu->local_store = (void __force *)
map_spe_prop(spu, node, "local-store");
if (!spu->local_store) if (!spu->local_store)
goto out; goto out;
prop = get_property(spe, "problem", NULL); prop = get_property(node, "problem", NULL);
if (!prop) if (!prop)
goto out_unmap; goto out_unmap;
spu->problem_phys = *(unsigned long *)prop; spu->problem_phys = *(unsigned long *)prop;
spu->problem= map_spe_prop(spe, "problem"); spu->problem= map_spe_prop(spu, node, "problem");
if (!spu->problem) if (!spu->problem)
goto out_unmap; goto out_unmap;
spu->priv1= map_spe_prop(spe, "priv1"); spu->priv1= map_spe_prop(spu, node, "priv1");
/* priv1 is not available on a hypervisor */ /* priv1 is not available on a hypervisor */
spu->priv2= map_spe_prop(spe, "priv2"); spu->priv2= map_spe_prop(spu, node, "priv2");
if (!spu->priv2) if (!spu->priv2)
goto out_unmap; goto out_unmap;
ret = 0; ret = 0;
...@@ -672,6 +665,10 @@ static int __init create_spu(struct device_node *spe) ...@@ -672,6 +665,10 @@ static int __init create_spu(struct device_node *spe)
goto out_free; goto out_free;
spu->node = find_spu_node_id(spe); spu->node = find_spu_node_id(spe);
spu->nid = of_node_to_nid(spe);
if (spu->nid == -1)
spu->nid = 0;
spu->stop_code = 0; spu->stop_code = 0;
spu->slb_replace = 0; spu->slb_replace = 0;
spu->mm = NULL; spu->mm = NULL;
......
...@@ -117,6 +117,7 @@ struct spu { ...@@ -117,6 +117,7 @@ struct spu {
struct list_head list; struct list_head list;
struct list_head sched_list; struct list_head sched_list;
int number; int number;
int nid;
u32 isrc; u32 isrc;
u32 node; u32 node;
u64 flags; u64 flags;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment