mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 17:23:56 -06:00
numa: move numa global variable nb_numa_nodes into MachineState
Add struct NumaState in MachineState and move existing numa global nb_numa_nodes(renamed as "num_nodes") into NumaState. And add variable numa_support into MachineClass to decide which submachines support NUMA. Reviewed-by: Igor Mammedov <imammedo@redhat.com> Suggested-by: Igor Mammedov <imammedo@redhat.com> Suggested-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Tao Xu <tao3.xu@intel.com> Message-Id: <20190809065731.9097-3-tao3.xu@intel.com> [ehabkost: include hw/boards.h again to fix build failures] Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
parent
2744ece809
commit
aa57020774
17 changed files with 113 additions and 59 deletions
|
@ -1002,6 +1002,8 @@ static FWCfgState *bochs_bios_init(AddressSpace *as, PCMachineState *pcms)
|
|||
int i;
|
||||
const CPUArchIdList *cpus;
|
||||
MachineClass *mc = MACHINE_GET_CLASS(pcms);
|
||||
MachineState *ms = MACHINE(pcms);
|
||||
int nb_numa_nodes = ms->numa_state->num_nodes;
|
||||
|
||||
fw_cfg = fw_cfg_init_io_dma(FW_CFG_IO_BASE, FW_CFG_IO_BASE + 4, as);
|
||||
fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, pcms->boot_cpus);
|
||||
|
@ -1774,12 +1776,13 @@ void pc_machine_done(Notifier *notifier, void *data)
|
|||
void pc_guest_info_init(PCMachineState *pcms)
|
||||
{
|
||||
int i;
|
||||
MachineState *ms = MACHINE(pcms);
|
||||
|
||||
pcms->apic_xrupt_override = kvm_allows_irq0_override();
|
||||
pcms->numa_nodes = nb_numa_nodes;
|
||||
pcms->numa_nodes = ms->numa_state->num_nodes;
|
||||
pcms->node_mem = g_malloc0(pcms->numa_nodes *
|
||||
sizeof *pcms->node_mem);
|
||||
for (i = 0; i < nb_numa_nodes; i++) {
|
||||
for (i = 0; i < ms->numa_state->num_nodes; i++) {
|
||||
pcms->node_mem[i] = numa_info[i].node_mem;
|
||||
}
|
||||
|
||||
|
@ -2869,7 +2872,7 @@ static int64_t pc_get_default_cpu_node_id(const MachineState *ms, int idx)
|
|||
x86_topo_ids_from_apicid(ms->possible_cpus->cpus[idx].arch_id,
|
||||
pcms->smp_dies, ms->smp.cores,
|
||||
ms->smp.threads, &topo);
|
||||
return topo.pkg_id % nb_numa_nodes;
|
||||
return topo.pkg_id % ms->numa_state->num_nodes;
|
||||
}
|
||||
|
||||
static const CPUArchIdList *pc_possible_cpu_arch_ids(MachineState *ms)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue