[PATCH v4 09/13] ARM: KVM: VGIC interrupt injection
From: Christoffer Dall <hidden>
Date: 2012-12-03 14:58:09
Also in:
kvm
From: Christoffer Dall <hidden>
Date: 2012-12-03 14:58:09
Also in:
kvm
[...]
quoted
quoted
+ +static bool vgic_update_irq_state(struct kvm *kvm, int cpuid, + unsigned int irq_num, bool level) +{ + struct vgic_dist *dist = &kvm->arch.vgic; + struct kvm_vcpu *vcpu; + int is_edge, is_level, state; + int enabled; + bool ret = true; + + spin_lock(&dist->lock); + + is_edge = vgic_irq_is_edge(dist, irq_num); + is_level = !is_edge; + state = vgic_bitmap_get_irq_val(&dist->irq_state, cpuid, irq_num); + + /* + * Only inject an interrupt if: + * - level triggered and we change level + * - edge triggered and we have a rising edge + */ + if ((is_level && !(state ^ level)) || (is_edge && (state || !level))) { + ret = false; + goto out; + }Eek, more of the edge/level combo. Can this be be restructured so that we have vgic_update_{edge,level}_irq_state, which are called from here appropriately?I'll have a look.
oh, you're no fun anymore. That if statement is one of the funniest pieces of this code. -Christoffer