From: Matthew Dobson <colpatch@us.ibm.com>
To: Andrew Morton <akpm@digeo.com>
Cc: Patrick Mochel <mochel@osdl.org>,
"Martin J. Bligh" <mbligh@aracnet.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
Michael Hohnbaum <hohnbaum@us.ibm.com>
Subject: Re: [patch] (2/5) i386 driverfs Topology 2.5.44
Date: Wed, 23 Oct 2002 13:59:45 -0700 [thread overview]
Message-ID: <3DB70DC1.204@us.ibm.com> (raw)
In-Reply-To: 3DB70CDD.8080506@us.ibm.com
[-- Attachment #1: Type: text/plain, Size: 348 bytes --]
Update/Create i386 specific files for DriverFS Topology.
This patch creates the i386 specific files/functions/structures to
implement
driverfs Topology. These structures have the generic CPU/MemBlk/Node
structures
embedded in them.
This patch also creates the arch-specific initialization routine to
instantiate the topology.
Cheers!
-Matt
[-- Attachment #2: 01-arch_additions.patch --]
[-- Type: text/plain, Size: 5430 bytes --]
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.44-base/arch/i386/mach-generic/Makefile linux-2.5.44-arch_additions/arch/i386/mach-generic/Makefile
--- linux-2.5.44-base/arch/i386/mach-generic/Makefile Fri Oct 18 21:01:19 2002
+++ linux-2.5.44-arch_additions/arch/i386/mach-generic/Makefile Wed Oct 23 12:06:18 2002
@@ -4,6 +4,6 @@
EXTRA_CFLAGS += -I../kernel
-obj-y := setup.o
+obj-y := setup.o topology.o
include $(TOPDIR)/Rules.make
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.44-base/arch/i386/mach-generic/topology.c linux-2.5.44-arch_additions/arch/i386/mach-generic/topology.c
--- linux-2.5.44-base/arch/i386/mach-generic/topology.c Wed Dec 31 16:00:00 1969
+++ linux-2.5.44-arch_additions/arch/i386/mach-generic/topology.c Wed Oct 23 12:07:47 2002
@@ -0,0 +1,69 @@
+/*
+ * arch/i386/mach-generic/topology.c - Populate driverfs with topology information
+ *
+ * Written by: Matthew Dobson, IBM Corporation
+ * Original Code: Paul Dorwin, IBM Corporation, Patrick Mochel, OSDL
+ *
+ * Copyright (C) 2002, IBM Corp.
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
+ * NON INFRINGEMENT. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Send feedback to <colpatch@us.ibm.com>
+ */
+#include <linux/init.h>
+#include <asm/cpu.h>
+
+struct i386_cpu cpu_devices[NR_CPUS];
+
+#ifdef CONFIG_NUMA
+#include <linux/mmzone.h>
+#include <asm/node.h>
+#include <asm/memblk.h>
+
+struct i386_node node_devices[MAX_NUMNODES];
+struct i386_memblk memblk_devices[MAX_NR_MEMBLKS];
+
+extern int numnodes;
+
+static int __init topology_init(void)
+{
+ int i;
+
+ for (i = 0; i < numnodes; i++)
+ arch_register_node(i);
+ for (i = 0; i < num_online_cpus(); i++)
+ arch_register_cpu(i);
+ for (i = 0; i < numnodes; i++)
+ arch_register_memblk(i);
+ return 0;
+}
+
+#else /* !CONFIG_NUMA */
+
+static int __init topology_init(void)
+{
+ int i;
+
+ for (i = 0; i < num_online_cpus(); i++)
+ arch_register_cpu(i);
+ return 0;
+}
+
+#endif /* CONFIG_NUMA */
+
+subsys_initcall(topology_init);
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.44-base/include/asm-i386/cpu.h linux-2.5.44-arch_additions/include/asm-i386/cpu.h
--- linux-2.5.44-base/include/asm-i386/cpu.h Wed Dec 31 16:00:00 1969
+++ linux-2.5.44-arch_additions/include/asm-i386/cpu.h Wed Oct 23 12:06:18 2002
@@ -0,0 +1,30 @@
+#ifndef _ASM_I386_CPU_H_
+#define _ASM_I386_CPU_H_
+
+#include <linux/device.h>
+#include <linux/cpu.h>
+
+#include <asm/topology.h>
+#include <asm/node.h>
+
+struct i386_cpu {
+ struct cpu cpu;
+};
+extern struct i386_cpu cpu_devices[NR_CPUS];
+
+
+#ifdef CONFIG_NUMA
+static inline void arch_register_cpu(int num){
+ int p_node = __cpu_to_node(num);
+
+ if (p_node >= 0 && p_node < NR_CPUS)
+ register_cpu(&cpu_devices[num].cpu, num,
+ &node_devices[p_node].node);
+}
+#else /* !CONFIG_NUMA */
+static inline void arch_register_cpu(int num){
+ register_cpu(&cpu_devices[num].cpu, num, (struct node *) NULL);
+}
+#endif /* CONFIG_NUMA */
+
+#endif /* _ASM_I386_CPU_H_ */
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.44-base/include/asm-i386/memblk.h linux-2.5.44-arch_additions/include/asm-i386/memblk.h
--- linux-2.5.44-base/include/asm-i386/memblk.h Wed Dec 31 16:00:00 1969
+++ linux-2.5.44-arch_additions/include/asm-i386/memblk.h Wed Oct 23 12:06:18 2002
@@ -0,0 +1,24 @@
+#ifndef _ASM_I386_MEMBLK_H_
+#define _ASM_I386_MEMBLK_H_
+
+#include <linux/device.h>
+#include <linux/mmzone.h>
+#include <linux/memblk.h>
+
+#include <asm/topology.h>
+#include <asm/node.h>
+
+struct i386_memblk {
+ struct memblk memblk;
+};
+extern struct i386_memblk memblk_devices[MAX_NR_MEMBLKS];
+
+static inline void arch_register_memblk(int num){
+ int p_node = __memblk_to_node(num);
+
+ if (p_node >= 0 && p_node < MAX_NR_MEMBLKS)
+ register_memblk(&memblk_devices[num].memblk, num,
+ &node_devices[p_node].node);
+}
+
+#endif /* _ASM_I386_MEMBLK_H_ */
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.44-base/include/asm-i386/node.h linux-2.5.44-arch_additions/include/asm-i386/node.h
--- linux-2.5.44-base/include/asm-i386/node.h Wed Dec 31 16:00:00 1969
+++ linux-2.5.44-arch_additions/include/asm-i386/node.h Wed Oct 23 12:06:18 2002
@@ -0,0 +1,26 @@
+#ifndef _ASM_I386_NODE_H_
+#define _ASM_I386_NODE_H_
+
+#include <linux/device.h>
+#include <linux/mmzone.h>
+#include <linux/node.h>
+
+#include <asm/topology.h>
+
+struct i386_node {
+ struct node node;
+};
+extern struct i386_node node_devices[MAX_NUMNODES];
+
+static inline void arch_register_node(int num){
+ int p_node = __parent_node(num);
+
+ if (p_node != num)
+ register_node(&node_devices[num].node, num,
+ &node_devices[p_node].node);
+ else
+ register_node(&node_devices[num].node, num,
+ (struct node *) NULL);
+}
+
+#endif /* _ASM_I386_NODE_H_ */
next prev parent reply other threads:[~2002-10-23 20:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <2699066091.1035310557@[10.10.2.3]>
[not found] ` <Pine.LNX.4.44.0210221824430.983-100000@cherise.pdx.osdl.net>
[not found] ` <3DB5FCC5.E54808E@digeo.com>
2002-10-23 20:55 ` [patch] (1/5) Core driverfs Topology 2.5.44 Matthew Dobson
2002-10-23 20:59 ` Matthew Dobson [this message]
2002-10-23 21:02 ` [patch] (3/5) NUMA meminfo for " Matthew Dobson
2002-10-23 21:05 ` [patch] (4/5) create memblk_online_map 2.5.44 Matthew Dobson
2002-10-23 21:06 ` [patch] (5/5) create node_online_map 2.5.44 Matthew Dobson
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=3DB70DC1.204@us.ibm.com \
--to=colpatch@us.ibm.com \
--cc=akpm@digeo.com \
--cc=hohnbaum@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mbligh@aracnet.com \
--cc=mochel@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).