qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 07/12] acpi/cpu: add cpu hot unplug callback functio


From: Gu Zheng
Subject: [Qemu-devel] [PATCH 07/12] acpi/cpu: add cpu hot unplug callback function
Date: Fri, 12 Dec 2014 16:43:13 +0800

From: Zhu Guihua <address@hidden>

Signed-off-by: Zhu Guihua <address@hidden>
Signed-off-by: Gu Zheng <address@hidden>
---
 cpus.c                        |    7 +++++++
 hw/acpi/cpu_hotplug.c         |    8 ++++++++
 include/hw/acpi/cpu_hotplug.h |    3 +++
 include/qom/cpu.h             |    9 +++++++++
 4 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/cpus.c b/cpus.c
index 849d1bf..e3c8b88 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1196,6 +1196,13 @@ void resume_all_vcpus(void)
     }
 }
 
+void cpu_remove(CPUState *cpu)
+{
+    cpu->stop = true;
+    cpu->exit = true;
+    qemu_cpu_kick(cpu);
+}
+
 /* For temporary buffers for forming a name */
 #define VCPU_THREAD_NAME_SIZE 16
 
diff --git a/hw/acpi/cpu_hotplug.c b/hw/acpi/cpu_hotplug.c
index f8a10d2..36feb6a 100644
--- a/hw/acpi/cpu_hotplug.c
+++ b/hw/acpi/cpu_hotplug.c
@@ -94,6 +94,14 @@ void acpi_cpu_unplug_request_cb(ACPIREGS *ar, qemu_irq irq,
     acpi_update_sci(ar, irq);
 }
 
+void acpi_cpu_unplug_cb(ACPIREGS *ar, qemu_irq irq, AcpiCpuHotplug *g,
+                        DeviceState *dev, Error **errp)
+{
+    CPUState *cpu = CPU(dev);
+
+    cpu_remove(cpu);
+}
+
 void acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner,
                            AcpiCpuHotplug *gpe_cpu, uint16_t base)
 {
diff --git a/include/hw/acpi/cpu_hotplug.h b/include/hw/acpi/cpu_hotplug.h
index 8b15a3d..0f84adb 100644
--- a/include/hw/acpi/cpu_hotplug.h
+++ b/include/hw/acpi/cpu_hotplug.h
@@ -27,6 +27,9 @@ void acpi_cpu_unplug_request_cb(ACPIREGS *ar, qemu_irq irq,
                                 AcpiCpuHotplug *g, DeviceState *dev,
                                 Error **errp);
 
+void acpi_cpu_unplug_cb(ACPIREGS *ar, qemu_irq irq,
+                        AcpiCpuHotplug *g, DeviceState *dev, Error **errp);
+
 void acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner,
                            AcpiCpuHotplug *gpe_cpu, uint16_t base);
 #endif
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index f663199..0592b4d 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -249,6 +249,7 @@ struct CPUState {
     bool created;
     bool stop;
     bool stopped;
+    bool exit;
     volatile sig_atomic_t exit_request;
     uint32_t interrupt_request;
     int singlestep_enabled;
@@ -613,6 +614,14 @@ void cpu_exit(CPUState *cpu);
 void cpu_resume(CPUState *cpu);
 
 /**
+ * cpu_remove:
+ * @cpu: The vCPU to remove.
+ *
+ * Requests the CPU @cpu to be removed.
+ */
+void cpu_remove(CPUState *cpu);
+
+/**
  * qemu_init_vcpu:
  * @cpu: The vCPU to initialize.
  *
-- 
1.7.7




reply via email to

[Prev in Thread] Current Thread [Next in Thread]