From patchwork Tue Mar 1 21:13:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Rosato X-Patchwork-Id: 8470171 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5BB999F8A8 for ; Tue, 1 Mar 2016 21:13:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5324A20304 for ; Tue, 1 Mar 2016 21:13:55 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9D60C202EC for ; Tue, 1 Mar 2016 21:13:54 +0000 (UTC) Received: from localhost ([::1]:52289 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aarc9-0000LC-Tg for patchwork-qemu-devel@patchwork.kernel.org; Tue, 01 Mar 2016 16:13:53 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57990) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aarbu-0000Fo-Ny for qemu-devel@nongnu.org; Tue, 01 Mar 2016 16:13:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aarbr-0002IQ-54 for qemu-devel@nongnu.org; Tue, 01 Mar 2016 16:13:38 -0500 Received: from e17.ny.us.ibm.com ([129.33.205.207]:40162) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aarbr-0002IC-1C for qemu-devel@nongnu.org; Tue, 01 Mar 2016 16:13:35 -0500 Received: from localhost by e17.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 1 Mar 2016 16:13:34 -0500 Received: from d01dlp03.pok.ibm.com (9.56.250.168) by e17.ny.us.ibm.com (146.89.104.204) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 1 Mar 2016 16:13:32 -0500 X-IBM-Helo: d01dlp03.pok.ibm.com X-IBM-MailFrom: mjrosato@linux.vnet.ibm.com X-IBM-RcptTo: qemu-devel@nongnu.org Received: from b01cxnp22034.gho.pok.ibm.com (b01cxnp22034.gho.pok.ibm.com [9.57.198.24]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id 23103C90027 for ; Tue, 1 Mar 2016 16:13:29 -0500 (EST) Received: from d01av05.pok.ibm.com (d01av05.pok.ibm.com [9.56.224.195]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u21LDWvL30408946 for ; Tue, 1 Mar 2016 21:13:32 GMT Received: from d01av05.pok.ibm.com (localhost [127.0.0.1]) by d01av05.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u21L9MSm002517 for ; Tue, 1 Mar 2016 16:09:23 -0500 Received: from rosatomj-ThinkPad-W530.endicott.ibm.com (rosatomj-thinkpad-w530.endicott.ibm.com [9.60.84.71]) by d01av05.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u21L9IYP002351; Tue, 1 Mar 2016 16:09:21 -0500 From: Matthew Rosato To: qemu-devel@nongnu.org Date: Tue, 1 Mar 2016 16:13:26 -0500 Message-Id: <1456866806-31466-7-git-send-email-mjrosato@linux.vnet.ibm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1456866806-31466-1-git-send-email-mjrosato@linux.vnet.ibm.com> References: <1456866806-31466-1-git-send-email-mjrosato@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16030121-0041-0000-0000-0000036DA5DC X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 129.33.205.207 Cc: dahi@linux.vnet.ibm.com, agraf@suse.de, borntraeger@de.ibm.com, imammedo@redhat.com, bharata@linux.vnet.ibm.com, cornelia.huck@de.ibm.com, pbonzini@redhat.com, afaerber@suse.de, rth@twiddle.net Subject: [Qemu-devel] [PATCH v7 6/6] s390x/cpu: Allow hotplug of CPUs X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Implement cpu hotplug routine and add the machine hook. Signed-off-by: Matthew Rosato Reviewed-by: David Hildenbrand --- hw/s390x/s390-virtio-ccw.c | 13 +++++++++++++ target-s390x/cpu.c | 7 +++++++ 2 files changed, 20 insertions(+) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 4886dbf..cfb2ef4 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -215,6 +215,18 @@ static HotplugHandler *s390_get_hotplug_handler(MachineState *machine, return NULL; } +static void s390_hot_add_cpu(const int64_t id, Error **errp) +{ + MachineState *machine = MACHINE(qdev_get_machine()); + Error *local_err = NULL; + + s390_new_cpu(machine, id, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } +} + static void ccw_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); @@ -223,6 +235,7 @@ static void ccw_machine_class_init(ObjectClass *oc, void *data) mc->init = ccw_init; mc->reset = s390_machine_reset; + mc->hot_add_cpu = s390_hot_add_cpu; mc->block_default_type = IF_VIRTIO; mc->no_cdrom = 1; mc->no_floppy = 1; diff --git a/target-s390x/cpu.c b/target-s390x/cpu.c index ec66ed6..6585f04 100644 --- a/target-s390x/cpu.c +++ b/target-s390x/cpu.c @@ -33,6 +33,7 @@ #include "qapi/visitor.h" #ifndef CONFIG_USER_ONLY #include "sysemu/arch_init.h" +#include "hw/s390x/sclp.h" #endif #define CR0_RESET 0xE0UL @@ -227,6 +228,12 @@ static void s390_cpu_realizefn(DeviceState *dev, Error **errp) #endif scc->parent_realize(dev, errp); + +#if !defined(CONFIG_USER_ONLY) + if (dev->hotplugged) { + raise_irq_cpu_hotplug(); + } +#endif } static void s390_cpu_get_id(Object *obj, Visitor *v, const char *name,