From patchwork Thu May 2 13:35:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 241023 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 392EC2C0077 for ; Fri, 3 May 2013 00:36:02 +1000 (EST) Received: from localhost ([::1]:48484 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXtkM-0000eB-W3 for incoming@patchwork.ozlabs.org; Thu, 02 May 2013 09:40:31 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48805) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXtg9-0002zD-U3 for qemu-devel@nongnu.org; Thu, 02 May 2013 09:36:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UXtg3-0004Vn-IB for qemu-devel@nongnu.org; Thu, 02 May 2013 09:36:09 -0400 Received: from cantor2.suse.de ([195.135.220.15]:46611 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXtg3-0004VQ-CF for qemu-devel@nongnu.org; Thu, 02 May 2013 09:36:03 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id EB67CA5591; Thu, 2 May 2013 15:36:00 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Thu, 2 May 2013 15:35:31 +0200 Message-Id: <1367501755-32272-6-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1367501755-32272-1-git-send-email-afaerber@suse.de> References: <1367501755-32272-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: Igor Mammedov , =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PATCH 05/29] cpu: Introduce CPU hot-plug notifier 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov Hot-add CPU event will be distributed to acpi_piix4 and rtc_cmos. Signed-off-by: Igor Mammedov Signed-off-by: Andreas Färber --- include/sysemu/sysemu.h | 3 +++ qom/cpu.c | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 010e412..2fb71af 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -153,6 +153,9 @@ void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict); /* generic hotplug */ void drive_hot_add(Monitor *mon, const QDict *qdict); +/* CPU hotplug */ +void qemu_register_cpu_added_notifier(Notifier *notifier); + /* pcie aer error injection */ void pcie_aer_inject_error_print(Monitor *mon, const QObject *data); int do_pcie_aer_inject_error(Monitor *mon, diff --git a/qom/cpu.c b/qom/cpu.c index b91213e..34fa805 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -21,6 +21,17 @@ #include "qom/cpu.h" #include "qemu-common.h" #include "sysemu/kvm.h" +#include "qemu/notify.h" +#include "sysemu/sysemu.h" + +/* CPU hot-plug notifiers */ +static NotifierList cpu_added_notifiers = + NOTIFIER_LIST_INITIALIZER(cpu_add_notifiers); + +void qemu_register_cpu_added_notifier(Notifier *notifier) +{ + notifier_list_add(&cpu_added_notifiers, notifier); +} void cpu_reset_interrupt(CPUState *cpu, int mask) { @@ -62,6 +73,7 @@ static void cpu_common_realizefn(DeviceState *dev, Error **errp) if (dev->hotplugged) { cpu_synchronize_post_init(cpu); + notifier_list_notify(&cpu_added_notifiers, dev); cpu_resume(cpu); } }