From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lai Jiangshan Subject: [PATCH 1/6] qemu,kvm: Enable NMI support for user space irqchip Date: Thu, 09 Dec 2010 14:58:52 +0800 Message-ID: <4D007E2C.4070308@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit To: Jan Kiszka , Avi Kivity , qemu-devel@nongnu.org, kvm@vger.kernel.org Return-path: Received: from cn.fujitsu.com ([222.73.24.84]:51973 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1754849Ab0LIGzz (ORCPT ); Thu, 9 Dec 2010 01:55:55 -0500 Sender: kvm-owner@vger.kernel.org List-ID: Make use of the new KVM_NMI IOCTL to send NMIs into the KVM guest if the user space APIC emulation or some other source raised them. Signed-off-by: Lai Jiangshan --- diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 7dfc357..c4ebe28 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -1417,6 +1417,14 @@ int kvm_arch_get_registers(CPUState *env) int kvm_arch_pre_run(CPUState *env, struct kvm_run *run) { +#ifdef KVM_CAP_USER_NMI + if (env->interrupt_request & CPU_INTERRUPT_NMI) { + env->interrupt_request &= ~CPU_INTERRUPT_NMI; + DPRINTF("injected NMI\n"); + kvm_vcpu_ioctl(env, KVM_NMI); + } +#endif + /* Try to inject an interrupt if the guest can accept it */ if (run->ready_for_interrupt_injection && (env->interrupt_request & CPU_INTERRUPT_HARD) && From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=52766 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQaQE-0007Lf-ND for qemu-devel@nongnu.org; Thu, 09 Dec 2010 01:56:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PQaQB-0008VU-Be for qemu-devel@nongnu.org; Thu, 09 Dec 2010 01:56:08 -0500 Received: from [222.73.24.84] (port=60401 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PQaQA-0008SY-NO for qemu-devel@nongnu.org; Thu, 09 Dec 2010 01:56:07 -0500 Message-ID: <4D007E2C.4070308@cn.fujitsu.com> Date: Thu, 09 Dec 2010 14:58:52 +0800 From: Lai Jiangshan MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=UTF-8 Subject: [Qemu-devel] [PATCH 1/6] qemu, kvm: Enable NMI support for user space irqchip List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka , Avi Kivity , qemu-devel@nongnu.org, kvm@vger.kernel.org Make use of the new KVM_NMI IOCTL to send NMIs into the KVM guest if the user space APIC emulation or some other source raised them. Signed-off-by: Lai Jiangshan --- diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 7dfc357..c4ebe28 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -1417,6 +1417,14 @@ int kvm_arch_get_registers(CPUState *env) int kvm_arch_pre_run(CPUState *env, struct kvm_run *run) { +#ifdef KVM_CAP_USER_NMI + if (env->interrupt_request & CPU_INTERRUPT_NMI) { + env->interrupt_request &= ~CPU_INTERRUPT_NMI; + DPRINTF("injected NMI\n"); + kvm_vcpu_ioctl(env, KVM_NMI); + } +#endif + /* Try to inject an interrupt if the guest can accept it */ if (run->ready_for_interrupt_injection && (env->interrupt_request & CPU_INTERRUPT_HARD) &&