On 24/01/2017 15:44, Michael S. Tsirkin wrote: > On Tue, Jan 24, 2017 at 10:25:00AM +0100, Paolo Bonzini wrote: >> >> >> On 23/01/2017 18:04, Michael S. Tsirkin wrote: >>>> For virtio-blk, my patch moved the setting of ISR from >>>> virtio_queue_guest_notifier_read to virtio_notify_irqfd. This is >>>> because the irqfd emulation only needs to trigger the interrupt. >>>> Setting the ISR should have been done elsewhere. >>>> >>>> Can vhost set ISR (I thought it couldn't)? If so, it seems like ARM was >>>> relying on QEMU's irqfd emulation, as a work around for vhost not >>>> setting ISR. But this only works if irqfd is directed to QEMU and not >>>> to KVM. So if vhost cannot set ISR, I think vhost should be disabled >>>> unless MSI is active. >>>> >>>> Am I missing something? >>> >>> vhost doesn't set ISR ATM. Without MSI we are always bouncing >>> interrupts through QEMU in particular in order to set ISR. >> >> Where is the code that disables KVM irqfd? > > This bit in virtio_pci_set_guest_notifiers does the trick I think: > > > bool with_irqfd = msix_enabled(&proxy->pci_dev) && > kvm_msi_via_irqfd_enabled(); > > I don't think we ever used irqfd for level interrupts.
Ok, thanks! So we have four cases: - assign with emulated irqfd + ISR - assign with emulated irqfd - assign with irqfd - deassign Currently we don't distinguish the first two, so (which I don't like) Shannon's patch ends up setting ISR twice. The only (ugly) solution that comes to mind is making with_irqfd an enum... Paolo