diff options
author | Igor Mammedov <imammedo@redhat.com> | 2017-05-30 18:23:56 +0200 |
---|---|---|
committer | Eduardo Habkost <ehabkost@redhat.com> | 2017-06-05 14:59:08 -0300 |
commit | a0ceb640d083ab583d115fbd2ded14c089044ae8 (patch) | |
tree | ddaa37a3b8e7b2f0b9c325b2e996577f62bfe4e9 /numa.c | |
parent | 1f43571604da85c62f25f3ba6d275b1b5ea76ca2 (diff) |
numa: consolidate cpu_preplug fixups/checks for pc/arm/spapr
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <1496161442-96665-2-git-send-email-imammedo@redhat.com>
[ehabkost: Fix indentation]
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'numa.c')
-rw-r--r-- | numa.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -533,6 +533,29 @@ void parse_numa_opts(MachineState *ms) } } +void numa_cpu_pre_plug(const CPUArchId *slot, DeviceState *dev, Error **errp) +{ + int mapped_node_id; /* set by -numa option */ + int node_id = object_property_get_int(OBJECT(dev), "node-id", &error_abort); + + /* by default CPUState::numa_node was 0 if it wasn't set explicitly + * TODO: make it error when incomplete numa mapping support is removed + */ + mapped_node_id = slot->props.node_id; + if (!slot->props.has_node_id) { + mapped_node_id = 0; + } + + if (node_id == CPU_UNSET_NUMA_NODE_ID) { + /* due to bug in libvirt, it doesn't pass node-id from props on + * device_add as expected, so we have to fix it up here */ + object_property_set_int(OBJECT(dev), mapped_node_id, "node-id", errp); + } else if (node_id != mapped_node_id) { + error_setg(errp, "node-id=%d must match numa node specified " + "with -numa option", node_id); + } +} + static void allocate_system_memory_nonnuma(MemoryRegion *mr, Object *owner, const char *name, uint64_t ram_size) |