From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Avi Kivity <avi@redhat.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [PATCH V2] qemu, kvm: Enable user space NMI injection for kvm guest
Date: Fri, 10 Dec 2010 15:42:53 +0800 [thread overview]
Message-ID: <4D01D9FD.8020801@cn.fujitsu.com> (raw)
In-Reply-To: <4D00845F.9000503@siemens.com>
Make use of the new KVM_NMI IOCTL to send NMIs into the KVM guest if the
user space raised them. (example: qemu monitor's "nmi" command)
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
diff --git a/configure b/configure
index 2917874..f6f9362 100755
--- a/configure
+++ b/configure
@@ -1646,6 +1646,9 @@ if test "$kvm" != "no" ; then
#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
#endif
+#if !defined(KVM_CAP_USER_NMI)
+#error Missing KVM capability KVM_CAP_USER_NMI
+#endif
int main(void) { return 0; }
EOF
if test "$kerneldir" != "" ; then
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 7dfc357..755f8c9 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -1417,6 +1417,13 @@ int kvm_arch_get_registers(CPUState *env)
int kvm_arch_pre_run(CPUState *env, struct kvm_run *run)
{
+ /* Inject NMI */
+ if (env->interrupt_request & CPU_INTERRUPT_NMI) {
+ env->interrupt_request &= ~CPU_INTERRUPT_NMI;
+ DPRINTF("injected NMI\n");
+ kvm_vcpu_ioctl(env, KVM_NMI);
+ }
+
/* Try to inject an interrupt if the guest can accept it */
if (run->ready_for_interrupt_injection &&
(env->interrupt_request & CPU_INTERRUPT_HARD) &&
next prev parent reply other threads:[~2010-12-10 7:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-09 6:58 [Qemu-devel] [PATCH 1/6] qemu, kvm: Enable NMI support for user space irqchip Lai Jiangshan
2010-12-09 7:25 ` [Qemu-devel] " Jan Kiszka
2010-12-10 3:17 ` Lai Jiangshan
2010-12-10 7:42 ` Lai Jiangshan [this message]
2010-12-10 8:41 ` [Qemu-devel] Re: [PATCH V2] qemu, kvm: Enable user space NMI injection for kvm guest Jan Kiszka
2010-12-13 8:43 ` Lai Jiangshan
2010-12-20 2:41 ` Lai Jiangshan
2010-12-20 10:35 ` Marcelo Tosatti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D01D9FD.8020801@cn.fujitsu.com \
--to=laijs@cn.fujitsu.com \
--cc=avi@redhat.com \
--cc=jan.kiszka@siemens.com \
--cc=kvm@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).