diff options
author | Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com> | 2013-08-26 04:48:35 -0400 |
---|---|---|
committer | Gleb Natapov <gleb@redhat.com> | 2013-08-26 05:47:09 -0400 |
commit | 24d2166beb2f0be7dd29ab6a0841c27bd669eae9 (patch) | |
tree | ce8abff1c77b369c82507d72cbe8861e57e03162 /arch/x86 | |
parent | 6aef266c6e17b798a1740cf70cd34f90664740b3 (diff) |
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: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
Acked-by: Gleb Natapov <gleb@redhat.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kvm/lapic.c | 5 | ||||
-rw-r--r-- | arch/x86/kvm/x86.c | 25 |
2 files changed, 10 insertions, 20 deletions
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index c98f05442325..5439117d5c4c 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c | |||
@@ -689,7 +689,10 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode, | |||
689 | break; | 689 | break; |
690 | 690 | ||
691 | case APIC_DM_REMRD: | 691 | case APIC_DM_REMRD: |
692 | apic_debug("Ignoring delivery mode 3\n"); | 692 | result = 1; |
693 | vcpu->arch.pv.pv_unhalted = 1; | ||
694 | kvm_make_request(KVM_REQ_EVENT, vcpu); | ||
695 | kvm_vcpu_kick(vcpu); | ||
693 | break; | 696 | break; |
694 | 697 | ||
695 | case APIC_DM_SMI: | 698 | case APIC_DM_SMI: |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index c53741764492..cb276e976203 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -5595,27 +5595,14 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu) | |||
5595 | */ | 5595 | */ |
5596 | static void kvm_pv_kick_cpu_op(struct kvm *kvm, unsigned long flags, int apicid) | 5596 | static void kvm_pv_kick_cpu_op(struct kvm *kvm, unsigned long flags, int apicid) |
5597 | { | 5597 | { |
5598 | struct kvm_vcpu *vcpu = NULL; | 5598 | struct kvm_lapic_irq lapic_irq; |
5599 | int i; | ||
5600 | 5599 | ||
5601 | kvm_for_each_vcpu(i, vcpu, kvm) { | 5600 | lapic_irq.shorthand = 0; |
5602 | if (!kvm_apic_present(vcpu)) | 5601 | lapic_irq.dest_mode = 0; |
5603 | continue; | 5602 | lapic_irq.dest_id = apicid; |
5604 | 5603 | ||
5605 | if (kvm_apic_match_dest(vcpu, 0, 0, apicid, 0)) | 5604 | lapic_irq.delivery_mode = APIC_DM_REMRD; |
5606 | break; | 5605 | kvm_irq_delivery_to_apic(kvm, 0, &lapic_irq, NULL); |
5607 | } | ||
5608 | if (vcpu) { | ||
5609 | /* | ||
5610 | * Setting unhalt flag here can result in spurious runnable | ||
5611 | * state when unhalt reset does not happen in vcpu_block. | ||
5612 | * But that is harmless since that should soon result in halt. | ||
5613 | */ | ||
5614 | vcpu->arch.pv.pv_unhalted = true; | ||
5615 | /* We need everybody see unhalt before vcpu unblocks */ | ||
5616 | smp_wmb(); | ||
5617 | kvm_vcpu_kick(vcpu); | ||
5618 | } | ||
5619 | } | 5606 | } |
5620 | 5607 | ||
5621 | int kvm_emulate_hypercall(struct kvm_vcpu *vcpu) | 5608 | int kvm_emulate_hypercall(struct kvm_vcpu *vcpu) |