Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Cleanup of linkage issues for non-Linux hosts
[palacios.git] / linux_module / numa.c
1 /* NUMA topology 
2  * (c) Jack Lange, 2013
3  */
4
5 #include <linux/mm.h>
6
7 #include <interfaces/vmm_numa.h>
8
9 #include "palacios.h"
10
11
12
13
14
15 int numa_num_nodes(void) {
16     return num_online_nodes();
17 }
18
19
20
21 int numa_addr_to_node(uintptr_t phys_addr) {
22     return page_to_nid(pfn_to_page(phys_addr >> PAGE_SHIFT));
23 }
24
25 int numa_cpu_to_node(int cpu_id) {
26     return cpu_to_node(cpu_id);
27 }
28
29
30 int numa_get_distance(int node1, int node2) {
31     return node_distance(node1, node2);
32 }
33
34
35 /* Ugly fix for interface type differences... */
36 static int phys_ptr_to_node(void * phys_ptr) {
37     return numa_addr_to_node((uintptr_t)phys_ptr);
38 }
39
40 struct v3_numa_hooks numa_hooks = {
41     .cpu_to_node = numa_cpu_to_node,
42     .phys_addr_to_node = phys_ptr_to_node,
43     .get_distance = numa_get_distance,
44 };
45
46
47 int palacios_init_numa( void ) {
48  
49     V3_Init_NUMA(&numa_hooks);
50
51     INFO("palacios numa interface initialized\n");
52   
53     return 0;
54 }
55
56 int palacios_deinit_numa(void) {
57     INFO("palacios numa interface deinitialized\n");
58     return 0;
59 }