From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53778) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBIf7-0006KD-FW for qemu-devel@nongnu.org; Wed, 14 Jan 2015 02:46:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YBIf4-00044O-76 for qemu-devel@nongnu.org; Wed, 14 Jan 2015 02:46:45 -0500 Received: from [59.151.112.132] (port=6743 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBIf3-0003xh-P4 for qemu-devel@nongnu.org; Wed, 14 Jan 2015 02:46:42 -0500 From: Zhu Guihua Date: Wed, 14 Jan 2015 15:44:59 +0800 Message-ID: <2ef6a594455f5a02fbaf58ecf03cbf1688b6c441.1421214664.git.zhugh.fnst@cn.fujitsu.com> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH v2 06/11] acpi/cpu: add cpu hot unplug callback function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Zhu Guihua , tangchen@cn.fujitsu.com, guz.fnst@cn.fujitsu.com, isimatu.yasuaki@jp.fujitsu.com, anshul.makkar@profitbricks.com, chen.fan.fnst@cn.fujitsu.com, imammedo@redhat.com, afaerber@suse.de Signed-off-by: Zhu Guihua Signed-off-by: Gu Zheng --- 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(+) diff --git a/cpus.c b/cpus.c index d5e35c0..1c25054 100644 --- a/cpus.c +++ b/cpus.c @@ -1205,6 +1205,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.9.3