From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JU63N-0006Dg-UB for qemu-devel@nongnu.org; Tue, 26 Feb 2008 15:05:30 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JU63H-0006AN-5p for qemu-devel@nongnu.org; Tue, 26 Feb 2008 15:05:27 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JU63H-0006AJ-2v for qemu-devel@nongnu.org; Tue, 26 Feb 2008 15:05:23 -0500 Received: from mx1.redhat.com ([66.187.233.31]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JU63G-0001Dw-Ry for qemu-devel@nongnu.org; Tue, 26 Feb 2008 15:05:23 -0500 From: Glauber Costa Date: Tue, 26 Feb 2008 16:56:33 -0300 Message-Id: <1204055805-32349-4-git-send-email-gcosta@redhat.com> In-Reply-To: <1204055805-32349-3-git-send-email-gcosta@redhat.com> References: <1204055805-32349-1-git-send-email-gcosta@redhat.com> <1204055805-32349-2-git-send-email-gcosta@redhat.com> <1204055805-32349-3-git-send-email-gcosta@redhat.com> Subject: [Qemu-devel] [PATCH 3/15] introduce cpu_set to qemu monitor Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: kvm-devel@lists.sourceforge.net Cc: marcelo@kvack.org, glommer@gmail.com, qemu-devel@nongnu.org, Glauber Costa , chrisw@sous-sol.org in this patch, cpu_set is introduced to qemu monitor semantics is : cpu_set x online|offline. it will then tell the acpi backend to signal cpu x. Signed-off-by: Glauber Costa --- qemu/hw/acpi.c | 4 ++++ qemu/monitor.c | 16 ++++++++++++++++ qemu/sysemu.h | 3 +++ 3 files changed, 23 insertions(+), 0 deletions(-) diff --git a/qemu/hw/acpi.c b/qemu/hw/acpi.c index e21ded0..d2e2e3e 100644 --- a/qemu/hw/acpi.c +++ b/qemu/hw/acpi.c @@ -533,3 +533,7 @@ void qemu_system_powerdown(void) } } #endif + +void qemu_system_cpu_hot_add(int cpu, int state) +{ +} diff --git a/qemu/monitor.c b/qemu/monitor.c index e8022c8..09f84a9 100644 --- a/qemu/monitor.c +++ b/qemu/monitor.c @@ -345,6 +345,21 @@ static void do_cpu_set(int index) term_printf("Invalid CPU index\n"); } +static void do_cpu_set_nr(int value, const char *status) +{ + int state; + + if (!strcmp(status, "online")) + state = 1; + else if (!strcmp(status, "offline")) + state = 0; + else { + term_printf("invalid status: %s\n", status); + return; + } + qemu_system_cpu_hot_add(value, state); +} + static void do_info_jit(void) { dump_exec_info(NULL, monitor_fprintf); @@ -1338,6 +1353,7 @@ #endif "", "cancel the current VM migration" }, { "migrate_set_speed", "s", do_migrate_set_speed, "value", "set maximum speed (in bytes) for migrations" }, + { "cpu_set", "is", do_cpu_set_nr, "cpu [online|offline]", "change cpu state" }, { NULL, NULL, }, }; diff --git a/qemu/sysemu.h b/qemu/sysemu.h index ffc468a..fe929b4 100644 --- a/qemu/sysemu.h +++ b/qemu/sysemu.h @@ -153,6 +153,9 @@ int extboot_drive; extern int drive_get_index(BlockInterfaceType type, int bus, int unit); extern int drive_get_max_bus(BlockInterfaceType type); +/* acpi */ +void qemu_system_cpu_hot_add(int cpu, int state); + /* vmchannel devices */ #define MAX_VMCHANNEL_DEVICES 4 -- 1.4.2