xref: /openbmc/qemu/include/sysemu/numa.h (revision a0ceb640d083ab583d115fbd2ded14c089044ae8)
1e35704baSEduardo Habkost #ifndef SYSEMU_NUMA_H
2e35704baSEduardo Habkost #define SYSEMU_NUMA_H
3e35704baSEduardo Habkost 
4e35704baSEduardo Habkost #include "qemu/bitmap.h"
5e35704baSEduardo Habkost #include "qemu/option.h"
6e35704baSEduardo Habkost #include "sysemu/sysemu.h"
7e35704baSEduardo Habkost #include "sysemu/hostmem.h"
857924bcdSIgor Mammedov #include "hw/boards.h"
9e35704baSEduardo Habkost 
10e35704baSEduardo Habkost extern int nb_numa_nodes;   /* Number of NUMA nodes */
110f203430SHe Chen extern bool have_numa_distance;
12e35704baSEduardo Habkost 
13fa9ea81dSBharata B Rao struct numa_addr_range {
14fa9ea81dSBharata B Rao     ram_addr_t mem_start;
15fa9ea81dSBharata B Rao     ram_addr_t mem_end;
16fa9ea81dSBharata B Rao     QLIST_ENTRY(numa_addr_range) entry;
17fa9ea81dSBharata B Rao };
18fa9ea81dSBharata B Rao 
193bfe5716SLaurent Vivier struct node_info {
20e35704baSEduardo Habkost     uint64_t node_mem;
21e35704baSEduardo Habkost     struct HostMemoryBackend *node_memdev;
22e35704baSEduardo Habkost     bool present;
23fa9ea81dSBharata B Rao     QLIST_HEAD(, numa_addr_range) addr; /* List to store address ranges */
240f203430SHe Chen     uint8_t distance[MAX_NODES];
253bfe5716SLaurent Vivier };
26fa9ea81dSBharata B Rao 
27e35704baSEduardo Habkost extern NodeInfo numa_info[MAX_NODES];
28ea089eebSIgor Mammedov void parse_numa_opts(MachineState *ms);
29e35704baSEduardo Habkost void query_numa_node_mem(uint64_t node_mem[]);
30e35704baSEduardo Habkost extern QemuOptsList qemu_numa_opts;
31fa9ea81dSBharata B Rao void numa_set_mem_node_id(ram_addr_t addr, uint64_t size, uint32_t node);
32fa9ea81dSBharata B Rao void numa_unset_mem_node_id(ram_addr_t addr, uint64_t size, uint32_t node);
33e75e2a14SBharata B Rao uint32_t numa_get_node(ram_addr_t addr, Error **errp);
343bfe5716SLaurent Vivier void numa_legacy_auto_assign_ram(MachineClass *mc, NodeInfo *nodes,
353bfe5716SLaurent Vivier                                  int nb_nodes, ram_addr_t size);
363bfe5716SLaurent Vivier void numa_default_auto_assign_ram(MachineClass *mc, NodeInfo *nodes,
373bfe5716SLaurent Vivier                                   int nb_nodes, ram_addr_t size);
38*a0ceb640SIgor Mammedov void numa_cpu_pre_plug(const CPUArchId *slot, DeviceState *dev, Error **errp);
39e35704baSEduardo Habkost #endif
40