[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC qom-cpu v4 07/10] qom cpu: add UNPLUG cpu notifier sup
From: |
Chen Fan |
Subject: |
[Qemu-devel] [RFC qom-cpu v4 07/10] qom cpu: add UNPLUG cpu notifier support |
Date: |
Wed, 9 Oct 2013 17:43:15 +0800 |
Move struct HotplugEventType from file piix4.c to file qom/cpu.c,
and add struct CPUNotifier for supporting UNPLUG cpu notifier.
Signed-off-by: Chen Fan <address@hidden>
---
hw/acpi/piix4.c | 8 ++------
include/qom/cpu.h | 10 ++++++++++
qom/cpu.c | 6 +++++-
3 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 06f55d6..dc506bf 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -636,11 +636,6 @@ static const MemoryRegionOps cpu_hotplug_ops = {
},
};
-typedef enum {
- PLUG,
- UNPLUG,
-} HotplugEventType;
-
static void piix4_cpu_hotplug_req(PIIX4PMState *s, CPUState *cpu,
HotplugEventType action)
{
@@ -664,8 +659,9 @@ static void piix4_cpu_hotplug_req(PIIX4PMState *s, CPUState
*cpu,
static void piix4_cpu_hotplug(Notifier *n, void *opaque)
{
PIIX4PMState *s = container_of(n, PIIX4PMState, cpu_hotplug_notifier);
+ CPUNotifier *notifier = opaque;
- piix4_cpu_hotplug_req(s, CPU(opaque), PLUG);
+ piix4_cpu_hotplug_req(s, CPU(notifier->dev), notifier->type);
}
static int piix4_device_hotplug(DeviceState *qdev, PCIDevice *dev,
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 7739e00..0238532 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -507,6 +507,16 @@ void qemu_init_vcpu(CPUState *cpu);
*/
void cpu_single_step(CPUState *cpu, int enabled);
+typedef enum {
+ PLUG,
+ UNPLUG,
+} HotplugEventType;
+
+typedef struct CPUNotifier {
+ DeviceState *dev;
+ HotplugEventType type;
+} CPUNotifier;
+
#ifdef CONFIG_SOFTMMU
extern const struct VMStateDescription vmstate_cpu_common;
#else
diff --git a/qom/cpu.c b/qom/cpu.c
index 0913c9c..d20783b 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -216,10 +216,14 @@ static ObjectClass *cpu_common_class_by_name(const char
*cpu_model)
static void cpu_common_realizefn(DeviceState *dev, Error **errp)
{
CPUState *cpu = CPU(dev);
+ CPUNotifier notifier;
+
+ notifier.dev = dev;
+ notifier.type = PLUG;
if (dev->hotplugged) {
cpu_synchronize_post_init(cpu);
- notifier_list_notify(&cpu_hotplug_notifiers, dev);
+ notifier_list_notify(&cpu_hotplug_notifiers, ¬ifier);
cpu_resume(cpu);
}
}
--
1.8.1.4
- [Qemu-devel] [RFC qom-cpu v4 00/10] i386: add cpu hot remove support, Chen Fan, 2013/10/09
- [Qemu-devel] [RFC qom-cpu v4 02/10] apic: remove redundant variable 'apic_no' from apic_init_common(), Chen Fan, 2013/10/09
- [Qemu-devel] [RFC qom-cpu v4 04/10] x86: add x86_cpu_unrealizefn() for cpu apic remove, Chen Fan, 2013/10/09
- [Qemu-devel] [RFC qom-cpu v4 01/10] x86: move apic_state field from CPUX86State to X86CPU, Chen Fan, 2013/10/09
- [Qemu-devel] [RFC qom-cpu v4 03/10] apic: remove local_apics array and using CPU_FOREACH instead, Chen Fan, 2013/10/09
- [Qemu-devel] [RFC qom-cpu v4 05/10] qmp: add 'cpu-del' command support, Chen Fan, 2013/10/09
- [Qemu-devel] [RFC qom-cpu v4 07/10] qom cpu: add UNPLUG cpu notifier support,
Chen Fan <=
- [Qemu-devel] [RFC qom-cpu v4 08/10] i386: implement pc interface pc_hot_del_cpu(), Chen Fan, 2013/10/09
- [Qemu-devel] [RFC qom-cpu v4 09/10] piix4: implement function cpu_status_write() for vcpu ejection, Chen Fan, 2013/10/09
- [Qemu-devel] [RFC qom-cpu v4 10/10] cpus: reclaim allocated vCPU objects, Chen Fan, 2013/10/09
- [Qemu-devel] [RFC qom-cpu v4 06/10] qom cpu: rename variable 'cpu_added_notifier' to 'cpu_hotplug_notifier', Chen Fan, 2013/10/09