qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] virtio-serial: Allow one MSI-X vector per virtqueue
@ 2011-12-16  1:14 zanghongyong
  2011-12-16  9:39 ` Amit Shah
  0 siblings, 1 reply; 5+ messages in thread
From: zanghongyong @ 2011-12-16  1:14 UTC (permalink / raw)
  To: qemu-devel
  Cc: aliguori, wusongwei, kvm, hanweidong, rusty, xiaowei.yang,
	Hongyong Zang, jiangningyu, amit.shah

From: Hongyong Zang <zanghongyong@huawei.com>

In pci_enable_msix(), the guest's virtio-serial driver tries to set msi-x
with one vector per queue. But it fails and eventually all virtio-serial
ports share one MSI-X vector. Because every virtio-serial port has *two*
virtqueues, virtio-serial needs (port+1)*2 vectors other than (port+1).

This patch allows every virtqueue to have its own MSI-X vector.
(When the MSI-X vectors needed are more than MSIX_MAX_ENTRIES defined in
qemu: msix.c, all the queues still share one MSI-X vector as before.)

Signed-off-by: Hongyong Zang <zanghongyong@huawei.com>
---
 hw/virtio-pci.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 77b75bc..2c9c6fb 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -718,8 +718,11 @@ static int virtio_serial_init_pci(PCIDevice *pci_dev)
         return -1;
     }
     vdev->nvectors = proxy->nvectors == DEV_NVECTORS_UNSPECIFIED
-                                        ? proxy->serial.max_virtserial_ports + 1
+                                        ? (proxy->serial.max_virtserial_ports + 1) * 2
                                         : proxy->nvectors;
+    /*msix.c: #define MSIX_MAX_ENTRIES 32*/
+    if (vdev->nvectors > 32)
+        vdev->nvectors = 32;
     virtio_init_pci(proxy, vdev);
     proxy->nvectors = vdev->nvectors;
     return 0;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-12-19  8:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-16  1:14 [Qemu-devel] [PATCH] virtio-serial: Allow one MSI-X vector per virtqueue zanghongyong
2011-12-16  9:39 ` Amit Shah
2011-12-19  6:09   ` Zang Hongyong
2011-12-19  7:26     ` Amit Shah
2011-12-19  8:49       ` Zang Hongyong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).