Lines Matching +full:1 +full:ms

62 static void parse_numa_node(MachineState *ms, NumaNodeOptions *node,  in parse_numa_node()  argument
68 MachineClass *mc = MACHINE_GET_CLASS(ms); in parse_numa_node()
69 unsigned int max_cpus = ms->smp.max_cpus; in parse_numa_node()
70 NodeInfo *numa_info = ms->numa_state->nodes; in parse_numa_node()
75 nodenr = ms->numa_state->num_nodes; in parse_numa_node()
95 if (!ms->numa_state->hmat_enabled) { in parse_numa_node()
105 MAX_NODES - 1); in parse_numa_node()
121 props = mc->cpu_index_to_instance_props(ms, cpus->value); in parse_numa_node()
124 machine_set_cpu_numa_node(ms, &props, &err); in parse_numa_node()
167 max_numa_nodeid = MAX(max_numa_nodeid, nodenr + 1); in parse_numa_node()
168 ms->numa_state->num_nodes++; in parse_numa_node()
172 void parse_numa_distance(MachineState *ms, NumaDistOptions *dist, Error **errp) in parse_numa_distance() argument
177 NodeInfo *numa_info = ms->numa_state->nodes; in parse_numa_distance()
181 src >= MAX_NODES ? "src" : "dst", MAX_NODES - 1); in parse_numa_distance()
205 ms->numa_state->have_numa_distance = true; in parse_numa_distance()
283 temp_base = 1; in parse_numa_hmat_lb()
302 node->initiator, node->target, UINT16_MAX - 1); in parse_numa_hmat_lb()
310 * Set lb_info_provided bit 0 as 1, in parse_numa_hmat_lb()
329 "target=%d should be 1MB aligned", node->bandwidth, in parse_numa_hmat_lb()
347 hmat_lb->base = hmat_lb->base ? hmat_lb->base : 1; in parse_numa_hmat_lb()
354 temp_base = UINT64_C(1) << first_bit; in parse_numa_hmat_lb()
368 node->initiator, node->target, UINT16_MAX - 1); in parse_numa_hmat_lb()
376 * Set lb_info_provided bit 1 as 1, in parse_numa_hmat_lb()
379 numa_info[node->target].lb_info_provided |= BIT(1); in parse_numa_hmat_lb()
389 void parse_numa_hmat_cache(MachineState *ms, NumaHmatCacheOptions *node, in parse_numa_hmat_cache() argument
392 int nb_numa_nodes = ms->numa_state->num_nodes; in parse_numa_hmat_cache()
393 NodeInfo *numa_info = ms->numa_state->nodes; in parse_numa_hmat_cache()
402 if (numa_info[node->node_id].lb_info_provided != (BIT(0) | BIT(1))) { in parse_numa_hmat_cache()
409 if (node->level < 1 || node->level >= HMAT_LB_LEVELS) { in parse_numa_hmat_cache()
412 HMAT_LB_LEVELS - 1); in parse_numa_hmat_cache()
418 if (ms->numa_state->hmat_cache[node->node_id][node->level]) { in parse_numa_hmat_cache()
425 if ((node->level > 1) && in parse_numa_hmat_cache()
426 ms->numa_state->hmat_cache[node->node_id][node->level - 1] == NULL) { in parse_numa_hmat_cache()
428 node->level - 1); in parse_numa_hmat_cache()
432 if ((node->level > 1) && in parse_numa_hmat_cache()
434 ms->numa_state->hmat_cache[node->node_id][node->level - 1]->size)) { in parse_numa_hmat_cache()
438 ms->numa_state->hmat_cache[node->node_id] in parse_numa_hmat_cache()
439 [node->level - 1]->size, in parse_numa_hmat_cache()
440 node->level - 1); in parse_numa_hmat_cache()
444 if ((node->level < HMAT_LB_LEVELS - 1) && in parse_numa_hmat_cache()
445 ms->numa_state->hmat_cache[node->node_id][node->level + 1] && in parse_numa_hmat_cache()
447 ms->numa_state->hmat_cache[node->node_id][node->level + 1]->size)) { in parse_numa_hmat_cache()
451 ms->numa_state->hmat_cache[node->node_id] in parse_numa_hmat_cache()
452 [node->level + 1]->size, in parse_numa_hmat_cache()
453 node->level + 1); in parse_numa_hmat_cache()
459 ms->numa_state->hmat_cache[node->node_id][node->level] = hmat_cache; in parse_numa_hmat_cache()
462 void set_numa_options(MachineState *ms, NumaOptions *object, Error **errp) in set_numa_options() argument
464 if (!ms->numa_state) { in set_numa_options()
471 parse_numa_node(ms, &object->u.node, errp); in set_numa_options()
474 parse_numa_distance(ms, &object->u.dist, errp); in set_numa_options()
481 if (!ms->numa_state->nodes[object->u.cpu.node_id].present) { in set_numa_options()
488 machine_set_cpu_numa_node(ms, in set_numa_options()
493 if (!ms->numa_state->hmat_enabled) { in set_numa_options()
500 parse_numa_hmat_lb(ms->numa_state, &object->u.hmat_lb, errp); in set_numa_options()
503 if (!ms->numa_state->hmat_enabled) { in set_numa_options()
510 parse_numa_hmat_cache(ms, &object->u.hmat_cache, errp); in set_numa_options()
520 MachineState *ms = MACHINE(opaque); in parse_numa() local
527 return -1; in parse_numa()
542 set_numa_options(ms, object, &err); in parse_numa()
548 return -1; in parse_numa()
560 static void validate_numa_distance(MachineState *ms) in validate_numa_distance() argument
564 int nb_numa_nodes = ms->numa_state->num_nodes; in validate_numa_distance()
565 NodeInfo *numa_info = ms->numa_state->nodes; in validate_numa_distance()
603 static void complete_init_numa_distance(MachineState *ms) in complete_init_numa_distance() argument
606 NodeInfo *numa_info = ms->numa_state->nodes; in complete_init_numa_distance()
613 for (src = 0; src < ms->numa_state->num_nodes; src++) { in complete_init_numa_distance()
614 for (dst = 0; dst < ms->numa_state->num_nodes; dst++) { in complete_init_numa_distance()
626 static void numa_init_memdev_container(MachineState *ms, MemoryRegion *ram) in numa_init_memdev_container() argument
631 for (i = 0; i < ms->numa_state->num_nodes; i++) { in numa_init_memdev_container()
632 uint64_t size = ms->numa_state->nodes[i].node_mem; in numa_init_memdev_container()
633 HostMemoryBackend *backend = ms->numa_state->nodes[i].node_memdev; in numa_init_memdev_container()
637 MemoryRegion *seg = machine_consume_memdev(ms, backend); in numa_init_memdev_container()
643 void numa_complete_configuration(MachineState *ms) in numa_complete_configuration() argument
646 MachineClass *mc = MACHINE_GET_CLASS(ms); in numa_complete_configuration()
647 NodeInfo *numa_info = ms->numa_state->nodes; in numa_complete_configuration()
651 * (ms->maxram_size > ms->ram_size) but without '-numa' options explicitly on in numa_complete_configuration()
666 if (ms->numa_state->num_nodes == 0 && in numa_complete_configuration()
667 ((ms->ram_slots && mc->auto_enable_numa_with_memhp) || in numa_complete_configuration()
668 (ms->maxram_size > ms->ram_size && mc->auto_enable_numa_with_memdev) || in numa_complete_configuration()
671 parse_numa_node(ms, &node, &error_abort); in numa_complete_configuration()
672 numa_info[0].node_mem = ms->ram_size; in numa_complete_configuration()
678 for (i = max_numa_nodeid - 1; i >= 0; i--) { in numa_complete_configuration()
682 exit(1); in numa_complete_configuration()
687 assert(ms->numa_state->num_nodes == max_numa_nodeid); in numa_complete_configuration()
689 if (ms->numa_state->num_nodes > 0) { in numa_complete_configuration()
693 for (i = 0; i < ms->numa_state->num_nodes; i++) { in numa_complete_configuration()
696 if (numa_total != ms->ram_size) { in numa_complete_configuration()
699 numa_total, ms->ram_size); in numa_complete_configuration()
700 exit(1); in numa_complete_configuration()
704 if (ms->memdev) { in numa_complete_configuration()
707 exit(1); in numa_complete_configuration()
709 ms->ram = g_new(MemoryRegion, 1); in numa_complete_configuration()
710 memory_region_init(ms->ram, OBJECT(ms), mc->default_ram_id, in numa_complete_configuration()
711 ms->ram_size); in numa_complete_configuration()
712 numa_init_memdev_container(ms, ms->ram); in numa_complete_configuration()
726 if (ms->numa_state->have_numa_distance) { in numa_complete_configuration()
728 validate_numa_distance(ms); in numa_complete_configuration()
731 complete_init_numa_distance(ms); in numa_complete_configuration()
736 void parse_numa_opts(MachineState *ms) in parse_numa_opts() argument
738 qemu_opts_foreach(qemu_find_opts("numa"), parse_numa, ms, &error_fatal); in parse_numa_opts()
804 void query_numa_node_mem(NumaNodeMem node_mem[], MachineState *ms) in query_numa_node_mem() argument
808 if (ms->numa_state == NULL || ms->numa_state->num_nodes <= 0) { in query_numa_node_mem()
813 for (i = 0; i < ms->numa_state->num_nodes; i++) { in query_numa_node_mem()
814 node_mem[i].node_mem += ms->numa_state->nodes[i].node_mem; in query_numa_node_mem()