aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/vmx.c
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2009-03-23 05:23:18 -0400
committerAvi Kivity <avi@redhat.com>2009-06-10 04:48:31 -0400
commitfe4c7b1914ac46af751d256f5a20c2e12dcbaaae (patch)
tree4533d4a230e64bab951f2b4f7d7147e309a11ee5 /arch/x86/kvm/vmx.c
parent61c50edfcd40be9126579f9cec68c789b6089998 (diff)
KVM: reuse (pop|push)_irq from svm.c in vmx.c
The prioritized bit vector manipulation functions are useful in both vmx and svm. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r--arch/x86/kvm/vmx.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index b5eae7a00aad..2c0a2ed708d2 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2489,18 +2489,6 @@ static void vmx_update_window_states(struct kvm_vcpu *vcpu)
2489 GUEST_INTR_STATE_MOV_SS))); 2489 GUEST_INTR_STATE_MOV_SS)));
2490} 2490}
2491 2491
2492static void kvm_do_inject_irq(struct kvm_vcpu *vcpu)
2493{
2494 int word_index = __ffs(vcpu->arch.irq_summary);
2495 int bit_index = __ffs(vcpu->arch.irq_pending[word_index]);
2496 int irq = word_index * BITS_PER_LONG + bit_index;
2497
2498 clear_bit(bit_index, &vcpu->arch.irq_pending[word_index]);
2499 if (!vcpu->arch.irq_pending[word_index])
2500 clear_bit(word_index, &vcpu->arch.irq_summary);
2501 kvm_queue_interrupt(vcpu, irq);
2502}
2503
2504static void do_interrupt_requests(struct kvm_vcpu *vcpu, 2492static void do_interrupt_requests(struct kvm_vcpu *vcpu,
2505 struct kvm_run *kvm_run) 2493 struct kvm_run *kvm_run)
2506{ 2494{
@@ -2534,7 +2522,7 @@ static void do_interrupt_requests(struct kvm_vcpu *vcpu,
2534 2522
2535 if (vcpu->arch.interrupt_window_open) { 2523 if (vcpu->arch.interrupt_window_open) {
2536 if (vcpu->arch.irq_summary && !vcpu->arch.interrupt.pending) 2524 if (vcpu->arch.irq_summary && !vcpu->arch.interrupt.pending)
2537 kvm_do_inject_irq(vcpu); 2525 kvm_queue_interrupt(vcpu, kvm_pop_irq(vcpu));
2538 2526
2539 if (vcpu->arch.interrupt.pending) 2527 if (vcpu->arch.interrupt.pending)
2540 vmx_inject_irq(vcpu, vcpu->arch.interrupt.nr); 2528 vmx_inject_irq(vcpu, vcpu->arch.interrupt.nr);
@@ -2619,8 +2607,7 @@ static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
2619 2607
2620 if (!irqchip_in_kernel(vcpu->kvm) && is_external_interrupt(vect_info)) { 2608 if (!irqchip_in_kernel(vcpu->kvm) && is_external_interrupt(vect_info)) {
2621 int irq = vect_info & VECTORING_INFO_VECTOR_MASK; 2609 int irq = vect_info & VECTORING_INFO_VECTOR_MASK;
2622 set_bit(irq, vcpu->arch.irq_pending); 2610 kvm_push_irq(vcpu, irq);
2623 set_bit(irq / BITS_PER_LONG, &vcpu->arch.irq_summary);
2624 } 2611 }
2625 2612
2626 if ((intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR) 2613 if ((intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR)