From: Avi Kivity <avi@redhat.com>
To: kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Alexander Graf <agraf@suse.de>
Subject: [PATCH 01/40] KVM: SVM: Clean up VINTR setting
Date: Thu, 26 Feb 2009 16:14:51 +0200 [thread overview]
Message-ID: <1235657730-27683-2-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1235657730-27683-1-git-send-email-avi@redhat.com>
From: Alexander Graf <agraf@suse.de>
The current VINTR intercept setters don't look clean to me. To make
the code easier to read and enable the possibilty to trap on a VINTR
set, this uses a helper function to set the VINTR intercept.
v2 uses two distinct functions for setting and clearing the bit
Acked-by: Joerg Roedel <joro@8bytes.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
---
arch/x86/kvm/svm.c | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index a9e769e..33407d9 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -718,6 +718,16 @@ static void svm_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags)
to_svm(vcpu)->vmcb->save.rflags = rflags;
}
+static void svm_set_vintr(struct vcpu_svm *svm)
+{
+ svm->vmcb->control.intercept |= 1ULL << INTERCEPT_VINTR;
+}
+
+static void svm_clear_vintr(struct vcpu_svm *svm)
+{
+ svm->vmcb->control.intercept &= ~(1ULL << INTERCEPT_VINTR);
+}
+
static struct vmcb_seg *svm_seg(struct kvm_vcpu *vcpu, int seg)
{
struct vmcb_save_area *save = &to_svm(vcpu)->vmcb->save;
@@ -1380,7 +1390,7 @@ static int interrupt_window_interception(struct vcpu_svm *svm,
{
KVMTRACE_0D(PEND_INTR, &svm->vcpu, handler);
- svm->vmcb->control.intercept &= ~(1ULL << INTERCEPT_VINTR);
+ svm_clear_vintr(svm);
svm->vmcb->control.int_ctl &= ~V_IRQ_MASK;
/*
* If the user space waits to inject interrupts, exit as soon as
@@ -1593,7 +1603,7 @@ static void svm_intr_assist(struct kvm_vcpu *vcpu)
(vmcb->control.int_state & SVM_INTERRUPT_SHADOW_MASK) ||
(vmcb->control.event_inj & SVM_EVTINJ_VALID)) {
/* unable to deliver irq, set pending irq */
- vmcb->control.intercept |= (1ULL << INTERCEPT_VINTR);
+ svm_set_vintr(svm);
svm_inject_irq(svm, 0x0);
goto out;
}
@@ -1652,9 +1662,9 @@ static void do_interrupt_requests(struct kvm_vcpu *vcpu,
*/
if (!svm->vcpu.arch.interrupt_window_open &&
(svm->vcpu.arch.irq_summary || kvm_run->request_interrupt_window))
- control->intercept |= 1ULL << INTERCEPT_VINTR;
- else
- control->intercept &= ~(1ULL << INTERCEPT_VINTR);
+ svm_set_vintr(svm);
+ else
+ svm_clear_vintr(svm);
}
static int svm_set_tss_addr(struct kvm *kvm, unsigned int addr)
--
1.6.0.6
next prev parent reply other threads:[~2009-02-26 14:18 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-26 14:14 [PATCH 00/40] KVM Updates for the 2.6.30 merge window (1/3) Avi Kivity
2009-02-26 14:14 ` Avi Kivity [this message]
2009-02-26 14:14 ` [PATCH 02/40] KVM: SVM: Move EFER and MSR constants to generic x86 code Avi Kivity
2009-02-26 14:14 ` [PATCH 03/40] KVM: SVM: Add helper functions for nested SVM Avi Kivity
2009-02-26 14:14 ` [PATCH 04/40] KVM: SVM: Implement GIF, clgi and stgi Avi Kivity
2009-02-26 14:14 ` [PATCH 05/40] KVM: SVM: Implement hsave Avi Kivity
2009-02-26 14:14 ` [PATCH 06/40] KVM: SVM: Add VMLOAD and VMSAVE handlers Avi Kivity
2009-02-26 14:14 ` [PATCH 07/40] KVM: SVM: Add VMRUN handler Avi Kivity
2009-02-26 14:14 ` [PATCH 08/40] KVM: SVM: Add VMEXIT handler and intercepts Avi Kivity
2009-02-26 14:14 ` [PATCH 09/40] KVM: SVM: Allow read access to MSR_VM_VR Avi Kivity
2009-02-26 14:15 ` [PATCH 10/40] KVM: SVM: Allow setting the SVME bit Avi Kivity
2009-02-26 14:15 ` [PATCH 11/40] KVM: SVM: Only allow setting of EFER_SVME when CPUID SVM is set Avi Kivity
2009-02-26 14:15 ` [PATCH 12/40] KVM: VMX: Support for injecting software exceptions Avi Kivity
2009-02-26 14:15 ` [PATCH 13/40] KVM: New guest debug interface Avi Kivity
2009-02-26 14:15 ` [PATCH 14/40] KVM: VMX: Allow single-stepping when uninterruptible Avi Kivity
2009-02-26 14:15 ` [PATCH 15/40] KVM: x86: Virtualize debug registers Avi Kivity
2009-02-26 14:15 ` [PATCH 16/40] KVM: x86: Wire-up hardware breakpoints for guest debugging Avi Kivity
2009-02-26 14:15 ` [PATCH 17/40] KVM: ia64: stack get/restore patch Avi Kivity
2009-02-26 14:15 ` [PATCH 18/40] KVM: Remove old kvm_guest_debug structs Avi Kivity
2009-02-26 14:15 ` [PATCH 19/40] KVM: ia64: Code cleanup Avi Kivity
2009-02-26 14:15 ` [PATCH 20/40] KVM: MMU: Inherit a shadow page's guest level count from vcpu setup Avi Kivity
2009-02-26 14:15 ` [PATCH 21/40] KVM: MMU: Segregate mmu pages created with different cr4.pge settings Avi Kivity
2009-02-26 14:15 ` [PATCH 22/40] KVM: MMU: Initialize a shadow page's global attribute from cr4.pge Avi Kivity
2009-02-26 14:15 ` [PATCH 23/40] KVM: Fix vmload and friends misinterpreted as lidt Avi Kivity
2009-02-26 14:15 ` [PATCH 24/40] KVM: Advertise guest debug capability per-arch Avi Kivity
2009-02-26 14:15 ` [PATCH 25/40] KVM: MMU: Add for_each_shadow_entry(), a simpler alternative to walk_shadow() Avi Kivity
2009-02-26 14:15 ` [PATCH 26/40] KVM: MMU: Use for_each_shadow_entry() in __direct_map() Avi Kivity
2009-02-26 14:15 ` [PATCH 27/40] KVM: MMU: Replace walk_shadow() by for_each_shadow_entry() in fetch() Avi Kivity
2009-02-26 14:15 ` [PATCH 28/40] KVM: MMU: Replace walk_shadow() by for_each_shadow_entry() in invlpg() Avi Kivity
2009-02-26 14:15 ` [PATCH 29/40] KVM: MMU: Drop walk_shadow() Avi Kivity
2009-02-26 14:15 ` [PATCH 30/40] KVM: VMX: initialize TSC offset relative to vm creation time Avi Kivity
2009-02-26 14:15 ` [PATCH 31/40] KVM: introduce kvm_read_guest_virt, kvm_write_guest_virt Avi Kivity
2009-02-26 14:15 ` [PATCH 32/40] KVM: remove the vmap usage Avi Kivity
2009-02-26 14:15 ` [PATCH 33/40] KVM: Fallback support for MSR_VM_HSAVE_PA Avi Kivity
2009-02-26 14:15 ` [PATCH 34/40] KVM: PIT: provide an option to disable interrupt reinjection Avi Kivity
2009-02-26 14:15 ` [PATCH 35/40] KVM: Move struct kvm_pio_request into x86 kvm_host.h Avi Kivity
2009-02-26 14:15 ` [PATCH 36/40] KVM: ppc: move struct kvmppc_44x_tlbe into 44x-specific header Avi Kivity
2009-02-26 14:15 ` [PATCH 37/40] KVM: ppc: cosmetic changes to mmu hook names Avi Kivity
2009-02-26 14:15 ` [PATCH 38/40] KVM: ppc: small cosmetic changes to Book E DTLB miss handler Avi Kivity
2009-02-26 14:15 ` [PATCH 39/40] KVM: ppc: change kvmppc_mmu_map() parameters Avi Kivity
2009-02-26 14:15 ` [PATCH 40/40] KVM: ppc: turn tlb_xlate() into a per-core hook (and give it a better name) Avi Kivity
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=1235657730-27683-2-git-send-email-avi@redhat.com \
--to=avi@redhat.com \
--cc=agraf@suse.de \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®