ia64/xen-unstable

view xen/include/asm-x86/numa.h @ 15812:86a154e1ef5d

[HVM] Shadow: don't shadow the p2m table.
For HVM vcpus with paging disabled, we used to shadow the p2m table,
and skip the p2m lookup to go from gfn to mfn. Instead, we now
provide a simple pagetable that gives a one-to-one mapping of 4GB, and
shadow that, making the translations from gfn to mfn via the p2m.
This removes the paging-disabled special-case code from the shadow
fault handler, and allows us to expand the p2m interface, since all HVM
translations now go through the same p2m lookups.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
author Tim Deegan <Tim.Deegan@xensource.com>
date Fri Aug 31 11:06:22 2007 +0100 (2007-08-31)
parents 65c3287306db
children f82baf1755ac
line source
1 #ifndef _ASM_X8664_NUMA_H
2 #define _ASM_X8664_NUMA_H 1
4 #include <xen/cpumask.h>
6 #define NODES_SHIFT 6
8 extern unsigned char cpu_to_node[];
9 extern cpumask_t node_to_cpumask[];
11 #define cpu_to_node(cpu) (cpu_to_node[cpu])
12 #define parent_node(node) (node)
13 #define node_to_first_cpu(node) (__ffs(node_to_cpumask[node]))
14 #define node_to_cpumask(node) (node_to_cpumask[node])
16 struct node {
17 u64 start,end;
18 };
20 extern int compute_hash_shift(struct node *nodes, int numnodes);
21 extern int pxm_to_node(int nid);
23 #define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT))
24 #define VIRTUAL_BUG_ON(x)
25 #define NODEMAPSIZE 0xfff
27 extern void numa_add_cpu(int cpu);
28 extern void numa_init_array(void);
29 extern int numa_off;
31 extern void numa_set_node(int cpu, int node);
33 extern void setup_node_bootmem(int nodeid, u64 start, u64 end);
34 extern unsigned char apicid_to_node[256];
35 #ifdef CONFIG_NUMA
36 extern void __init init_cpu_to_node(void);
38 static inline void clear_node_cpumask(int cpu)
39 {
40 cpu_clear(cpu, node_to_cpumask[cpu_to_node(cpu)]);
41 }
43 /* Simple perfect hash to map physical addresses to node numbers */
44 extern int memnode_shift;
45 extern u8 memnodemap[NODEMAPSIZE];
47 struct node_data {
48 unsigned long node_start_pfn;
49 unsigned long node_spanned_pages;
50 unsigned int node_id;
51 };
53 extern struct node_data node_data[];
55 static inline __attribute__((pure)) int phys_to_nid(unsigned long addr)
56 {
57 unsigned nid;
58 VIRTUAL_BUG_ON((addr >> memnode_shift) >= NODEMAPSIZE);
59 nid = memnodemap[addr >> memnode_shift];
60 VIRTUAL_BUG_ON(nid >= MAX_NUMNODES || !node_data[nid]);
61 return nid;
62 }
64 #define NODE_DATA(nid) (&(node_data[nid]))
66 #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
67 #define node_end_pfn(nid) (NODE_DATA(nid)->node_start_pfn + \
68 NODE_DATA(nid)->node_spanned_pages)
71 #else
72 #define init_cpu_to_node() do {} while (0)
73 #define clear_node_cpumask(cpu) do {} while (0)
74 #endif
76 #define NUMA_NO_NODE 0xff
78 #endif