Commit 1e9b712b authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds

[PATCH] x86_64: Add x86_64 support for Jack Steiner's SLIT sysfs patch

Add x86_64 support for Jack Steiner's SLIT sysfs patch

Make Jack's code compile on x86-64 and add x86-64 low level support to save
the SLIT pointer and a node_distance() implementation.

Requires the previous SRAT patch.
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 29ee39a6
...@@ -13,9 +13,13 @@ ...@@ -13,9 +13,13 @@
#include <linux/acpi.h> #include <linux/acpi.h>
#include <linux/mmzone.h> #include <linux/mmzone.h>
#include <linux/bitmap.h> #include <linux/bitmap.h>
#include <linux/module.h>
#include <linux/topology.h>
#include <asm/proto.h> #include <asm/proto.h>
#include <asm/numa.h> #include <asm/numa.h>
static struct acpi_table_slit *acpi_slit;
static DECLARE_BITMAP(nodes_parsed, MAX_NUMNODES) __initdata; static DECLARE_BITMAP(nodes_parsed, MAX_NUMNODES) __initdata;
static struct node nodes[MAX_NUMNODES] __initdata; static struct node nodes[MAX_NUMNODES] __initdata;
static __u8 pxm2node[256] __initdata = { [0 ... 255] = 0xff }; static __u8 pxm2node[256] __initdata = { [0 ... 255] = 0xff };
...@@ -77,7 +81,7 @@ static __init inline int srat_disabled(void) ...@@ -77,7 +81,7 @@ static __init inline int srat_disabled(void)
/* Callback for SLIT parsing */ /* Callback for SLIT parsing */
void __init acpi_numa_slit_init(struct acpi_table_slit *slit) void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
{ {
/* ignored for now */ acpi_slit = slit;
} }
/* Callback for Proximity Domain -> LAPIC mapping */ /* Callback for Proximity Domain -> LAPIC mapping */
...@@ -180,3 +184,26 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end) ...@@ -180,3 +184,26 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end)
numa_init_array(); numa_init_array();
return 0; return 0;
} }
int node_to_pxm(int n)
{
int i;
if (pxm2node[n] == n)
return n;
for (i = 0; i < 256; i++)
if (pxm2node[i] == n)
return i;
return 0;
}
int __node_distance(int a, int b)
{
int index;
if (!acpi_slit)
return a == b ? 10 : 20;
index = acpi_slit->localities * node_to_pxm(a);
return acpi_slit->entry[index + node_to_pxm(b)];
}
EXPORT_SYMBOL(__node_distance);
...@@ -23,7 +23,7 @@ static ssize_t node_read_cpumap(struct sys_device * dev, char * buf) ...@@ -23,7 +23,7 @@ static ssize_t node_read_cpumap(struct sys_device * dev, char * buf)
int len; int len;
/* 2004/06/03: buf currently PAGE_SIZE, need > 1 char per 4 bits. */ /* 2004/06/03: buf currently PAGE_SIZE, need > 1 char per 4 bits. */
BUILD_BUG_ON(NR_CPUS/4 > PAGE_SIZE/2); BUILD_BUG_ON(MAX_NUMNODES/4 > PAGE_SIZE/2);
len = cpumask_scnprintf(buf, PAGE_SIZE-1, mask); len = cpumask_scnprintf(buf, PAGE_SIZE-1, mask);
len += sprintf(buf + len, "\n"); len += sprintf(buf + len, "\n");
...@@ -118,7 +118,7 @@ static ssize_t node_read_distance(struct sys_device * dev, char * buf) ...@@ -118,7 +118,7 @@ static ssize_t node_read_distance(struct sys_device * dev, char * buf)
int i; int i;
/* buf currently PAGE_SIZE, need ~4 chars per node */ /* buf currently PAGE_SIZE, need ~4 chars per node */
BUILD_BUG_ON(NR_NODES*4 > PAGE_SIZE/2); BUILD_BUG_ON(MAX_NUMNODES*4 > PAGE_SIZE/2);
for (i = 0; i < numnodes; i++) for (i = 0; i < numnodes; i++)
len += sprintf(buf + len, "%s%d", i ? " " : "", node_distance(nid, i)); len += sprintf(buf + len, "%s%d", i ? " " : "", node_distance(nid, i));
......
...@@ -16,6 +16,12 @@ extern unsigned char cpu_to_node[]; ...@@ -16,6 +16,12 @@ extern unsigned char cpu_to_node[];
extern cpumask_t node_to_cpumask[]; extern cpumask_t node_to_cpumask[];
extern cpumask_t pci_bus_to_cpumask[]; extern cpumask_t pci_bus_to_cpumask[];
#ifdef CONFIG_ACPI_NUMA
extern int __node_distance(int, int);
#define node_distance(a,b) __node_distance(a,b)
/* #else fallback version */
#endif
#define cpu_to_node(cpu) (cpu_to_node[cpu]) #define cpu_to_node(cpu) (cpu_to_node[cpu])
#define parent_node(node) (node) #define parent_node(node) (node)
#define node_to_first_cpu(node) (__ffs(node_to_cpumask[node])) #define node_to_first_cpu(node) (__ffs(node_to_cpumask[node]))
......
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