]> xenbits.xensource.com Git - people/aperard/qemu-dm.git/commitdiff
cpu: Introduce CPU hot-plug notifier
authorIgor Mammedov <imammedo@redhat.com>
Tue, 23 Apr 2013 08:29:39 +0000 (10:29 +0200)
committerAnthony PERARD <anthony.perard@citrix.com>
Mon, 8 Jul 2013 20:51:14 +0000 (21:51 +0100)
Hot-add CPU event will be distributed to acpi_piix4 and rtc_cmos.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
(cherry picked from commit 066e9b2710be887f435e0e899fa71f1f4314f702)

qom/cpu.c
sysemu.h

index a9dfa9b4385946be3fb6353aa69100d39fe6b7f8..b6ed77e888ff6799b23aa02fbd5260c8d9c1b2ec 100644 (file)
--- a/qom/cpu.c
+++ b/qom/cpu.c
 
 #include "qemu/cpu.h"
 #include "qemu-common.h"
+#include "notify.h"
+#include "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(CPUState *cpu)
 {
@@ -46,6 +57,7 @@ static void cpu_common_realizefn(DeviceState *dev, Error **errp)
     CPUState *cpu = CPU(dev);
 
     if (dev->hotplugged) {
+        notifier_list_notify(&cpu_added_notifiers, dev);
         cpu_resume(cpu);
     }
 }
index f5ac6640677ee421d64986524e637ebaad84e0c2..8146c3dddd3f33650d4500ea6feed05ee66f189d 100644 (file)
--- a/sysemu.h
+++ b/sysemu.h
@@ -152,6 +152,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,