summary refs log tree commit diff stats
path: root/hw/i386/pc.c
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2016-07-18 10:31:22 +0200
committerEduardo Habkost <ehabkost@redhat.com>2016-07-20 12:02:19 -0300
commit73360e27850b213327011f7e22e03865b8c0dd5b (patch)
treeff91a4446ee4faab1004f909a272941cfbb70c5a /hw/i386/pc.c
parenta44a49dbf2eb8b9b430711b152663678c15f689c (diff)
downloadfocaccia-qemu-73360e27850b213327011f7e22e03865b8c0dd5b.tar.gz
focaccia-qemu-73360e27850b213327011f7e22e03865b8c0dd5b.zip
pc: Forbid BSP removal
Boot CPU is assumed to always present in QEMU code, so
untile that assumptions are gone, deny removal request,
In another words QEMU won't support BSP hot-unplug.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'hw/i386/pc.c')
-rw-r--r--hw/i386/pc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index f4c6a27508..dd5661a72d 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1803,10 +1803,18 @@ out:
 static void pc_cpu_unplug_request_cb(HotplugHandler *hotplug_dev,
                                      DeviceState *dev, Error **errp)
 {
+    int idx = -1;
     HotplugHandlerClass *hhc;
     Error *local_err = NULL;
     PCMachineState *pcms = PC_MACHINE(hotplug_dev);
 
+    pc_find_cpu_slot(pcms, CPU(dev), &idx);
+    assert(idx != -1);
+    if (idx == 0) {
+        error_setg(&local_err, "Boot CPU is unpluggable");
+        goto out;
+    }
+
     hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev);
     hhc->unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);