Commit 233da397 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] topology API updates

From Matthew Dobson.

Leaves any functions which architectures haven't defined as undefined,
rather than using non-NUMA functions where users would expect
NUMA-functions.

This will cause compilation errors if someone tries to use an undefined
function, hopefully causing them to actually define those functions.

Also removes lingering topology-like macros that aren't being used, and
a couple typo fixes.
parent a1c9db9f
......@@ -4,11 +4,17 @@
#ifdef CONFIG_NUMA
#ifdef CONFIG_ALPHA_WILDFIRE
/* With wildfire assume 4 CPUs per node */
#define __cpu_to_node(cpu) ((cpu) >> 2)
#define __cpu_to_node(cpu) ((cpu) >> 2)
#endif /* CONFIG_ALPHA_WILDFIRE */
#endif /* CONFIG_NUMA */
/* Get the rest of the topology definitions */
#include <asm-generic/topology.h>
#if !defined(CONFIG_NUMA) || !defined(CONFIG_ALPHA_WILDFIRE)
#define __cpu_to_node(cpu) (0)
#define __memblk_to_node(memblk) (0)
#define __parent_node(nid) (0)
#define __node_to_first_cpu(node) (0)
#define __node_to_cpu_mask(node) (cpu_online_map)
#define __node_to_memblk(node) (0)
#endif /* !CONFIG_NUMA || !CONFIG_ALPHA_WILDFIRE */
#endif /* _ASM_ALPHA_TOPOLOGY_H */
......@@ -33,16 +33,16 @@
#define __cpu_to_node(cpu) (0)
#endif
#ifndef __memblk_to_node
#define __memblk_to_node(memblk) (0)
#define __memblk_to_node(memblk) (0)
#endif
#ifndef __parent_node
#define __parent_node(nid) (0)
#define __parent_node(node) (0)
#endif
#ifndef __node_to_first_cpu
#define __node_to_first_cpu(node) (0)
#endif
#ifndef __node_to_cpu_mask
#define __node_to_cpu_mask(node) (cpu_online_map)
#define __node_to_cpu_mask(node) (cpu_online_map)
#endif
#ifndef __node_to_memblk
#define __node_to_memblk(node) (0)
......
......@@ -14,9 +14,6 @@
#include <asm/numaq.h>
#else
#define pfn_to_nid(pfn) (0)
#ifdef CONFIG_NUMA
#define _cpu_to_node(cpu) 0
#endif /* CONFIG_NUMA */
#endif /* CONFIG_X86_NUMAQ */
extern struct pglist_data *node_data[];
......
......@@ -41,9 +41,6 @@
#define pfn_to_pgdat(pfn) NODE_DATA(pfn_to_nid(pfn))
#define PHYSADDR_TO_NID(pa) pfn_to_nid(pa >> PAGE_SHIFT)
#define MAX_NUMNODES 8
#ifdef CONFIG_NUMA
#define _cpu_to_node(cpu) (cpu_to_logical_apicid(cpu) >> 4)
#endif /* CONFIG_NUMA */
extern int pfn_to_nid(unsigned long);
extern void get_memcfg_numaq(void);
#define get_memcfg_numa() get_memcfg_numaq()
......
......@@ -37,9 +37,9 @@
/* Returns the number of the node containing MemBlk 'memblk' */
#define __memblk_to_node(memblk) (memblk)
/* Returns the number of the node containing Node 'nid'. This architecture is flat,
/* Returns the number of the node containing Node 'node'. This architecture is flat,
so it is a pretty simple function! */
#define __parent_node(nid) (nid)
#define __parent_node(node) (node)
/* Returns the number of the first CPU on Node 'node'.
* This should be changed to a set of cached values
......@@ -55,7 +55,8 @@ static inline int __node_to_first_cpu(int node)
/* if yes, return it to caller */
return cpu;
return 0;
BUG(); /* couldn't find a cpu on given node */
return -1;
}
/* Returns a bitmask of CPUs on Node 'node'.
......@@ -67,6 +68,9 @@ static inline unsigned long __node_to_cpu_mask(int node)
int i, cpu, logical_apicid = node << 4;
unsigned long mask = 0UL;
if (sizeof(unsigned long) * 8 < NR_CPUS)
BUG();
for(i = 1; i < 16; i <<= 1)
/* check to see if the cpu is in the system */
if ((cpu = logical_apicid_to_cpu(logical_apicid | i)) >= 0)
......
......@@ -5,7 +5,4 @@
#define __cpu_to_node(cpu) (cputocnode(cpu))
/* Get the rest of the topology definitions */
#include <asm-generic/topology.h>
#endif /* _ASM_MIPS64_TOPOLOGY_H */
......@@ -56,24 +56,6 @@ static inline int pa_to_nid(unsigned long pa)
#define node_size(nid) (NODE_DATA(nid)->node_size)
#define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn)
#ifdef CONFIG_NUMA
static inline int __cpu_to_node(int cpu)
{
int node;
node = numa_cpu_lookup_table[cpu];
#ifdef DEBUG_NUMA
if (node == -1)
BUG();
#endif
return node;
}
#endif /* CONFIG_NUMA */
/*
* Following are macros that each numa implmentation must define.
*/
......
......@@ -4,11 +4,57 @@
#include <asm/mmzone.h>
#ifdef CONFIG_NUMA
/* XXX grab this from the device tree - Anton */
#define __cpu_to_node(cpu) ((cpu) >> CPU_SHIFT_BITS)
#endif /* CONFIG_NUMA */
/* Get the rest of the topology definitions */
#include <asm-generic/topology.h>
static inline int __cpu_to_node(int cpu)
{
int node;
node = numa_cpu_lookup_table[cpu];
#ifdef DEBUG_NUMA
if (node == -1)
BUG();
#endif
return node;
}
static inline int __node_to_first_cpu(int node)
{
int cpu;
for(cpu = 0; cpu < NR_CPUS; cpu++)
if (numa_cpu_lookup_table[cpu] == node)
return cpu;
BUG(); /* couldn't find a cpu on given node */
return -1;
}
static inline unsigned long __node_to_cpu_mask(int node)
{
int cpu;
unsigned long mask = 0UL;
if (sizeof(unsigned long) * 8 < NR_CPUS)
BUG();
for(cpu = 0; cpu < NR_CPUS; cpu++)
if (numa_cpu_lookup_table[cpu] == node)
mask |= 1 << cpu;
return mask;
}
#else /* !CONFIG_NUMA */
#define __cpu_to_node(cpu) (0)
#define __memblk_to_node(memblk) (0)
#define __parent_node(nid) (0)
#define __node_to_first_cpu(node) (0)
#define __node_to_cpu_mask(node) (cpu_online_map)
#define __node_to_memblk(node) (0)
#endif /* CONFIG_NUMA */
#endif /* _ASM_PPC64_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