xref: /openbmc/qemu/include/sysemu/numa.h (revision 2038f8c8)
1 #ifndef SYSEMU_NUMA_H
2 #define SYSEMU_NUMA_H
3 
4 #include "qemu/bitmap.h"
5 #include "qapi/qapi-types-machine.h"
6 #include "exec/cpu-common.h"
7 
8 struct CPUArchId;
9 
10 #define MAX_NODES 128
11 #define NUMA_NODE_UNASSIGNED MAX_NODES
12 #define NUMA_DISTANCE_MIN         10
13 #define NUMA_DISTANCE_DEFAULT     20
14 #define NUMA_DISTANCE_MAX         254
15 #define NUMA_DISTANCE_UNREACHABLE 255
16 
17 struct NodeInfo {
18     uint64_t node_mem;
19     struct HostMemoryBackend *node_memdev;
20     bool present;
21     uint8_t distance[MAX_NODES];
22 };
23 
24 struct NumaNodeMem {
25     uint64_t node_mem;
26     uint64_t node_plugged_mem;
27 };
28 
29 struct NumaState {
30     /* Number of NUMA nodes */
31     int num_nodes;
32 
33     /* Allow setting NUMA distance for different NUMA nodes */
34     bool have_numa_distance;
35 
36     /* NUMA nodes information */
37     NodeInfo nodes[MAX_NODES];
38 };
39 typedef struct NumaState NumaState;
40 
41 void set_numa_options(MachineState *ms, NumaOptions *object, Error **errp);
42 void parse_numa_opts(MachineState *ms);
43 void numa_complete_configuration(MachineState *ms);
44 void query_numa_node_mem(NumaNodeMem node_mem[], MachineState *ms);
45 extern QemuOptsList qemu_numa_opts;
46 void numa_legacy_auto_assign_ram(MachineClass *mc, NodeInfo *nodes,
47                                  int nb_nodes, ram_addr_t size);
48 void numa_default_auto_assign_ram(MachineClass *mc, NodeInfo *nodes,
49                                   int nb_nodes, ram_addr_t size);
50 void numa_cpu_pre_plug(const struct CPUArchId *slot, DeviceState *dev,
51                        Error **errp);
52 
53 #endif
54