debuggers.hg

view xen/include/asm-x86/numa.h @ 22855:1d1eec7e1fb4

xl: Perform minimal validation of virtual disk file while parsing config file

This patch performs some very basic validation on the virtual disk
file passed through the config file. This validation ensures that we
don't go too far with the initialization like spawn qemu and more
while there could be some potentially fundamental issues.

[ Patch fixed up to work with PHYSTYPE_EMPTY 22808:6ec61438713a -iwj ]

Signed-off-by: Kamala Narasimhan <kamala.narasimhan@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Kamala Narasimhan <kamala.narasimhan@gmail.com>
date Tue Jan 25 18:09:49 2011 +0000 (2011-01-25)
parents d4b373ec948b
children
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 int srat_rev;
10 extern unsigned char cpu_to_node[];
11 extern cpumask_t node_to_cpumask[];
13 #define cpu_to_node(cpu) (cpu_to_node[cpu])
14 #define parent_node(node) (node)
15 #define node_to_first_cpu(node) (__ffs(node_to_cpumask[node]))
16 #define node_to_cpumask(node) (node_to_cpumask[node])
18 struct node {
19 u64 start,end;
20 };
22 extern int __init compute_hash_shift(struct node *nodes, int numnodes,
23 int *nodeids);
24 extern int pxm_to_node(int nid);
26 #define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT))
27 #define VIRTUAL_BUG_ON(x)
29 extern void numa_add_cpu(int cpu);
30 extern void numa_init_array(void);
31 extern int numa_off;
34 extern int srat_disabled(void);
35 extern void numa_set_node(int cpu, int node);
36 extern int setup_node(int pxm);
37 extern void srat_detect_node(int cpu);
39 extern void setup_node_bootmem(int nodeid, u64 start, u64 end);
40 extern unsigned char apicid_to_node[];
41 #ifdef CONFIG_NUMA
42 extern void __init init_cpu_to_node(void);
44 static inline void clear_node_cpumask(int cpu)
45 {
46 cpu_clear(cpu, node_to_cpumask[cpu_to_node(cpu)]);
47 }
49 /* Simple perfect hash to map pdx to node numbers */
50 extern int memnode_shift;
51 extern unsigned long memnodemapsize;
52 extern u8 *memnodemap;
54 struct node_data {
55 unsigned long node_start_pfn;
56 unsigned long node_spanned_pages;
57 unsigned int node_id;
58 };
60 extern struct node_data node_data[];
62 static inline __attribute__((pure)) int phys_to_nid(paddr_t addr)
63 {
64 unsigned nid;
65 VIRTUAL_BUG_ON((paddr_to_pdx(addr) >> memnode_shift) >= memnodemapsize);
66 nid = memnodemap[paddr_to_pdx(addr) >> memnode_shift];
67 VIRTUAL_BUG_ON(nid >= MAX_NUMNODES || !node_data[nid]);
68 return nid;
69 }
71 #define NODE_DATA(nid) (&(node_data[nid]))
73 #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
74 #define node_spanned_pages(nid) (NODE_DATA(nid)->node_spanned_pages)
75 #define node_end_pfn(nid) (NODE_DATA(nid)->node_start_pfn + \
76 NODE_DATA(nid)->node_spanned_pages)
78 extern int valid_numa_range(u64 start, u64 end, int node);
79 #else
80 #define init_cpu_to_node() do {} while (0)
81 #define clear_node_cpumask(cpu) do {} while (0)
82 #define valid_numa_range(start, end, node) 1
83 #endif
85 void srat_parse_regions(u64 addr);
87 #endif