aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSheng Yang <sheng@linux.intel.com>2009-02-11 03:03:38 -0500
committerAvi Kivity <avi@redhat.com>2009-06-10 04:48:22 -0400
commite5871be0f5d6847bc9585c997acb1b917c168f03 (patch)
tree9a0c44db7affcc72137455f186d0a4193e206612
parent116191b69b608d0f1513e3abe71d6a46800f2bd6 (diff)
KVM: Change API of kvm_ioapic_get_delivery_bitmask
In order to use with bit ops. Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r--virt/kvm/ioapic.c17
-rw-r--r--virt/kvm/ioapic.h4
-rw-r--r--virt/kvm/irq_comm.c5
3 files changed, 13 insertions, 13 deletions
diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c
index 883fd0dc9b78..3b5371299dd1 100644
--- a/virt/kvm/ioapic.c
+++ b/virt/kvm/ioapic.c
@@ -161,22 +161,22 @@ static void ioapic_inj_nmi(struct kvm_vcpu *vcpu)
161 kvm_vcpu_kick(vcpu); 161 kvm_vcpu_kick(vcpu);
162} 162}
163 163
164u32 kvm_ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest, 164void kvm_ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest,
165 u8 dest_mode) 165 u8 dest_mode, unsigned long *mask)
166{ 166{
167 u32 mask = 0;
168 int i; 167 int i;
169 struct kvm *kvm = ioapic->kvm; 168 struct kvm *kvm = ioapic->kvm;
170 struct kvm_vcpu *vcpu; 169 struct kvm_vcpu *vcpu;
171 170
172 ioapic_debug("dest %d dest_mode %d\n", dest, dest_mode); 171 ioapic_debug("dest %d dest_mode %d\n", dest, dest_mode);
173 172
173 *mask = 0;
174 if (dest_mode == 0) { /* Physical mode. */ 174 if (dest_mode == 0) { /* Physical mode. */
175 if (dest == 0xFF) { /* Broadcast. */ 175 if (dest == 0xFF) { /* Broadcast. */
176 for (i = 0; i < KVM_MAX_VCPUS; ++i) 176 for (i = 0; i < KVM_MAX_VCPUS; ++i)
177 if (kvm->vcpus[i] && kvm->vcpus[i]->arch.apic) 177 if (kvm->vcpus[i] && kvm->vcpus[i]->arch.apic)
178 mask |= 1 << i; 178 *mask |= 1 << i;
179 return mask; 179 return;
180 } 180 }
181 for (i = 0; i < KVM_MAX_VCPUS; ++i) { 181 for (i = 0; i < KVM_MAX_VCPUS; ++i) {
182 vcpu = kvm->vcpus[i]; 182 vcpu = kvm->vcpus[i];
@@ -184,7 +184,7 @@ u32 kvm_ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest,
184 continue; 184 continue;
185 if (kvm_apic_match_physical_addr(vcpu->arch.apic, dest)) { 185 if (kvm_apic_match_physical_addr(vcpu->arch.apic, dest)) {
186 if (vcpu->arch.apic) 186 if (vcpu->arch.apic)
187 mask = 1 << i; 187 *mask = 1 << i;
188 break; 188 break;
189 } 189 }
190 } 190 }
@@ -195,10 +195,9 @@ u32 kvm_ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest,
195 continue; 195 continue;
196 if (vcpu->arch.apic && 196 if (vcpu->arch.apic &&
197 kvm_apic_match_logical_addr(vcpu->arch.apic, dest)) 197 kvm_apic_match_logical_addr(vcpu->arch.apic, dest))
198 mask |= 1 << vcpu->vcpu_id; 198 *mask |= 1 << vcpu->vcpu_id;
199 } 199 }
200 ioapic_debug("mask %x\n", mask); 200 ioapic_debug("mask %x\n", *mask);
201 return mask;
202} 201}
203 202
204static int ioapic_deliver(struct kvm_ioapic *ioapic, int irq) 203static int ioapic_deliver(struct kvm_ioapic *ioapic, int irq)
diff --git a/virt/kvm/ioapic.h b/virt/kvm/ioapic.h
index 008ec873d018..f395798bc1d1 100644
--- a/virt/kvm/ioapic.h
+++ b/virt/kvm/ioapic.h
@@ -70,7 +70,7 @@ void kvm_ioapic_update_eoi(struct kvm *kvm, int vector, int trigger_mode);
70int kvm_ioapic_init(struct kvm *kvm); 70int kvm_ioapic_init(struct kvm *kvm);
71int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int level); 71int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int level);
72void kvm_ioapic_reset(struct kvm_ioapic *ioapic); 72void kvm_ioapic_reset(struct kvm_ioapic *ioapic);
73u32 kvm_ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest, 73void kvm_ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest,
74 u8 dest_mode); 74 u8 dest_mode, unsigned long *mask);
75 75
76#endif 76#endif
diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
index aec7a0d93a3f..e8ff89c3cca7 100644
--- a/virt/kvm/irq_comm.c
+++ b/virt/kvm/irq_comm.c
@@ -49,8 +49,9 @@ void kvm_get_intr_delivery_bitmask(struct kvm_ioapic *ioapic,
49{ 49{
50 struct kvm_vcpu *vcpu; 50 struct kvm_vcpu *vcpu;
51 51
52 *deliver_bitmask = kvm_ioapic_get_delivery_bitmask(ioapic, 52 kvm_ioapic_get_delivery_bitmask(ioapic, entry->fields.dest_id,
53 entry->fields.dest_id, entry->fields.dest_mode); 53 entry->fields.dest_mode,
54 deliver_bitmask);
54 switch (entry->fields.delivery_mode) { 55 switch (entry->fields.delivery_mode) {
55 case IOAPIC_LOWEST_PRIORITY: 56 case IOAPIC_LOWEST_PRIORITY:
56 vcpu = kvm_get_lowest_prio_vcpu(ioapic->kvm, 57 vcpu = kvm_get_lowest_prio_vcpu(ioapic->kvm,