diff options
author | Tao Xu | 2019-08-09 08:57:24 +0200 |
---|---|---|
committer | Eduardo Habkost | 2019-09-03 16:26:55 +0200 |
commit | 7e721e7b10e166003d4fdcfab90a72c93d4df839 (patch) | |
tree | c563fc64469f07b56b499fa850a264653d9fe31a /hw/ppc | |
parent | numa: move numa global variable have_numa_distance into MachineState (diff) | |
download | qemu-7e721e7b10e166003d4fdcfab90a72c93d4df839.tar.gz qemu-7e721e7b10e166003d4fdcfab90a72c93d4df839.tar.xz qemu-7e721e7b10e166003d4fdcfab90a72c93d4df839.zip |
numa: move numa global variable numa_info into MachineState
Move existing numa global numa_info (renamed as "nodes") into NumaState.
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-5-tao3.xu@intel.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'hw/ppc')
-rw-r--r-- | hw/ppc/spapr.c | 10 | ||||
-rw-r--r-- | hw/ppc/spapr_pci.c | 4 |
2 files changed, 8 insertions, 6 deletions
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index a7eb87feb6..a9cd350f0d 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -359,8 +359,8 @@ static hwaddr spapr_node0_size(MachineState *machine) if (machine->numa_state->num_nodes) { int i; for (i = 0; i < machine->numa_state->num_nodes; ++i) { - if (numa_info[i].node_mem) { - return MIN(pow2floor(numa_info[i].node_mem), + if (machine->numa_state->nodes[i].node_mem) { + return MIN(pow2floor(machine->numa_state->nodes[i].node_mem), machine->ram_size); } } @@ -404,7 +404,7 @@ static int spapr_populate_memory(SpaprMachineState *spapr, void *fdt) MachineState *machine = MACHINE(spapr); hwaddr mem_start, node_size; int i, nb_nodes = machine->numa_state->num_nodes; - NodeInfo *nodes = numa_info; + NodeInfo *nodes = machine->numa_state->nodes; NodeInfo ramnode; /* No NUMA nodes, assume there is just one node with whole RAM */ @@ -2541,11 +2541,11 @@ static void spapr_validate_node_memory(MachineState *machine, Error **errp) } for (i = 0; i < machine->numa_state->num_nodes; i++) { - if (numa_info[i].node_mem % SPAPR_MEMORY_BLOCK_SIZE) { + if (machine->numa_state->nodes[i].node_mem % SPAPR_MEMORY_BLOCK_SIZE) { error_setg(errp, "Node %d memory size 0x%" PRIx64 " is not aligned to %" PRIu64 " MiB", - i, numa_info[i].node_mem, + i, machine->numa_state->nodes[i].node_mem, SPAPR_MEMORY_BLOCK_SIZE / MiB); return; } diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index deb0b0c80c..210abc67c3 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -1825,6 +1825,7 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp) SysBusDevice *s = SYS_BUS_DEVICE(dev); SpaprPhbState *sphb = SPAPR_PCI_HOST_BRIDGE(s); PCIHostState *phb = PCI_HOST_BRIDGE(s); + MachineState *ms = MACHINE(spapr); char *namebuf; int i; PCIBus *bus; @@ -1877,7 +1878,8 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp) } if (sphb->numa_node != -1 && - (sphb->numa_node >= MAX_NODES || !numa_info[sphb->numa_node].present)) { + (sphb->numa_node >= MAX_NODES || + !ms->numa_state->nodes[sphb->numa_node].present)) { error_setg(errp, "Invalid NUMA node ID for PCI host bridge"); return; } |