From jk@ozlabs.org Thu Apr 13 14:06:07 2006 Return-Path: Received: from imap.linux.ibm.com ([unix socket]) by imap.linux.ibm.com (Cyrus v2.3.1-Invoca-RPM-2.3.1-2.1) with LMTPA; Thu, 13 Apr 2006 08:06:58 -0400 X-Sieve: CMU Sieve 2.3 Received: by imap.linux.ibm.com (Postfix, from userid 101) id 9533845C033; Thu, 13 Apr 2006 08:06:58 -0400 (EDT) X-Spam-TestScore: TW_PG=0.077 X-Spam-TokenSummary: Bayes not run. X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on imap.linux.ibm.com X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=TW_PG autolearn=ham version=3.1.1 X-Spam-Relay-Country: Received: from smtp.linux.ibm.com (smtp.linux.ibm.com [9.26.4.197]) by imap.linux.ibm.com (Postfix) with ESMTP id E831B45C032 for ; Thu, 13 Apr 2006 08:06:55 -0400 (EDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.linux.ibm.com (Postfix) with ESMTP id 8081398049 for ; Thu, 13 Apr 2006 08:06:55 -0400 (EDT) Received: from d12nrmr1507.megacenter.de.ibm.com (d12nrmr1507.megacenter.de.ibm.com [9.149.167.1]) by smtp.linux.ibm.com (Postfix) with ESMTP id E8E1598046 for ; Thu, 13 Apr 2006 08:06:54 -0400 (EDT) Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1507.megacenter.de.ibm.com (8.12.10/NCO/VER6.8) with ESMTP id k3DC7iun131780; Thu, 13 Apr 2006 14:07:44 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11/8.13.3) with ESMTP id k3DC6nCi003798; Thu, 13 Apr 2006 14:06:49 +0200 Received: from d01relay05.pok.ibm.com (d01relay05.pok.ibm.com [9.56.227.237]) by d12av02.megacenter.de.ibm.com (8.12.11/8.12.11) with ESMTP id k3DC6nqn003703; Thu, 13 Apr 2006 14:06:49 +0200 Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay05.pok.ibm.com (8.12.10/NCO/VER6.8) with ESMTP id k3DC6mUX136270; Thu, 13 Apr 2006 08:06:48 -0400 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.12.11/8.13.3) with ESMTP id k3DC6mxH031005; Thu, 13 Apr 2006 08:06:48 -0400 Received: from smtp.linux.ibm.com (ltc-eth1000.torolab.ibm.com [9.26.4.197]) by d01av01.pok.ibm.com (8.12.11/8.12.11) with ESMTP id k3DC6mtq030997; Thu, 13 Apr 2006 08:06:48 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.linux.ibm.com (Postfix) with ESMTP id F31D69804B; Thu, 13 Apr 2006 08:06:40 -0400 (EDT) Received: from linux.ibm.com (localhost.localdomain [127.0.0.1]) by smtp.linux.ibm.com (Postfix) with ESMTP id DC8D498049; Thu, 13 Apr 2006 08:06:34 -0400 (EDT) X-Original-To: ibm-linux-cell@linux.ibm.com Delivered-To: ibm-linux-cell@linux.ibm.com Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.linux.ibm.com (Postfix) with ESMTP id 1514998047 for ; Thu, 13 Apr 2006 08:06:31 -0400 (EDT) Received: from sd0112e0.au.ibm.com (d23rh903.au.ibm.com [9.190.250.240]) by smtp.linux.ibm.com (Postfix) with ESMTP id 7164498045 for ; Thu, 13 Apr 2006 08:06:29 -0400 (EDT) Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.250.243]) by sd0112e0.au.ibm.com (8.12.10/NCO/VER6.8) with ESMTP id k3DC9jG7278774 for ; Thu, 13 Apr 2006 22:09:45 +1000 Received: from d23av02.au.ibm.com (loopback [127.0.0.1]) by d23av02.au.ibm.com (8.12.11/8.13.3) with ESMTP id k3DC6QEf022805 for ; Thu, 13 Apr 2006 22:06:26 +1000 Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.190.163.12]) by d23av02.au.ibm.com (8.12.11/8.12.11) with ESMTP id k3DC6QnT022802 for ; Thu, 13 Apr 2006 22:06:26 +1000 Received: by ozlabs.au.ibm.com (Postfix, from userid 1008) id 8112B73723; Thu, 13 Apr 2006 22:07:28 +1000 (EST) To: From: Jeremy Kerr Date: Thu, 13 Apr 2006 14:06:07 +0200 In-Reply-To: <1144929954.687268.447274275348.qpush@pokey> Message-Id: <1144929967.354406.975527933728.qpush@pokey> Subject: [ibm-linux-cell] [PATCH 2/3] powerpc: cell: Add numa id to struct spu X-BeenThere: ibm-linux-cell@linux.ibm.com X-Mailman-Version: 2.1.7 Precedence: list List-Id: Discussion of Linux on Cell kernel development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: ibm-linux-cell-bounces@linux.ibm.com Errors-To: ibm-linux-cell-bounces@linux.ibm.com X-Virus-Scanned: amavisd-new at linux.ibm.com X-Length: 10251 X-UID: 1982 Add an nid member to the spu structure, and store the numa id of the spu there on creation. Signed-off-by: Jeremy Kerr --- arch/powerpc/platforms/cell/spu_base.c | 44 +++++++++++++++------------------ include/asm-powerpc/spu.h | 1 2 files changed, 21 insertions(+), 24 deletions(-) Index: linux-2.6/arch/powerpc/platforms/cell/spu_base.c =================================================================== --- linux-2.6.orig/arch/powerpc/platforms/cell/spu_base.c +++ linux-2.6/arch/powerpc/platforms/cell/spu_base.c @@ -525,7 +525,6 @@ void spu_irq_setaffinity(struct spu *spu } EXPORT_SYMBOL_GPL(spu_irq_setaffinity); -/* XXX better look for ibm,associativity properties as well */ static int __init find_spu_node_id(struct device_node *spe) { unsigned int *id; @@ -535,8 +534,8 @@ static int __init find_spu_node_id(struc return id ? *id : 0; } -static int __init cell_spuprop_present(struct device_node *spe, - const char *prop) +static int __init cell_spuprop_present(struct spu *spu, struct device_node *spe, + const char *prop) { static DEFINE_MUTEX(add_spumem_mutex); @@ -547,7 +546,6 @@ static int __init cell_spuprop_present(s int proplen; unsigned long start_pfn, nr_pages; - int node_id; struct pglist_data *pgdata; struct zone *zone; int ret; @@ -558,14 +556,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; - /* - * 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); + pgdata = NODE_DATA(spu->nid); zone = pgdata->node_zones; /* XXX rethink locking here */ @@ -576,8 +567,8 @@ static int __init cell_spuprop_present(s return ret; } -static void __iomem * __init map_spe_prop(struct device_node *n, - const char *name) +static void __iomem * __init map_spe_prop(struct spu *spu, + struct device_node *n, const char *name) { struct address_prop { unsigned long address; @@ -599,7 +590,7 @@ static void __iomem * __init map_spe_pro if (strcmp (name, "priv2") == 0 && prop->len < 0x20000) return ioremap(prop->address, 0x20000); - err = cell_spuprop_present(n, name); + err = cell_spuprop_present(spu, n, name); if (err && (err != -EEXIST)) goto out; @@ -617,44 +608,45 @@ static void spu_unmap(struct spu *spu) 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; int ret; ret = -ENODEV; - prop = get_property(spe, "isrc", NULL); + prop = get_property(node, "isrc", NULL); if (!prop) goto out; spu->isrc = *(unsigned int *)prop; - spu->name = get_property(spe, "name", NULL); + spu->name = get_property(node, "name", NULL); if (!spu->name) goto out; - prop = get_property(spe, "local-store", NULL); + prop = get_property(node, "local-store", NULL); if (!prop) goto out; spu->local_store_phys = *(unsigned long *)prop; /* 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) goto out; - prop = get_property(spe, "problem", NULL); + prop = get_property(node, "problem", NULL); if (!prop) goto out_unmap; spu->problem_phys = *(unsigned long *)prop; - spu->problem= map_spe_prop(spe, "problem"); + spu->problem= map_spe_prop(spu, node, "problem"); if (!spu->problem) 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 */ - spu->priv2= map_spe_prop(spe, "priv2"); + spu->priv2= map_spe_prop(spu, node, "priv2"); if (!spu->priv2) goto out_unmap; ret = 0; @@ -682,6 +674,10 @@ static int __init create_spu(struct devi goto out_free; spu->node = find_spu_node_id(spe); + spu->nid = of_node_to_nid(spe); + if (spu->nid == -1) + spu->nid = 0; + spin_lock_init(&spu->register_lock); spu_mfc_sdr_set(spu, mfspr(SPRN_SDR1)); Index: linux-2.6/include/asm-powerpc/spu.h =================================================================== --- linux-2.6.orig/include/asm-powerpc/spu.h +++ linux-2.6/include/asm-powerpc/spu.h @@ -117,6 +117,7 @@ struct spu { struct list_head list; struct list_head sched_list; int number; + int nid; u32 isrc; u32 node; u64 flags; ______________________________________________________ ibm-linux-cell mailing list <ibm-linux-cell@linux.ibm.com> To unsubscribe from the list, change your list options or if you have forgotten your list password visit: http://linux.ibm.com/mailman/listinfo/ibm-linux-cell