diff options
author | Radim Krčmář <rkrcmar@redhat.com> | 2015-02-16 09:36:33 -0500 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2015-02-23 16:28:48 -0500 |
commit | 21bc8dc5b729dbeecb43adff23b74b51321e1897 (patch) | |
tree | d77c9d8059dc505296dd88ed8cfd27ba48689abd /arch/x86/kvm/vmx.c | |
parent | 91314cb0053877991fd7b4749bb4b54d6bd6992f (diff) |
KVM: VMX: fix build without CONFIG_SMP
'apic' is not defined if !CONFIG_X86_64 && !CONFIG_X86_LOCAL_APIC.
Posted interrupt makes no sense without CONFIG_SMP, and
CONFIG_X86_LOCAL_APIC will be set with it.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r-- | arch/x86/kvm/vmx.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 14c1a18d206a..f7b20b417a3a 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -4367,6 +4367,18 @@ static int vmx_complete_nested_posted_interrupt(struct kvm_vcpu *vcpu) | |||
4367 | return 0; | 4367 | return 0; |
4368 | } | 4368 | } |
4369 | 4369 | ||
4370 | static inline bool kvm_vcpu_trigger_posted_interrupt(struct kvm_vcpu *vcpu) | ||
4371 | { | ||
4372 | #ifdef CONFIG_SMP | ||
4373 | if (vcpu->mode == IN_GUEST_MODE) { | ||
4374 | apic->send_IPI_mask(get_cpu_mask(vcpu->cpu), | ||
4375 | POSTED_INTR_VECTOR); | ||
4376 | return true; | ||
4377 | } | ||
4378 | #endif | ||
4379 | return false; | ||
4380 | } | ||
4381 | |||
4370 | static int vmx_deliver_nested_posted_interrupt(struct kvm_vcpu *vcpu, | 4382 | static int vmx_deliver_nested_posted_interrupt(struct kvm_vcpu *vcpu, |
4371 | int vector) | 4383 | int vector) |
4372 | { | 4384 | { |
@@ -4375,9 +4387,7 @@ static int vmx_deliver_nested_posted_interrupt(struct kvm_vcpu *vcpu, | |||
4375 | if (is_guest_mode(vcpu) && | 4387 | if (is_guest_mode(vcpu) && |
4376 | vector == vmx->nested.posted_intr_nv) { | 4388 | vector == vmx->nested.posted_intr_nv) { |
4377 | /* the PIR and ON have been set by L1. */ | 4389 | /* the PIR and ON have been set by L1. */ |
4378 | if (vcpu->mode == IN_GUEST_MODE) | 4390 | kvm_vcpu_trigger_posted_interrupt(vcpu); |
4379 | apic->send_IPI_mask(get_cpu_mask(vcpu->cpu), | ||
4380 | POSTED_INTR_VECTOR); | ||
4381 | /* | 4391 | /* |
4382 | * If a posted intr is not recognized by hardware, | 4392 | * If a posted intr is not recognized by hardware, |
4383 | * we will accomplish it in the next vmentry. | 4393 | * we will accomplish it in the next vmentry. |
@@ -4409,12 +4419,7 @@ static void vmx_deliver_posted_interrupt(struct kvm_vcpu *vcpu, int vector) | |||
4409 | 4419 | ||
4410 | r = pi_test_and_set_on(&vmx->pi_desc); | 4420 | r = pi_test_and_set_on(&vmx->pi_desc); |
4411 | kvm_make_request(KVM_REQ_EVENT, vcpu); | 4421 | kvm_make_request(KVM_REQ_EVENT, vcpu); |
4412 | #ifdef CONFIG_SMP | 4422 | if (r || !kvm_vcpu_trigger_posted_interrupt(vcpu)) |
4413 | if (!r && (vcpu->mode == IN_GUEST_MODE)) | ||
4414 | apic->send_IPI_mask(get_cpu_mask(vcpu->cpu), | ||
4415 | POSTED_INTR_VECTOR); | ||
4416 | else | ||
4417 | #endif | ||
4418 | kvm_vcpu_kick(vcpu); | 4423 | kvm_vcpu_kick(vcpu); |
4419 | } | 4424 | } |
4420 | 4425 | ||