KVM: Change API of kvm_ioapic_get_delivery_bitmask
authorSheng Yang <sheng@linux.intel.com>
Wed, 11 Feb 2009 08:03:38 +0000 (16:03 +0800)
committerAvi Kivity <avi@redhat.com>
Wed, 10 Jun 2009 08:48:22 +0000 (11:48 +0300)
In order to use with bit ops.

Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
virt/kvm/ioapic.c
virt/kvm/ioapic.h
virt/kvm/irq_comm.c

index 883fd0dc9b78600950e1f333bf66f11187a5d1a2..3b5371299dd10107e2779e556a340b7c4fe35363 100644 (file)
@@ -161,22 +161,22 @@ static void ioapic_inj_nmi(struct kvm_vcpu *vcpu)
        kvm_vcpu_kick(vcpu);
 }
 
-u32 kvm_ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest,
-                                   u8 dest_mode)
+void kvm_ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest,
+                                    u8 dest_mode, unsigned long *mask)
 {
-       u32 mask = 0;
        int i;
        struct kvm *kvm = ioapic->kvm;
        struct kvm_vcpu *vcpu;
 
        ioapic_debug("dest %d dest_mode %d\n", dest, dest_mode);
 
+       *mask = 0;
        if (dest_mode == 0) {   /* Physical mode. */
                if (dest == 0xFF) {     /* Broadcast. */
                        for (i = 0; i < KVM_MAX_VCPUS; ++i)
                                if (kvm->vcpus[i] && kvm->vcpus[i]->arch.apic)
-                                       mask |= 1 << i;
-                       return mask;
+                                       *mask |= 1 << i;
+                       return;
                }
                for (i = 0; i < KVM_MAX_VCPUS; ++i) {
                        vcpu = kvm->vcpus[i];
@@ -184,7 +184,7 @@ u32 kvm_ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest,
                                continue;
                        if (kvm_apic_match_physical_addr(vcpu->arch.apic, dest)) {
                                if (vcpu->arch.apic)
-                                       mask = 1 << i;
+                                       *mask = 1 << i;
                                break;
                        }
                }
@@ -195,10 +195,9 @@ u32 kvm_ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest,
                                continue;
                        if (vcpu->arch.apic &&
                            kvm_apic_match_logical_addr(vcpu->arch.apic, dest))
-                               mask |= 1 << vcpu->vcpu_id;
+                               *mask |= 1 << vcpu->vcpu_id;
                }
-       ioapic_debug("mask %x\n", mask);
-       return mask;
+       ioapic_debug("mask %x\n", *mask);
 }
 
 static int ioapic_deliver(struct kvm_ioapic *ioapic, int irq)
index 008ec873d0186e8b18560a1cf002a2bd8822a391..f395798bc1d1246e28ef833d0b90d531cc97e06d 100644 (file)
@@ -70,7 +70,7 @@ void kvm_ioapic_update_eoi(struct kvm *kvm, int vector, int trigger_mode);
 int kvm_ioapic_init(struct kvm *kvm);
 int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int level);
 void kvm_ioapic_reset(struct kvm_ioapic *ioapic);
-u32 kvm_ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest,
-                               u8 dest_mode);
+void kvm_ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest,
+                                    u8 dest_mode, unsigned long *mask);
 
 #endif
index aec7a0d93a3fc3ee7121a68b991da37146e5d81a..e8ff89c3cca73af6c3b481ab896a5c51716b9b92 100644 (file)
@@ -49,8 +49,9 @@ void kvm_get_intr_delivery_bitmask(struct kvm_ioapic *ioapic,
 {
        struct kvm_vcpu *vcpu;
 
-       *deliver_bitmask = kvm_ioapic_get_delivery_bitmask(ioapic,
-                               entry->fields.dest_id, entry->fields.dest_mode);
+       kvm_ioapic_get_delivery_bitmask(ioapic, entry->fields.dest_id,
+                                       entry->fields.dest_mode,
+                                       deliver_bitmask);
        switch (entry->fields.delivery_mode) {
        case IOAPIC_LOWEST_PRIORITY:
                vcpu = kvm_get_lowest_prio_vcpu(ioapic->kvm,