From nobody Tue Feb 10 16:18:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1495539569633993.928727307462; Tue, 23 May 2017 04:39:29 -0700 (PDT) Received: from localhost ([::1]:47863 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dD89w-0004z0-CF for importer@patchew.org; Tue, 23 May 2017 07:39:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45308) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dD7pY-0003nL-2I for qemu-devel@nongnu.org; Tue, 23 May 2017 07:18:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dD7pX-0006Cr-8B for qemu-devel@nongnu.org; Tue, 23 May 2017 07:18:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60962) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dD7pX-0006CE-2C; Tue, 23 May 2017 07:18:23 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 120373B73F; Tue, 23 May 2017 11:18:22 +0000 (UTC) Received: from thinkpad.redhat.com (ovpn-116-216.ams2.redhat.com [10.36.116.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7C31377DCC; Tue, 23 May 2017 11:18:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 120373B73F Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lvivier@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 120373B73F From: Laurent Vivier To: David Gibson Date: Tue, 23 May 2017 13:18:11 +0200 Message-Id: <20170523111812.13469-4-lvivier@redhat.com> In-Reply-To: <20170523111812.13469-1-lvivier@redhat.com> References: <20170523111812.13469-1-lvivier@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 23 May 2017 11:18:22 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 3/4] spapr: disable hotplugging without OS X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Thomas Huth , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, Michael Roth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" If the OS is not started, QEMU sends an event to the OS that is lost and cannot be recovered. An unplug is not able to restore QEMU in a coherent state. So, while the OS is not started, disable CPU and memory hotplug. We use option vector 6 to know if the OS is started Signed-off-by: Laurent Vivier --- hw/ppc/spapr.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index eceb4cc..2e9320d 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2625,6 +2625,7 @@ out: static void spapr_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState= *dev, Error **errp) { + sPAPRMachineState *ms =3D SPAPR_MACHINE(hotplug_dev); PCDIMMDevice *dimm =3D PC_DIMM(dev); PCDIMMDeviceClass *ddc =3D PC_DIMM_GET_CLASS(dimm); MemoryRegion *mr =3D ddc->get_memory_region(dimm); @@ -2645,6 +2646,13 @@ static void spapr_memory_pre_plug(HotplugHandler *ho= tplug_dev, DeviceState *dev, goto out; } =20 + if (dev->hotplugged) { + if (!ms->os_name) { + error_setg(&local_err, "Memory hotplug not supported without O= S"); + goto out; + } + } + out: error_propagate(errp, local_err); } @@ -2874,6 +2882,7 @@ static void spapr_core_pre_plug(HotplugHandler *hotpl= ug_dev, DeviceState *dev, Error **errp) { MachineState *machine =3D MACHINE(OBJECT(hotplug_dev)); + sPAPRMachineState *ms =3D SPAPR_MACHINE(machine); MachineClass *mc =3D MACHINE_GET_CLASS(hotplug_dev); Error *local_err =3D NULL; CPUCore *cc =3D CPU_CORE(dev); @@ -2884,9 +2893,16 @@ static void spapr_core_pre_plug(HotplugHandler *hotp= lug_dev, DeviceState *dev, int node_id; int index; =20 - if (dev->hotplugged && !mc->has_hotpluggable_cpus) { - error_setg(&local_err, "CPU hotplug not supported for this machine= "); - goto out; + if (dev->hotplugged) { + if (!mc->has_hotpluggable_cpus) { + error_setg(&local_err, + "CPU hotplug not supported for this machine"); + goto out; + } + if (!ms->os_name) { + error_setg(&local_err, "CPU hotplug not supported without OS"); + goto out; + } } =20 if (strcmp(base_core_type, type)) { --=20 2.9.4