From: Jan Kiszka <jan.kiszka@siemens.com>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Avi Kivity <avi@redhat.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [PATCH V2] qemu,kvm: Enable user space NMI injection for kvm guest
Date: Fri, 10 Dec 2010 09:41:23 +0100 [thread overview]
Message-ID: <4D01E7B3.30400@siemens.com> (raw)
In-Reply-To: <4D01D9FD.8020801@cn.fujitsu.com>
Am 10.12.2010 08:42, Lai Jiangshan wrote:
>
> 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
That's what I meant.
We also have a runtime check for KVM_CAP_DESTROY_MEMORY_REGION_WORKS on
kvm init, but IMHO adding the same for KVM_CAP_USER_NMI would be
overkill. So...
> 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) &&
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
next prev parent reply other threads:[~2010-12-10 8:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-09 6:58 [PATCH 1/6] qemu,kvm: Enable NMI support for user space irqchip Lai Jiangshan
2010-12-09 7:25 ` Jan Kiszka
2010-12-10 3:17 ` Lai Jiangshan
2010-12-10 7:42 ` [PATCH V2] qemu,kvm: Enable user space NMI injection for kvm guest Lai Jiangshan
2010-12-10 8:41 ` Jan Kiszka [this message]
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=4D01E7B3.30400@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=laijs@cn.fujitsu.com \
--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