Avi Kivity wrote: >> +static void kvm_pci_pt_work_fn(struct work_struct *work) +{ >> + struct kvm_pci_pt_dev_list *match; >> + struct kvm_pci_pt_work *int_work; >> + int source; >> + unsigned long flags; >> + int guest_irq; >> + int host_irq; >> + >> + int_work = container_of(work, struct kvm_pci_pt_work, work); + >> + source = int_work->source ? KVM_PT_SOURCE_IRQ_ACK : >> KVM_PT_SOURCE_IRQ; + + /* This is taken to safely inject irq inside >> the guest. When + * the interrupt injection (or the ioapic code) >> uses a + * finer-grained lock, update this >> + */ >> + mutex_lock(&int_work->kvm->lock); >> + read_lock_irqsave(&kvm_pci_pt_lock, flags); >> + match = kvm_find_pci_pt_dev(&int_work->kvm->arch.pci_pt_dev_head, >> NULL, + int_work->irq, source); >> + if (!match) { >> + printk(KERN_ERR "%s: no matching device assigned to guest " >> + "found for irq %d, source = %d!\n", >> + __func__, int_work->irq, int_work->source); >> + read_unlock_irqrestore(&kvm_pci_pt_lock, flags); + goto out; >> + } >> + guest_irq = match->pt_dev.guest.irq; >> + host_irq = match->pt_dev.host.irq; >> + read_unlock_irqrestore(&kvm_pci_pt_lock, flags); >> + >> + if (source == KVM_PT_SOURCE_IRQ) >> + kvm_set_irq(int_work->kvm, guest_irq, 1); >> + else { >> + kvm_set_irq(int_work->kvm, int_work->irq, 0); >> + enable_irq(host_irq); >> + } >> +out: >> + mutex_unlock(&int_work->kvm->lock); >> + kvm_put_kvm(int_work->kvm); >> +} >> >> + >> +/* FIXME: Implement the OR logic needed to make shared interrupts >> on + * this line behave properly + */ >> > > Isn't this a showstopper? There is no easy way for a user to avoid > sharing, especially as we have only three pci irqs at present. >
Currently it's not easy to avoid sharing. I think we can support MSI for assgined device to solve sharing problem. Randy (Weidong) -- 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