From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:49685) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rlf32-0006cs-Ky for qemu-devel@nongnu.org; Fri, 13 Jan 2012 06:11:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rlf2w-00040F-3g for qemu-devel@nongnu.org; Fri, 13 Jan 2012 06:11:52 -0500 Received: from mail-ey0-f173.google.com ([209.85.215.173]:47918) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rlf2v-0003yz-UN for qemu-devel@nongnu.org; Fri, 13 Jan 2012 06:11:46 -0500 Received: by mail-ey0-f173.google.com with SMTP id n12so135212eaa.4 for ; Fri, 13 Jan 2012 03:11:45 -0800 (PST) From: Vasilis Liaskovitis Date: Fri, 13 Jan 2012 12:11:32 +0100 Message-Id: <1326453092-4256-4-git-send-email-vasilis.liaskovitis@profitbricks.com> In-Reply-To: <1326453092-4256-1-git-send-email-vasilis.liaskovitis@profitbricks.com> References: <1326453092-4256-1-git-send-email-vasilis.liaskovitis@profitbricks.com> Subject: [Qemu-devel] [PATCH 3/3] acpi_piix4: Call KVM_SETSTATE_VCPU ioctl on cpu ejection List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: kvm@vger.kernel.org, qemu-devel@nongnu.org, seabios@seabios.org Cc: Vasilis Liaskovitis , yamahata@valinux.co.jp, gleb@redhat.com, kernelfans@gmail.com, avi@redhat.com Signed-off-by: Vasilis Liaskovitis --- hw/acpi_piix4.c | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c index 8bf30dd..12eef55 100644 --- a/hw/acpi_piix4.c +++ b/hw/acpi_piix4.c @@ -502,6 +502,27 @@ static uint32_t cpuej_read(void *opaque, uint32_t addr) static void cpuej_write(void *opaque, uint32_t addr, uint32_t val) { + struct kvm_vcpu_state state; + CPUState *env; + int cpu; + int ret; + + cpu = ffs(val); + /* zero means no bit was set, i.e. no CPU ejection happened */ + if (!cpu) + return; + cpu--; + env = cpu_phyid_to_cpu((uint64_t)cpu); + if (env != NULL) { + if (env->state == CPU_STATE_ZAPREQ) { + state.vcpu_id = env->cpu_index; + state.state = 1; + ret = kvm_vm_ioctl(env->kvm_state, KVM_SETSTATE_VCPU, &state); + if (ret) + fprintf(stderr, "KVM_SETSTATE_VCPU failed: %s\n", + strerror(ret)); + } + } PIIX4_DPRINTF("cpuej write %x <== %d\n", addr, val); } -- 1.7.7.3