Commit e5871be0 authored by Sheng Yang's avatar Sheng Yang Committed by Avi Kivity

KVM: Change API of kvm_ioapic_get_delivery_bitmask

In order to use with bit ops.
Signed-off-by: default avatarSheng Yang <sheng@linux.intel.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent 116191b6
...@@ -161,22 +161,22 @@ static void ioapic_inj_nmi(struct kvm_vcpu *vcpu) ...@@ -161,22 +161,22 @@ static void ioapic_inj_nmi(struct kvm_vcpu *vcpu)
kvm_vcpu_kick(vcpu); kvm_vcpu_kick(vcpu);
} }
u32 kvm_ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest, void kvm_ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest,
u8 dest_mode) u8 dest_mode, unsigned long *mask)
{ {
u32 mask = 0;
int i; int i;
struct kvm *kvm = ioapic->kvm; struct kvm *kvm = ioapic->kvm;
struct kvm_vcpu *vcpu; struct kvm_vcpu *vcpu;
ioapic_debug("dest %d dest_mode %d\n", dest, dest_mode); ioapic_debug("dest %d dest_mode %d\n", dest, dest_mode);
*mask = 0;
if (dest_mode == 0) { /* Physical mode. */ if (dest_mode == 0) { /* Physical mode. */
if (dest == 0xFF) { /* Broadcast. */ if (dest == 0xFF) { /* Broadcast. */
for (i = 0; i < KVM_MAX_VCPUS; ++i) for (i = 0; i < KVM_MAX_VCPUS; ++i)
if (kvm->vcpus[i] && kvm->vcpus[i]->arch.apic) if (kvm->vcpus[i] && kvm->vcpus[i]->arch.apic)
mask |= 1 << i; *mask |= 1 << i;
return mask; return;
} }
for (i = 0; i < KVM_MAX_VCPUS; ++i) { for (i = 0; i < KVM_MAX_VCPUS; ++i) {
vcpu = kvm->vcpus[i]; vcpu = kvm->vcpus[i];
...@@ -184,7 +184,7 @@ u32 kvm_ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest, ...@@ -184,7 +184,7 @@ u32 kvm_ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest,
continue; continue;
if (kvm_apic_match_physical_addr(vcpu->arch.apic, dest)) { if (kvm_apic_match_physical_addr(vcpu->arch.apic, dest)) {
if (vcpu->arch.apic) if (vcpu->arch.apic)
mask = 1 << i; *mask = 1 << i;
break; break;
} }
} }
...@@ -195,10 +195,9 @@ u32 kvm_ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest, ...@@ -195,10 +195,9 @@ u32 kvm_ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest,
continue; continue;
if (vcpu->arch.apic && if (vcpu->arch.apic &&
kvm_apic_match_logical_addr(vcpu->arch.apic, dest)) 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); ioapic_debug("mask %x\n", *mask);
return mask;
} }
static int ioapic_deliver(struct kvm_ioapic *ioapic, int irq) static int ioapic_deliver(struct kvm_ioapic *ioapic, int irq)
......
...@@ -70,7 +70,7 @@ void kvm_ioapic_update_eoi(struct kvm *kvm, int vector, int trigger_mode); ...@@ -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_init(struct kvm *kvm);
int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int level); int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int level);
void kvm_ioapic_reset(struct kvm_ioapic *ioapic); void kvm_ioapic_reset(struct kvm_ioapic *ioapic);
u32 kvm_ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest, void kvm_ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest,
u8 dest_mode); u8 dest_mode, unsigned long *mask);
#endif #endif
...@@ -49,8 +49,9 @@ void kvm_get_intr_delivery_bitmask(struct kvm_ioapic *ioapic, ...@@ -49,8 +49,9 @@ void kvm_get_intr_delivery_bitmask(struct kvm_ioapic *ioapic,
{ {
struct kvm_vcpu *vcpu; struct kvm_vcpu *vcpu;
*deliver_bitmask = kvm_ioapic_get_delivery_bitmask(ioapic, kvm_ioapic_get_delivery_bitmask(ioapic, entry->fields.dest_id,
entry->fields.dest_id, entry->fields.dest_mode); entry->fields.dest_mode,
deliver_bitmask);
switch (entry->fields.delivery_mode) { switch (entry->fields.delivery_mode) {
case IOAPIC_LOWEST_PRIORITY: case IOAPIC_LOWEST_PRIORITY:
vcpu = kvm_get_lowest_prio_vcpu(ioapic->kvm, vcpu = kvm_get_lowest_prio_vcpu(ioapic->kvm,
......
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