xref: /linux/arch/x86/kvm/vmx/posted_intr.h (revision 63eb28bb1402891b1ad2be02a530f29a9dd7f1cd)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __KVM_X86_VMX_POSTED_INTR_H
3 #define __KVM_X86_VMX_POSTED_INTR_H
4 
5 #include <linux/bitmap.h>
6 #include <linux/find.h>
7 #include <linux/kvm_host.h>
8 
9 #include <asm/posted_intr.h>
10 
11 void vmx_vcpu_pi_load(struct kvm_vcpu *vcpu, int cpu);
12 void vmx_vcpu_pi_put(struct kvm_vcpu *vcpu);
13 void pi_wakeup_handler(void);
14 void __init pi_init_cpu(int cpu);
15 void pi_apicv_pre_state_restore(struct kvm_vcpu *vcpu);
16 bool pi_has_pending_interrupt(struct kvm_vcpu *vcpu);
17 int vmx_pi_update_irte(struct kvm_kernel_irqfd *irqfd, struct kvm *kvm,
18 		       unsigned int host_irq, uint32_t guest_irq,
19 		       struct kvm_vcpu *vcpu, u32 vector);
20 void vmx_pi_start_bypass(struct kvm *kvm);
21 
pi_find_highest_vector(struct pi_desc * pi_desc)22 static inline int pi_find_highest_vector(struct pi_desc *pi_desc)
23 {
24 	int vec;
25 
26 	vec = find_last_bit(pi_desc->pir, 256);
27 	return vec < 256 ? vec : -1;
28 }
29 
30 #endif /* __KVM_X86_VMX_POSTED_INTR_H */
31