Skip to contentSkip to conversation

kvmtool: fix wrong bus type and width in KVM_IOEVENTFD ioctl() call on MMIO bus

PATCH New Li Yu 1 participant 1 message Apr 1, 2015 KVM

lore
Share & tools
lore

Li Yu

author
#0 lore raw

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.

tools/kvm/virtio/pci.c +2 -1
index 7556239..fcf8e93 100644
@@ -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;