Commit 24d2166b authored by Raghavendra K T's avatar Raghavendra K T Committed by Gleb Natapov

kvm hypervisor: Simplify kvm_for_each_vcpu with kvm_irq_delivery_to_apic

Note that we are using APIC_DM_REMRD which has reserved usage.
In future if APIC_DM_REMRD usage is standardized, then we should
find some other way or go back to old method.
Suggested-by: default avatarGleb Natapov <gleb@redhat.com>
Signed-off-by: default avatarRaghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
Acked-by: default avatarGleb Natapov <gleb@redhat.com>
Acked-by: default avatarIngo Molnar <mingo@kernel.org>
Signed-off-by: default avatarGleb Natapov <gleb@redhat.com>
parent 6aef266c
...@@ -689,7 +689,10 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode, ...@@ -689,7 +689,10 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode,
break; break;
case APIC_DM_REMRD: case APIC_DM_REMRD:
apic_debug("Ignoring delivery mode 3\n"); result = 1;
vcpu->arch.pv.pv_unhalted = 1;
kvm_make_request(KVM_REQ_EVENT, vcpu);
kvm_vcpu_kick(vcpu);
break; break;
case APIC_DM_SMI: case APIC_DM_SMI:
......
...@@ -5595,27 +5595,14 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu) ...@@ -5595,27 +5595,14 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu)
*/ */
static void kvm_pv_kick_cpu_op(struct kvm *kvm, unsigned long flags, int apicid) static void kvm_pv_kick_cpu_op(struct kvm *kvm, unsigned long flags, int apicid)
{ {
struct kvm_vcpu *vcpu = NULL; struct kvm_lapic_irq lapic_irq;
int i;
kvm_for_each_vcpu(i, vcpu, kvm) { lapic_irq.shorthand = 0;
if (!kvm_apic_present(vcpu)) lapic_irq.dest_mode = 0;
continue; lapic_irq.dest_id = apicid;
if (kvm_apic_match_dest(vcpu, 0, 0, apicid, 0)) lapic_irq.delivery_mode = APIC_DM_REMRD;
break; kvm_irq_delivery_to_apic(kvm, 0, &lapic_irq, NULL);
}
if (vcpu) {
/*
* Setting unhalt flag here can result in spurious runnable
* state when unhalt reset does not happen in vcpu_block.
* But that is harmless since that should soon result in halt.
*/
vcpu->arch.pv.pv_unhalted = true;
/* We need everybody see unhalt before vcpu unblocks */
smp_wmb();
kvm_vcpu_kick(vcpu);
}
} }
int kvm_emulate_hypercall(struct kvm_vcpu *vcpu) int kvm_emulate_hypercall(struct kvm_vcpu *vcpu)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment