Commit 12c79244 authored by Erich Focht's avatar Erich Focht Committed by David Mosberger

[PATCH] ia64: topology for ia64

please find attached a first attempt to implement the topology.h
macros/routines for IA64. We need this for the NUMA scheduler setup.
parent eaea39e2
......@@ -781,6 +781,9 @@ acpi_boot_init (char *cmdline)
smp_boot_data.cpu_count = total_cpus;
smp_build_cpu_map();
#ifdef CONFIG_NUMA
build_cpu_to_node_map();
#endif
#endif
/* Make boot-up look pretty */
printk("%d CPUs available, %d CPUs total\n", available_cpus, total_cpus);
......
......@@ -16,6 +16,7 @@
#include <linux/config.h>
#include <linux/acpi.h>
#include <linux/bootmem.h>
#include <linux/delay.h>
#include <linux/init.h>
......@@ -427,6 +428,32 @@ smp_build_cpu_map (void)
}
}
#ifdef CONFIG_NUMA
char cpu_to_node_map[NR_CPUS] __cacheline_aligned;
/*
* Build cpu to node mapping.
*/
void __init
build_cpu_to_node_map(void)
{
int cpu, i;
for(cpu=0; cpu<NR_CPUS; cpu++) {
/*
* All Itanium NUMA platforms I know use ACPI, so maybe we
* can drop this ifdef completely. [EF]
*/
#ifdef CONFIG_ACPI_NUMA
for(i=0; i<NR_CPUS; i++)
if (cpu_physical_id(cpu) == node_cpuid[i].phys_id) {
cpu_to_node_map[cpu]=node_cpuid[i].nid;
break;
}
#endif
}
}
#endif
/*
* Cycle through the APs sending Wakeup IPIs to boot each.
*/
......
......@@ -22,6 +22,8 @@
# define NR_MEMBLKS (NR_NODES * 8)
#endif
extern char cpu_to_node_map[NR_CPUS] __cacheline_aligned;
/* Stuff below this line could be architecture independent */
extern int num_memblks; /* total number of memory chunks */
......
/*
* linux/include/asm-ia64/topology.h
*
* Copyright (C) 2002, Erich Focht, NEC
*
* 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.
*/
#ifndef _ASM_IA64_TOPOLOGY_H
#define _ASM_IA64_TOPOLOGY_H
#include <asm/acpi.h>
#include <asm/numa.h>
/* Returns the number of the node containing CPU 'cpu' */
#ifdef CONFIG_NUMA
#define __cpu_to_node(cpu) cpu_to_node_map[cpu]
#else
#define __cpu_to_node(cpu) (0)
#endif
/*
* Returns the number of the node containing MemBlk 'memblk'
*/
#ifdef CONFIG_ACPI_NUMA
#define __memblk_to_node(memblk) (node_memblk[memblk].nid)
#else
#define __memblk_to_node(memblk) (memblk)
#endif
/*
* Returns the number of the node containing Node 'nid'.
* Not implemented here. Multi-level hierarchies detected with
* the help of node_distance().
*/
#define __parent_node(nid) (nid)
/*
* Returns the number of the first CPU on Node 'node'.
* Slow in the current implementation.
* Who needs this?
*/
/* #define __node_to_first_cpu(node) pool_cpus[pool_ptr[node]] */
static inline int __node_to_first_cpu(int node)
{
int i, cpu;
for (i=0; i<NR_CPUS; i++)
if (__cpu_to_node(i)==node)
return i;
BUG(); /* couldn't find a cpu on given node */
return -1;
}
/*
* Returns a bitmask of CPUs on Node 'node'.
*/
static inline unsigned long __node_to_cpu_mask(int node)
{
int cpu;
unsigned long mask = 0UL;
for(cpu=0; cpu<NR_CPUS; cpu++)
if (__cpu_to_node(cpu) == node)
mask |= 1UL << cpu;
return mask;
}
/*
* Returns the number of the first MemBlk on Node 'node'
* Should be fixed when IA64 discontigmem goes in.
*/
#define __node_to_memblk(node) (node)
#endif /* _ASM_IA64_TOPOLOGY_H */
#ifndef _ASM_IA64_TOPOLOGY_H
#define _ASM_IA64_TOPOLOGY_H
......
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