aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFeng Wu <feng.wu@intel.com>2015-09-18 10:29:46 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2015-10-01 09:06:48 -0400
commitebbfc765369690cf8fc512615e6b83ec1702f8ac (patch)
tree3738211d2796bf656cff067f3e012a146206f558
parent6ef1522f7ecc063317dfb5ca63da6e47130a4c50 (diff)
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 <feng.wu@intel.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Alex Williamson <alex.williamson@redhat.com> [Make the new functions inline. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--arch/x86/kvm/vmx.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 4ebdccd882c8..4739a52874c2 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -443,6 +443,8 @@ struct nested_vmx {
443}; 443};
444 444
445#define POSTED_INTR_ON 0 445#define POSTED_INTR_ON 0
446#define POSTED_INTR_SN 1
447
446/* Posted-Interrupt Descriptor */ 448/* Posted-Interrupt Descriptor */
447struct pi_desc { 449struct pi_desc {
448 u32 pir[8]; /* Posted interrupt requested */ 450 u32 pir[8]; /* Posted interrupt requested */
@@ -483,6 +485,30 @@ static int pi_test_and_set_pir(int vector, struct pi_desc *pi_desc)
483 return test_and_set_bit(vector, (unsigned long *)pi_desc->pir); 485 return test_and_set_bit(vector, (unsigned long *)pi_desc->pir);
484} 486}
485 487
488static 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
494static 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
500static 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
506static 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
486struct vcpu_vmx { 512struct vcpu_vmx {
487 struct kvm_vcpu vcpu; 513 struct kvm_vcpu vcpu;
488 unsigned long host_rsp; 514 unsigned long host_rsp;