kvm: x86: Track irq vectors in ioapic->rtc_status.dest_map
authorJoerg Roedel <jroedel@suse.de>
Mon, 29 Feb 2016 15:04:44 +0000 (16:04 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 3 Mar 2016 13:36:18 +0000 (14:36 +0100)
This allows backtracking later in case the rtc irq has been
moved to another vcpu/vector.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/ioapic.h
arch/x86/kvm/lapic.c

index af729890f6f550361251f7ee3001b3d0e9a5746d..7d2692a4965756143825d65d37688837d82aaca2 100644 (file)
@@ -41,7 +41,14 @@ struct kvm_vcpu;
 #endif
 
 struct dest_map {
+       /* vcpu bitmap where IRQ has been sent */
        DECLARE_BITMAP(map, KVM_MAX_VCPUS);
+
+       /*
+        * Vector sent to a given vcpu, only valid when
+        * the vcpu's bit in map is set
+        */
+       u8 vectors[KVM_MAX_VCPUS];
 };
 
 
index e085695e6b5a9379d5864a99e3bd017e62206f81..d9ae1ce2a6a03e0e8ebac52ea88c94dd913fe5f7 100644 (file)
@@ -914,8 +914,10 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode,
 
                result = 1;
 
-               if (dest_map)
+               if (dest_map) {
                        __set_bit(vcpu->vcpu_id, dest_map->map);
+                       dest_map->vectors[vcpu->vcpu_id] = vector;
+               }
 
                if (apic_test_vector(vector, apic->regs + APIC_TMR) != !!trig_mode) {
                        if (trig_mode)