aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kvm/x86.h')
-rw-r--r--arch/x86/kvm/x86.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
index 6a4be78a7384..2ab679102dcd 100644
--- a/arch/x86/kvm/x86.h
+++ b/arch/x86/kvm/x86.h
@@ -19,4 +19,22 @@ static inline void kvm_clear_interrupt_queue(struct kvm_vcpu *vcpu)
19 vcpu->arch.interrupt.pending = false; 19 vcpu->arch.interrupt.pending = false;
20} 20}
21 21
22static inline u8 kvm_pop_irq(struct kvm_vcpu *vcpu)
23{
24 int word_index = __ffs(vcpu->arch.irq_summary);
25 int bit_index = __ffs(vcpu->arch.irq_pending[word_index]);
26 int irq = word_index * BITS_PER_LONG + bit_index;
27
28 clear_bit(bit_index, &vcpu->arch.irq_pending[word_index]);
29 if (!vcpu->arch.irq_pending[word_index])
30 clear_bit(word_index, &vcpu->arch.irq_summary);
31 return irq;
32}
33
34static inline void kvm_push_irq(struct kvm_vcpu *vcpu, u8 irq)
35{
36 set_bit(irq, vcpu->arch.irq_pending);
37 set_bit(irq / BITS_PER_LONG, &vcpu->arch.irq_summary);
38}
39
22#endif 40#endif