Yang, Sheng wrote:
To deal with guest shared interrupt bug in in-kernel irqchip, we should:

1. Identify each level trig interrupt source.
2. Implement logical OR on the same IRQ line for each interrupt source.

Here I chose a simple method: the caller of kvm_set_irq() has responsiblity
to identify interrupt sources, and IOAPIC/PIC ensure logical OR on IRQ line.

The downside is that every caller has to do this edge detection.

How about allocating a vector of u32s (one per irq), and each source will allocate a bit within this vector. The 'or' operation becomes (word != 0).

For example:

irq_src = kvm_irq_allocate_source(kvm); /* allocate bit within irq vector */

   ...

  kvm_set_irq(kvm, irq, 1, irq_src);

kvm_set_irq(...)
{
   // locking?
   if (level)
       set_bit(irq_src, &kvm->irq_state[irq]);
   else
       clear_bit(irq_src, &kvm->irq_state[irq]);
  kvm_pic_set_irq(kvm, irq, !!kvm->irq_state[irq]);
  kvm_ioapic_set_irq(kvm, irq, !!kvm->irq_state[irq]);
}

kvm_irq_allocate_source(kvm)
{
    irq_src = find_first_clear_bit(kvm->irq_sources);
    set_bit(irq_src, &kvm->irq_sources);
    return irq_src;
}

This also keeps the pic and ioapic out of the picture, which is good. It also allows us to implement negative polarity easily in the future.

--
error compiling committee.c: too many arguments to function

--
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