aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2014-12-16 09:08:14 -0500
committerPaolo Bonzini <pbonzini@redhat.com>2015-01-08 16:45:18 -0500
commit7c6a98dfa1ba9dc64a62e73624ecea9995736bbd (patch)
treec09add5274ab7c53106ffe3c81e6e640e46f7e5e /arch
parentb4eef9b36db461ca44832226fbca614db58c0c33 (diff)
KVM: x86: add method to test PIR bitmap vector
kvm_x86_ops->test_posted_interrupt() returns true/false depending whether 'vector' is set. Next patch makes use of this interface. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/include/asm/kvm_host.h1
-rw-r--r--arch/x86/kvm/vmx.c14
2 files changed, 15 insertions, 0 deletions
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index d89c6b828c96..cb19d05af3cd 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -753,6 +753,7 @@ struct kvm_x86_ops {
753 void (*set_virtual_x2apic_mode)(struct kvm_vcpu *vcpu, bool set); 753 void (*set_virtual_x2apic_mode)(struct kvm_vcpu *vcpu, bool set);
754 void (*set_apic_access_page_addr)(struct kvm_vcpu *vcpu, hpa_t hpa); 754 void (*set_apic_access_page_addr)(struct kvm_vcpu *vcpu, hpa_t hpa);
755 void (*deliver_posted_interrupt)(struct kvm_vcpu *vcpu, int vector); 755 void (*deliver_posted_interrupt)(struct kvm_vcpu *vcpu, int vector);
756 bool (*test_posted_interrupt)(struct kvm_vcpu *vcpu, int vector);
756 void (*sync_pir_to_irr)(struct kvm_vcpu *vcpu); 757 void (*sync_pir_to_irr)(struct kvm_vcpu *vcpu);
757 int (*set_tss_addr)(struct kvm *kvm, unsigned int addr); 758 int (*set_tss_addr)(struct kvm *kvm, unsigned int addr);
758 int (*get_tdp_level)(void); 759 int (*get_tdp_level)(void);
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 6e71fac27d4e..3b97f8b3065e 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -435,6 +435,11 @@ static int pi_test_and_set_pir(int vector, struct pi_desc *pi_desc)
435 return test_and_set_bit(vector, (unsigned long *)pi_desc->pir); 435 return test_and_set_bit(vector, (unsigned long *)pi_desc->pir);
436} 436}
437 437
438static int pi_test_pir(int vector, struct pi_desc *pi_desc)
439{
440 return test_bit(vector, (unsigned long *)pi_desc->pir);
441}
442
438struct vcpu_vmx { 443struct vcpu_vmx {
439 struct kvm_vcpu vcpu; 444 struct kvm_vcpu vcpu;
440 unsigned long host_rsp; 445 unsigned long host_rsp;
@@ -5897,6 +5902,7 @@ static __init int hardware_setup(void)
5897 kvm_x86_ops->hwapic_irr_update = NULL; 5902 kvm_x86_ops->hwapic_irr_update = NULL;
5898 kvm_x86_ops->hwapic_isr_update = NULL; 5903 kvm_x86_ops->hwapic_isr_update = NULL;
5899 kvm_x86_ops->deliver_posted_interrupt = NULL; 5904 kvm_x86_ops->deliver_posted_interrupt = NULL;
5905 kvm_x86_ops->test_posted_interrupt = NULL;
5900 kvm_x86_ops->sync_pir_to_irr = vmx_sync_pir_to_irr_dummy; 5906 kvm_x86_ops->sync_pir_to_irr = vmx_sync_pir_to_irr_dummy;
5901 } 5907 }
5902 5908
@@ -6968,6 +6974,13 @@ static int handle_invvpid(struct kvm_vcpu *vcpu)
6968 return 1; 6974 return 1;
6969} 6975}
6970 6976
6977static bool vmx_test_pir(struct kvm_vcpu *vcpu, int vector)
6978{
6979 struct vcpu_vmx *vmx = to_vmx(vcpu);
6980
6981 return pi_test_pir(vector, &vmx->pi_desc);
6982}
6983
6971/* 6984/*
6972 * The exit handlers return 1 if the exit was handled fully and guest execution 6985 * The exit handlers return 1 if the exit was handled fully and guest execution
6973 * may resume. Otherwise they set the kvm_run parameter to indicate what needs 6986 * may resume. Otherwise they set the kvm_run parameter to indicate what needs
@@ -9562,6 +9575,7 @@ static struct kvm_x86_ops vmx_x86_ops = {
9562 .hwapic_isr_update = vmx_hwapic_isr_update, 9575 .hwapic_isr_update = vmx_hwapic_isr_update,
9563 .sync_pir_to_irr = vmx_sync_pir_to_irr, 9576 .sync_pir_to_irr = vmx_sync_pir_to_irr,
9564 .deliver_posted_interrupt = vmx_deliver_posted_interrupt, 9577 .deliver_posted_interrupt = vmx_deliver_posted_interrupt,
9578 .test_posted_interrupt = vmx_test_pir,
9565 9579
9566 .set_tss_addr = vmx_set_tss_addr, 9580 .set_tss_addr = vmx_set_tss_addr,
9567 .get_tdp_level = get_ept_level, 9581 .get_tdp_level = get_ept_level,