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 27*31959e82SVadim Galitsyn struct NumaNodeMem { 28*31959e82SVadim Galitsyn uint64_t node_mem; 29*31959e82SVadim Galitsyn uint64_t node_plugged_mem; 30*31959e82SVadim Galitsyn }; 31*31959e82SVadim Galitsyn 32e35704baSEduardo Habkost extern NodeInfo numa_info[MAX_NODES]; 33ea089eebSIgor Mammedov void parse_numa_opts(MachineState *ms); 34*31959e82SVadim Galitsyn void query_numa_node_mem(NumaNodeMem node_mem[]); 35e35704baSEduardo Habkost extern QemuOptsList qemu_numa_opts; 36fa9ea81dSBharata B Rao void numa_set_mem_node_id(ram_addr_t addr, uint64_t size, uint32_t node); 37fa9ea81dSBharata B Rao void numa_unset_mem_node_id(ram_addr_t addr, uint64_t size, uint32_t node); 38e75e2a14SBharata B Rao uint32_t numa_get_node(ram_addr_t addr, Error **errp); 393bfe5716SLaurent Vivier void numa_legacy_auto_assign_ram(MachineClass *mc, NodeInfo *nodes, 403bfe5716SLaurent Vivier int nb_nodes, ram_addr_t size); 413bfe5716SLaurent Vivier void numa_default_auto_assign_ram(MachineClass *mc, NodeInfo *nodes, 423bfe5716SLaurent Vivier int nb_nodes, ram_addr_t size); 43a0ceb640SIgor Mammedov void numa_cpu_pre_plug(const CPUArchId *slot, DeviceState *dev, Error **errp); 44e35704baSEduardo Habkost #endif 45