kvmtool: fix wrong bus type and width in KVM_IOEVENTFD ioctl() call on MMIO bus
PATCH 1/1 kvmtool: fix wrong bus type and width in KVM_IOEVENTFD ioctl() call on MMIO bus
This patch is to fix wrong parameters of ioctl(KVM_IOEVENTFD) calls, otherwise macvtap + vhost-net is broken, that is:
1. we should register these address range on MMIO bus instead of PIO bus.
2. the register VIRTIO_PCI_QUEUE_NOTIFY should be 16-bits width.
Signed-off-by Yu Li <[email protected]>
tools/kvm/virtio/pci.c +2 -1
@@ -57,8 +57,9 @@ static int virtio_pci__init_ioeventfd(struct kvm *kvm, struct virtio_device *vde/* mmio */ ioevent.io_addr = vpci->mmio_addr +VIRTIO_PCI_QUEUE_NOTIFY ; - ioevent.io_len =sizeof (u32); + ioevent.io_len =sizeof (u16); ioevent.fd = fds[1 ] =eventfd (0 ,0 ); + flags &= ~IOEVENTFD_FLAG_PIO ; r =ioeventfd__add_event (&ioevent, flags);if (r) goto free_ioport_evt;