Skip to content

Commit ebbfc76

Browse files
Feng Wubonzini
authored andcommitted
KVM: Add some helper functions for Posted-Interrupts
This patch adds some helper functions to manipulate the Posted-Interrupts Descriptor. Signed-off-by: Feng Wu <[email protected]> Reviewed-by: Paolo Bonzini <[email protected]> Reviewed-by: Alex Williamson <[email protected]> [Make the new functions inline. - Paolo] Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 6ef1522 commit ebbfc76

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

arch/x86/kvm/vmx.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,8 @@ struct nested_vmx {
443443
};
444444

445445
#define POSTED_INTR_ON 0
446+
#define POSTED_INTR_SN 1
447+
446448
/* Posted-Interrupt Descriptor */
447449
struct pi_desc {
448450
u32 pir[8]; /* Posted interrupt requested */
@@ -483,6 +485,30 @@ static int pi_test_and_set_pir(int vector, struct pi_desc *pi_desc)
483485
return test_and_set_bit(vector, (unsigned long *)pi_desc->pir);
484486
}
485487

488+
static inline void pi_clear_sn(struct pi_desc *pi_desc)
489+
{
490+
return clear_bit(POSTED_INTR_SN,
491+
(unsigned long *)&pi_desc->control);
492+
}
493+
494+
static inline void pi_set_sn(struct pi_desc *pi_desc)
495+
{
496+
return set_bit(POSTED_INTR_SN,
497+
(unsigned long *)&pi_desc->control);
498+
}
499+
500+
static inline int pi_test_on(struct pi_desc *pi_desc)
501+
{
502+
return test_bit(POSTED_INTR_ON,
503+
(unsigned long *)&pi_desc->control);
504+
}
505+
506+
static inline int pi_test_sn(struct pi_desc *pi_desc)
507+
{
508+
return test_bit(POSTED_INTR_SN,
509+
(unsigned long *)&pi_desc->control);
510+
}
511+
486512
struct vcpu_vmx {
487513
struct kvm_vcpu vcpu;
488514
unsigned long host_rsp;

0 commit comments

Comments
 (0)