]> Git Repo - qemu.git/commitdiff
cpu: Introduce CPU hot-plug notifier
authorIgor Mammedov <[email protected]>
Tue, 23 Apr 2013 08:29:39 +0000 (10:29 +0200)
committerAndreas Färber <[email protected]>
Wed, 1 May 2013 11:04:17 +0000 (13:04 +0200)
Hot-add CPU event will be distributed to acpi_piix4 and rtc_cmos.

Signed-off-by: Igor Mammedov <[email protected]>
Signed-off-by: Andreas Färber <[email protected]>
include/sysemu/sysemu.h
qom/cpu.c

index 010e412f0c225fce96a49a524b45f15058d5a88c..2fb71afa259acbcf075b92c4290ee9e6982a4614 100644 (file)
@@ -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,
index b91213e6b1c407e35fdff6f48ecb0c34507d8df9..34fa8054b293868865e4ae24ab03c2605a713a26 100644 (file)
--- a/qom/cpu.c
+++ b/qom/cpu.c
 #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);
     }
 }
This page took 0.02837 seconds and 4 git commands to generate.