On registering the ioeventfds for the virtio-pci device we cover both
the I/O ports and the MMIO BAR.
But as the current code advertises both as PIO, the host kernel gets
the wrong bus number for the MMIO region.
Fix the issue by marking only the actual PIO area as PIO.
This fixes vhost-net on x86.

Signed-off-by: Andre Przywara <andre.przyw...@arm.com>
---
 virtio/pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/virtio/pci.c b/virtio/pci.c
index 2dff13b..90fcd64 100644
--- a/virtio/pci.c
+++ b/virtio/pci.c
@@ -25,7 +25,7 @@ static int virtio_pci__init_ioeventfd(struct kvm *kvm, struct 
virtio_device *vde
 {
        struct ioevent ioevent;
        struct virtio_pci *vpci = vdev->virtio;
-       int i, r, flags = IOEVENTFD_FLAG_PIO;
+       int i, r, flags = 0;
        int fds[2];
 
        vpci->ioeventfds[vq] = (struct virtio_pci_ioevent_param) {
@@ -51,7 +51,7 @@ static int virtio_pci__init_ioeventfd(struct kvm *kvm, struct 
virtio_device *vde
        ioevent.io_addr = vpci->port_addr + VIRTIO_PCI_QUEUE_NOTIFY;
        ioevent.io_len  = sizeof(u16);
        ioevent.fd      = fds[0] = eventfd(0, 0);
-       r = ioeventfd__add_event(&ioevent, flags);
+       r = ioeventfd__add_event(&ioevent, flags | IOEVENTFD_FLAG_PIO);
        if (r)
                return r;
 
-- 
2.3.5

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to