From mboxrd@z Thu Jan 1 00:00:00 1970 From: Li Yu Subject: [PATCH] kvmtool: fix wrong bus type and width in KVM_IOEVENTFD ioctl() call on MMIO bus Date: Wed, 01 Apr 2015 17:27:49 +0800 Message-ID: <551BBA15.4080409@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 7bit To: kvm@vger.kernel.org Return-path: Received: from mail-pa0-f47.google.com ([209.85.220.47]:36471 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751044AbbDAJ2F (ORCPT ); Wed, 1 Apr 2015 05:28:05 -0400 Received: by padcy3 with SMTP id cy3so46899830pad.3 for ; Wed, 01 Apr 2015 02:28:04 -0700 (PDT) Received: from [10.32.164.87] ([202.55.20.10]) by mx.google.com with ESMTPSA id hr5sm1472044pbb.44.2015.04.01.02.28.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Apr 2015 02:28:03 -0700 (PDT) Sender: kvm-owner@vger.kernel.org List-ID: 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 diff --git a/tools/kvm/virtio/pci.c b/tools/kvm/virtio/pci.c index 7556239..fcf8e93 100644 --- a/tools/kvm/virtio/pci.c +++ b/tools/kvm/virtio/pci.c @@ -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;