[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
- [Qemu-devel] [PATCH 00/12] cpu: add i386 cpu hot remove support, Gu Zheng, 2014/12/12
- [Qemu-devel] [PATCH 01/12] x86: add x86_cpu_unrealizefn() for cpu apic remove, Gu Zheng, 2014/12/12
- [Qemu-devel] [PATCH 03/12] acpi/cpu: add cpu hot unplug request callback function, Gu Zheng, 2014/12/12
- [Qemu-devel] [PATCH 02/12] i386/cpu: add instance finalize callback, Gu Zheng, 2014/12/12
- [Qemu-devel] [PATCH 05/12] acpi/ich9: add cpu hot unplug request callback support, Gu Zheng, 2014/12/12
- [Qemu-devel] [PATCH 06/12] pc: add cpu hot unplug request callback support, Gu Zheng, 2014/12/12
- [Qemu-devel] [PATCH 04/12] acpi/piix4: add cpu hot unplug request callback support, Gu Zheng, 2014/12/12
- [Qemu-devel] [PATCH 07/12] acpi/cpu: add cpu hot unplug callback function,
Gu Zheng <=
- [Qemu-devel] [PATCH 08/12] acpi/piix4: add cpu hot unplug callback support, Gu Zheng, 2014/12/12
- [Qemu-devel] [PATCH 09/12] acpi/ich9: add cpu hot unplug support, Gu Zheng, 2014/12/12
- [Qemu-devel] [PATCH 10/12] pc: add cpu hot unplug callback support, Gu Zheng, 2014/12/12
- [Qemu-devel] [PATCH 11/12] cpu hotplug: implement function cpu_status_write() for vcpu ejection, Gu Zheng, 2014/12/12
- [Qemu-devel] [PATCH 12/12] cpus: reclaim allocated vCPU objects, Gu Zheng, 2014/12/12
- Re: [Qemu-devel] [PATCH 00/12] cpu: add i386 cpu hot remove support, Gu Zheng, 2014/12/19