[...]

>>> +
>>> +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
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to