blob: 5eadea585d2a2084ef3adc91e7575e54b27aff21 [file] [log] [blame]
Avi Kivity26eef702008-07-03 14:59:22 +03001#ifndef ARCH_X86_KVM_X86_H
2#define ARCH_X86_KVM_X86_H
3
4#include <linux/kvm_host.h>
5
6static inline void kvm_clear_exception_queue(struct kvm_vcpu *vcpu)
7{
8 vcpu->arch.exception.pending = false;
9}
10
Gleb Natapov66fd3f72009-05-11 13:35:50 +030011static inline void kvm_queue_interrupt(struct kvm_vcpu *vcpu, u8 vector,
12 bool soft)
Avi Kivity937a7ea2008-07-03 15:17:01 +030013{
14 vcpu->arch.interrupt.pending = true;
Gleb Natapov66fd3f72009-05-11 13:35:50 +030015 vcpu->arch.interrupt.soft = soft;
Avi Kivity937a7ea2008-07-03 15:17:01 +030016 vcpu->arch.interrupt.nr = vector;
17}
18
19static inline void kvm_clear_interrupt_queue(struct kvm_vcpu *vcpu)
20{
21 vcpu->arch.interrupt.pending = false;
22}
23
Gleb Natapov3298b752009-05-11 13:35:46 +030024static inline bool kvm_event_needs_reinjection(struct kvm_vcpu *vcpu)
25{
26 return vcpu->arch.exception.pending || vcpu->arch.interrupt.pending ||
27 vcpu->arch.nmi_injected;
28}
Gleb Natapov66fd3f72009-05-11 13:35:50 +030029
30static inline bool kvm_exception_is_soft(unsigned int nr)
31{
32 return (nr == BP_VECTOR) || (nr == OF_VECTOR);
33}
Gleb Natapovfc61b802009-07-05 17:39:35 +030034
35struct kvm_cpuid_entry2 *kvm_find_cpuid_entry(struct kvm_vcpu *vcpu,
36 u32 function, u32 index);
37
Avi Kivity26eef702008-07-03 14:59:22 +030038#endif