public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: kvm-devel <kvm@vger.kernel.org>
Cc: "Yang, Sheng" <sheng.yang@intel.com>, Avi Kivity <avi@qumranet.com>
Subject: [PATCH 4/9] VMX: fix real-mode NMI support
Date: Fri, 19 Sep 2008 14:02:08 +0200	[thread overview]
Message-ID: <48D394C0.20708@siemens.com> (raw)
In-Reply-To: <48D392F2.300@siemens.com>

Fix NMI injection in real-mode with the same pattern we perform IRQ
injection.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 arch/x86/kvm/vmx.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

Index: b/arch/x86/kvm/vmx.c
===================================================================
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2354,6 +2354,19 @@ static void vmx_inject_irq(struct kvm_vc
 
 static void vmx_inject_nmi(struct kvm_vcpu *vcpu)
 {
+	struct vcpu_vmx *vmx = to_vmx(vcpu);
+
+	if (vcpu->arch.rmode.active) {
+		vmx->rmode.irq.pending = true;
+		vmx->rmode.irq.vector = NMI_VECTOR;
+		vmx->rmode.irq.rip = kvm_rip_read(vcpu);
+		vmcs_write32(VM_ENTRY_INTR_INFO_FIELD,
+			     NMI_VECTOR | INTR_TYPE_SOFT_INTR |
+			     INTR_INFO_VALID_MASK);
+		vmcs_write32(VM_ENTRY_INSTRUCTION_LEN, 1);
+		kvm_rip_write(vcpu, vmx->rmode.irq.rip - 1);
+		return;
+	}
 	vmcs_write32(VM_ENTRY_INTR_INFO_FIELD,
 			INTR_TYPE_NMI_INTR | INTR_INFO_VALID_MASK | NMI_VECTOR);
 }


  parent reply	other threads:[~2008-09-19 12:08 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-19 12:06 [PATCH 0/9] Enhance NMI support of KVM - v2 Jan Kiszka
2008-09-19 11:59 ` [PATCH 1/9] VMX: include all IRQ window exits in statistics Jan Kiszka
2008-09-19 12:01 ` [PATCH 2/9] VMX: refactor/fix IRQ and NMI injectability determination Jan Kiszka
2008-09-19 12:01 ` [PATCH 3/9] VMX: refactor IRQ and NMI window enabling Jan Kiszka
2008-09-19 12:02 ` Jan Kiszka [this message]
2008-09-19 12:03 ` [PATCH 5/9] kvm-x86: Enable NMI Watchdog via in-kernel PIT source Jan Kiszka
2008-09-19 16:55   ` Jan Kiszka
2008-09-23  6:10   ` Yang, Sheng
2008-09-23 15:04     ` Jan Kiszka
2008-09-24 10:18       ` Yang, Sheng
2008-09-19 12:03 ` [PATCH 6/9] kvm-x86: Support for user space injected NMIs Jan Kiszka
2008-09-19 12:03 ` [PATCH 7/9] VMX: Provide support " Jan Kiszka
2008-09-19 12:04 ` [PATCH 8/9] VMX: work around lacking VNMI support Jan Kiszka
2008-09-21 14:31   ` Gleb Natapov
2008-09-21 16:57     ` Jan Kiszka
2008-09-21 18:08       ` Jan Kiszka
2008-09-22  6:41       ` Gleb Natapov
2008-09-22  7:19         ` Jan Kiszka
2008-09-22  7:39           ` Gleb Natapov
2008-09-22  7:48             ` Jan Kiszka
2008-09-19 12:05 ` [PATCH 9/9] kvm: Enable NMI support for userspace irqchip Jan Kiszka
2008-09-19 12:10 ` [PATCH 0/9] Enhance NMI support of KVM - v2 Jan Kiszka

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=48D394C0.20708@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=avi@qumranet.com \
    --cc=kvm@vger.kernel.org \
    --cc=sheng.yang@intel.com \
    /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