7 #include <interfaces/vmm_numa.h>
15 int numa_num_nodes(void) {
16 return num_online_nodes();
21 int numa_addr_to_node(uintptr_t phys_addr) {
22 return page_to_nid(pfn_to_page(phys_addr >> PAGE_SHIFT));
25 int numa_cpu_to_node(int cpu_id) {
26 return cpu_to_node(cpu_id);
30 int numa_get_distance(int node1, int node2) {
31 return node_distance(node1, node2);
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);
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,
47 int palacios_init_numa( void ) {
49 V3_Init_NUMA(&numa_hooks);
51 INFO("palacios numa interface initialized\n");
56 int palacios_deinit_numa(void) {
57 INFO("palacios numa interface deinitialized\n");