diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2016-07-27 18:18:21 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2016-07-27 18:18:21 +0100 |
commit | 21a21b853a1bb606358af61e738abfb9aecbd720 (patch) | |
tree | 154ad3f9e601dff25552a9e68c666d6cce7a4706 /hw | |
parent | 51313fe4f4afea65970a20b32ed2d35b44fbf993 (diff) | |
parent | 03f28efbbb0ee521611e0eb28b45096b3598fb34 (diff) |
Merge remote-tracking branch 'remotes/ehabkost/tags/x86-pull-request' into staging
x86 and machine queue, 2016-07-27
Highlights:
* Fixes to allow CPU hotplug/unplug in any order;
* Exit QEMU on invalid global properties.
# gpg: Signature made Wed 27 Jul 2016 15:28:53 BST
# gpg: using RSA key 0x2807936F984DC5A6
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>"
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF D1AA 2807 936F 984D C5A6
* remotes/ehabkost/tags/x86-pull-request:
vl: exit if a bad property value is passed to -global
qdev: ignore GlobalProperty.errp for hotplugged devices
machine: Add comment to abort path in machine_set_kernel_irqchip
Revert "pc: Enforce adding CPUs contiguously and removing them in opposite order"
pc: Init CPUState->cpu_index with index in possible_cpus[]
qdev: Fix object reference leak in case device.realize() fails
exec: Set cpu_index only if it's not been explictly set
exec: Don't use cpu_index to detect if cpu_exec_init()'s been called
exec: Reduce CONFIG_USER_ONLY ifdeffenery
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/core/machine.c | 3 | ||||
-rw-r--r-- | hw/core/qdev-properties.c | 4 | ||||
-rw-r--r-- | hw/core/qdev.c | 8 | ||||
-rw-r--r-- | hw/i386/pc.c | 38 |
4 files changed, 16 insertions, 37 deletions
diff --git a/hw/core/machine.c b/hw/core/machine.c index 2fe6ff6f30..e5a456f21d 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -65,6 +65,9 @@ static void machine_set_kernel_irqchip(Object *obj, Visitor *v, ms->kernel_irqchip_split = true; break; default: + /* The value was checked in visit_type_OnOffSplit() above. If + * we get here, then something is wrong in QEMU. + */ abort(); } } diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 14e544ab17..311af6da76 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -1084,7 +1084,7 @@ int qdev_prop_check_globals(void) } static void qdev_prop_set_globals_for_type(DeviceState *dev, - const char *typename) + const char *typename) { GList *l; @@ -1100,7 +1100,7 @@ static void qdev_prop_set_globals_for_type(DeviceState *dev, if (err != NULL) { error_prepend(&err, "can't apply global %s.%s=%s: ", prop->driver, prop->property, prop->value); - if (prop->errp) { + if (!dev->hotplugged && prop->errp) { error_propagate(prop->errp, err); } else { assert(prop->user_provided); diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 6680089154..ee4a083e64 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -885,6 +885,8 @@ static void device_set_realized(Object *obj, bool value, Error **errp) HotplugHandler *hotplug_ctrl; BusState *bus; Error *local_err = NULL; + bool unattached_parent = false; + static int unattached_count; if (dev->hotplugged && !dc->hotpluggable) { error_setg(errp, QERR_DEVICE_NO_HOTPLUG, object_get_typename(obj)); @@ -893,12 +895,12 @@ static void device_set_realized(Object *obj, bool value, Error **errp) if (value && !dev->realized) { if (!obj->parent) { - static int unattached_count; gchar *name = g_strdup_printf("device[%d]", unattached_count++); object_property_add_child(container_get(qdev_get_machine(), "/unattached"), name, obj, &error_abort); + unattached_parent = true; g_free(name); } @@ -987,6 +989,10 @@ post_realize_fail: fail: error_propagate(errp, local_err); + if (unattached_parent) { + object_unparent(OBJECT(dev)); + unattached_count--; + } } static bool device_get_hotpluggable(Object *obj, Error **errp) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 9e3c70fb23..47593b741a 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1818,23 +1818,6 @@ static void pc_cpu_unplug_request_cb(HotplugHandler *hotplug_dev, goto out; } - if (idx < pcms->possible_cpus->len - 1 && - pcms->possible_cpus->cpus[idx + 1].cpu != NULL) { - X86CPU *cpu; - - for (idx = pcms->possible_cpus->len - 1; - pcms->possible_cpus->cpus[idx].cpu == NULL; idx--) { - ;; - } - - cpu = X86_CPU(pcms->possible_cpus->cpus[idx].cpu); - error_setg(&local_err, "CPU [socket-id: %u, core-id: %u," - " thread-id: %u] should be removed first", - cpu->socket_id, cpu->core_id, cpu->thread_id); - goto out; - - } - hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev); hhc->unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err); @@ -1875,6 +1858,7 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp) { int idx; + CPUState *cs; CPUArchId *cpu_slot; X86CPUTopoInfo topo; X86CPU *cpu = X86_CPU(dev); @@ -1931,23 +1915,6 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev, return; } - if (idx != 0 && pcms->possible_cpus->cpus[idx - 1].cpu == NULL) { - PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms); - - for (idx = 1; pcms->possible_cpus->cpus[idx].cpu != NULL; idx++) { - ;; - } - - x86_topo_ids_from_apicid(pcms->possible_cpus->cpus[idx].arch_id, - smp_cores, smp_threads, &topo); - - if (!pcmc->legacy_cpu_hotplug) { - error_setg(errp, "CPU [socket: %u, core: %u, thread: %u] should be" - " added first", topo.pkg_id, topo.core_id, topo.smt_id); - return; - } - } - /* if 'address' properties socket-id/core-id/thread-id are not set, set them * so that query_hotpluggable_cpus would show correct values */ @@ -1975,6 +1942,9 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev, return; } cpu->thread_id = topo.smt_id; + + cs = CPU(cpu); + cs->cpu_index = idx; } static void pc_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, |