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 extern int nb_numa_nodes; /* Number of NUMA nodes */ 18 extern bool have_numa_distance; 19 20 struct NodeInfo { 21 uint64_t node_mem; 22 struct HostMemoryBackend *node_memdev; 23 bool present; 24 uint8_t distance[MAX_NODES]; 25 }; 26 27 struct NumaNodeMem { 28 uint64_t node_mem; 29 uint64_t node_plugged_mem; 30 }; 31 32 extern NodeInfo numa_info[MAX_NODES]; 33 34 void set_numa_options(MachineState *ms, NumaOptions *object, Error **errp); 35 void parse_numa_opts(MachineState *ms); 36 void numa_complete_configuration(MachineState *ms); 37 void query_numa_node_mem(NumaNodeMem node_mem[]); 38 extern QemuOptsList qemu_numa_opts; 39 void numa_legacy_auto_assign_ram(MachineClass *mc, NodeInfo *nodes, 40 int nb_nodes, ram_addr_t size); 41 void numa_default_auto_assign_ram(MachineClass *mc, NodeInfo *nodes, 42 int nb_nodes, ram_addr_t size); 43 void numa_cpu_pre_plug(const struct CPUArchId *slot, DeviceState *dev, 44 Error **errp); 45 46 #endif 47