From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:45051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rlfmh-00040e-0Z for qemu-devel@nongnu.org; Fri, 13 Jan 2012 06:59:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rlfmf-0004nK-Sy for qemu-devel@nongnu.org; Fri, 13 Jan 2012 06:59:02 -0500 Received: from goliath.siemens.de ([192.35.17.28]:33176) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rlfmf-0004nC-Fw for qemu-devel@nongnu.org; Fri, 13 Jan 2012 06:59:01 -0500 Message-ID: <4F101C7D.8070506@siemens.com> Date: Fri, 13 Jan 2012 12:58:53 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <1326453092-4256-1-git-send-email-vasilis.liaskovitis@profitbricks.com> <1326453092-4256-4-git-send-email-vasilis.liaskovitis@profitbricks.com> In-Reply-To: <1326453092-4256-4-git-send-email-vasilis.liaskovitis@profitbricks.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [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: Vasilis Liaskovitis Cc: kvm@vger.kernel.org, gleb@redhat.com, seabios@seabios.org, qemu-devel@nongnu.org, kernelfans@gmail.com, yamahata@valinux.co.jp, avi@redhat.com On 2012-01-13 12:11, Vasilis Liaskovitis wrote: > 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); That breaks in the absence of KVM or if it is not enabled. Also, where was this IOCTL introduced? Where are the linux header changes? > + if (ret) > + fprintf(stderr, "KVM_SETSTATE_VCPU failed: %s\n", > + strerror(ret)); > + } > + } > PIIX4_DPRINTF("cpuej write %x <== %d\n", addr, val); > } > Jan -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux