• L
    ivshmem: Don't update non-existent MSI routes · e6a354be
    Ladi Prosek 提交于
    As of commit 660c97ee ("ivshmem: use kvm irqfd for msi notifications"),
    QEMU crashes with:
    
      kvm_irqchip_commit_routes: Assertion `ret == 0' failed.
    
    if the ivshmem device is configured with more vectors than what the server
    supports. This is caused by the ivshmem_vector_unmask() being called on
    vectors that have not been initialized by ivshmem_add_kvm_msi_virq().
    
    This commit fixes it by adding a simple check to the mask and unmask
    callbacks.
    
    Note that the opposite mismatch, if the server supplies more vectors than
    what the device is configured for, is already handled and leads to output
    like:
    
      Too many eventfd received, device has 1 vectors
    
    To reproduce the assert, run:
    
      ivshmem-server -n 0
    
    and QEMU with:
    
      -device ivshmem-doorbell,chardev=iv
      -chardev socket,path=/tmp/ivshmem_socket,id=iv
    
    then load the Windows driver, at the time of writing available at:
    
    https://github.com/virtio-win/kvm-guest-drivers-windows/tree/master/ivshmem
    
    The issue is believed to have been masked by other guest drivers, notably
    Linux ones, not enabling MSI-X on the device.
    
    Fixes: 660c97ee ("ivshmem: use kvm irqfd for msi notifications")
    Signed-off-by: NLadi Prosek <lprosek@redhat.com>
    Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
    Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
    Message-Id: <20171211072110.9058-2-lprosek@redhat.com>
    Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
    e6a354be
ivshmem.c 36.6 KB