From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=39798 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQtR7-0007h5-W7 for qemu-devel@nongnu.org; Thu, 09 Dec 2010 22:14:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PQtQv-00053u-Eo for qemu-devel@nongnu.org; Thu, 09 Dec 2010 22:14:16 -0500 Received: from [222.73.24.84] (port=52174 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PQtQu-00051V-Vz for qemu-devel@nongnu.org; Thu, 09 Dec 2010 22:14:09 -0500 Message-ID: <4D019BBA.9070806@cn.fujitsu.com> Date: Fri, 10 Dec 2010 11:17:14 +0800 From: Lai Jiangshan MIME-Version: 1.0 References: <4D007E2C.4070308@cn.fujitsu.com> <4D00845F.9000503@siemens.com> In-Reply-To: <4D00845F.9000503@siemens.com> Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=UTF-8 Subject: [Qemu-devel] Re: [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 Cc: Avi Kivity , "kvm@vger.kernel.org" , "qemu-devel@nongnu.org" On 12/09/2010 03:25 PM, Jan Kiszka wrote: > Am 09.12.2010 07:58, Lai Jiangshan wrote: >> >> 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. > > In that light, the subject is not absolutely correct. > [...] > > Actually, we already depend on KVM_CAP_DESTROY_MEMORY_REGION_WORKS which > was introduced with 2.6.29 as well. I would suggest to simply extend the > static configure check and avoid new #ifdefs in the code. > > Thanks for pushing this! Was obviously so trivial that it was forgotten... > Thanks. We want to inject nmi to kvm guest via qemu monitor, that's this path's purpose. But I can't get you means, what I should do to fix this patch? Just remove the #ifdefs OR use kvm_check_extension(KVM_CAP_USER_NMI) ? + static int can_user_nmi = -1; + + if (can_user_nmi == -1) + can_user_nmi = kvm_check_extension(kvm_state, KVM_CAP_USER_NMI); + + if (can_user_nmi > 0 && env->interrupt_request & CPU_INTERRUPT_NMI) { + env->interrupt_request &= ~CPU_INTERRUPT_NMI; + DPRINTF("injected NMI\n"); + kvm_vcpu_ioctl(env, KVM_NMI); + } Thanks, Lai