1e35704baSEduardo Habkost #ifndef SYSEMU_NUMA_H 2e35704baSEduardo Habkost #define SYSEMU_NUMA_H 3e35704baSEduardo Habkost 4e35704baSEduardo Habkost #include "qemu/bitmap.h" 5a44432b4SMarkus Armbruster #include "qapi/qapi-types-machine.h" 6a44432b4SMarkus Armbruster #include "exec/cpu-common.h" 7a44432b4SMarkus Armbruster 8a44432b4SMarkus Armbruster struct CPUArchId; 9e35704baSEduardo Habkost 10b58c5c2dSMarkus Armbruster #define MAX_NODES 128 11b58c5c2dSMarkus Armbruster #define NUMA_NODE_UNASSIGNED MAX_NODES 12b58c5c2dSMarkus Armbruster #define NUMA_DISTANCE_MIN 10 13b58c5c2dSMarkus Armbruster #define NUMA_DISTANCE_DEFAULT 20 14b58c5c2dSMarkus Armbruster #define NUMA_DISTANCE_MAX 254 15b58c5c2dSMarkus Armbruster #define NUMA_DISTANCE_UNREACHABLE 255 16b58c5c2dSMarkus Armbruster 17aec90730SEric Blake struct NodeInfo { 18e35704baSEduardo Habkost uint64_t node_mem; 19e35704baSEduardo Habkost struct HostMemoryBackend *node_memdev; 20e35704baSEduardo Habkost bool present; 210f203430SHe Chen uint8_t distance[MAX_NODES]; 223bfe5716SLaurent Vivier }; 23fa9ea81dSBharata B Rao 2431959e82SVadim Galitsyn struct NumaNodeMem { 2531959e82SVadim Galitsyn uint64_t node_mem; 2631959e82SVadim Galitsyn uint64_t node_plugged_mem; 2731959e82SVadim Galitsyn }; 2831959e82SVadim Galitsyn 29aa570207STao Xu struct NumaState { 30aa570207STao Xu /* Number of NUMA nodes */ 31aa570207STao Xu int num_nodes; 32aa570207STao Xu 33118154b7STao Xu /* Allow setting NUMA distance for different NUMA nodes */ 34118154b7STao Xu bool have_numa_distance; 35*7e721e7bSTao Xu 36*7e721e7bSTao Xu /* NUMA nodes information */ 37*7e721e7bSTao Xu NodeInfo nodes[MAX_NODES]; 38aa570207STao Xu }; 39aa570207STao Xu typedef struct NumaState NumaState; 40aa570207STao Xu 4152924deaSMarkus Armbruster void set_numa_options(MachineState *ms, NumaOptions *object, Error **errp); 42ea089eebSIgor Mammedov void parse_numa_opts(MachineState *ms); 437a3099fcSIgor Mammedov void numa_complete_configuration(MachineState *ms); 44aa570207STao Xu void query_numa_node_mem(NumaNodeMem node_mem[], MachineState *ms); 45e35704baSEduardo Habkost extern QemuOptsList qemu_numa_opts; 463bfe5716SLaurent Vivier void numa_legacy_auto_assign_ram(MachineClass *mc, NodeInfo *nodes, 473bfe5716SLaurent Vivier int nb_nodes, ram_addr_t size); 483bfe5716SLaurent Vivier void numa_default_auto_assign_ram(MachineClass *mc, NodeInfo *nodes, 493bfe5716SLaurent Vivier int nb_nodes, ram_addr_t size); 50a44432b4SMarkus Armbruster void numa_cpu_pre_plug(const struct CPUArchId *slot, DeviceState *dev, 51a44432b4SMarkus Armbruster Error **errp); 52a44432b4SMarkus Armbruster 53e35704baSEduardo Habkost #endif 54