Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 21bc8dc5 authored by Radim Krčmář's avatar Radim Krčmář Committed by Paolo Bonzini
Browse files

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: default avatarkbuild test robot <fengguang.wu@intel.com>
Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 91314cb0
Loading
Loading
Loading
Loading
+14 −9
Original line number Original line Diff line number Diff line
@@ -4367,6 +4367,18 @@ static int vmx_complete_nested_posted_interrupt(struct kvm_vcpu *vcpu)
	return 0;
	return 0;
}
}


static inline bool kvm_vcpu_trigger_posted_interrupt(struct kvm_vcpu *vcpu)
{
#ifdef CONFIG_SMP
	if (vcpu->mode == IN_GUEST_MODE) {
		apic->send_IPI_mask(get_cpu_mask(vcpu->cpu),
				POSTED_INTR_VECTOR);
		return true;
	}
#endif
	return false;
}

static int vmx_deliver_nested_posted_interrupt(struct kvm_vcpu *vcpu,
static int vmx_deliver_nested_posted_interrupt(struct kvm_vcpu *vcpu,
						int vector)
						int vector)
{
{
@@ -4375,9 +4387,7 @@ static int vmx_deliver_nested_posted_interrupt(struct kvm_vcpu *vcpu,
	if (is_guest_mode(vcpu) &&
	if (is_guest_mode(vcpu) &&
	    vector == vmx->nested.posted_intr_nv) {
	    vector == vmx->nested.posted_intr_nv) {
		/* the PIR and ON have been set by L1. */
		/* the PIR and ON have been set by L1. */
		if (vcpu->mode == IN_GUEST_MODE)
		kvm_vcpu_trigger_posted_interrupt(vcpu);
			apic->send_IPI_mask(get_cpu_mask(vcpu->cpu),
				POSTED_INTR_VECTOR);
		/*
		/*
		 * If a posted intr is not recognized by hardware,
		 * If a posted intr is not recognized by hardware,
		 * we will accomplish it in the next vmentry.
		 * we will accomplish it in the next vmentry.
@@ -4409,12 +4419,7 @@ static void vmx_deliver_posted_interrupt(struct kvm_vcpu *vcpu, int vector)


	r = pi_test_and_set_on(&vmx->pi_desc);
	r = pi_test_and_set_on(&vmx->pi_desc);
	kvm_make_request(KVM_REQ_EVENT, vcpu);
	kvm_make_request(KVM_REQ_EVENT, vcpu);
#ifdef CONFIG_SMP
	if (r || !kvm_vcpu_trigger_posted_interrupt(vcpu))
	if (!r && (vcpu->mode == IN_GUEST_MODE))
		apic->send_IPI_mask(get_cpu_mask(vcpu->cpu),
				POSTED_INTR_VECTOR);
	else
#endif
		kvm_vcpu_kick(vcpu);
		kvm_vcpu_kick(vcpu);
}
}