Received: from eggs.gnu.org ([2001:4830:134:3::10]:39199) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPt7w-0005dC-6V for qemu-devel@nongnu.org; Wed, 20 Jul 2016 11:09:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPt7r-0004IH-BH for qemu-devel@nongnu.org; Wed, 20 Jul 2016 11:09:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43730) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPt7r-0004IC-5J for qemu-devel@nongnu.org; Wed, 20 Jul 2016 11:09:31 -0400 From: Eduardo Habkost Date: Wed, 20 Jul 2016 12:08:24 -0300 Message-Id: <1469027314-31655-19-git-send-email-ehabkost@redhat.com> In-Reply-To: <1469027314-31655-1-git-send-email-ehabkost@redhat.com> References: <1469027314-31655-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PULL 18/28] pc: Forbid BSP removal List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Paolo Bonzini , Richard Henderson , qemu-devel@nongnu.org, Igor Mammedov From: Igor Mammedov 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 Reviewed-by: Michael S. Tsirkin Signed-off-by: Eduardo Habkost --- hw/i386/pc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index f4c6a27..dd5661a 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); -- 2.5.5