From 4a6ff469c734387276eaeb9cedb5ce5a68c3cbfc Mon Sep 17 00:00:00 2001
From: Amit Shah <amit.shah@redhat.com>
Date: Wed, 20 Jan 2010 15:52:36 -0200
Subject: [PATCH 3/4] virtio-serial: Use MSI vectors for port virtqueues

RH-Author: Amit Shah <amit.shah@redhat.com>
Message-id: <1264002757-5820-4-git-send-email-amit.shah@redhat.com>
Patchwork-id: 6490
O-Subject: [RHEL6 PATCH 3/4] virtio-serial: Use MSI vectors for port virtqueues
Bugzilla: 543825
RH-Acked-by: Juan Quintela <quintela@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>

This commit enables the use of MSI interrupts for virtqueue
notifications for ports. We use nr_ports + 1 (for control channel) msi
entries for the ports, as only the in_vq operations need an interrupt on
the guest.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
 hw/virtio-pci.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/virtio-pci.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index ea236bb..5abcc4b 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -497,10 +497,13 @@ static int virtio_serial_init_pci(PCIDevice *pci_dev)
     if (!vdev) {
         return -1;
     }
+    vdev->nvectors = proxy->nvectors ? proxy->nvectors
+                                     : proxy->max_virtserial_ports + 1;
     virtio_init_pci(proxy, vdev,
                     PCI_VENDOR_ID_REDHAT_QUMRANET,
                     PCI_DEVICE_ID_VIRTIO_CONSOLE,
                     proxy->class_code, 0x00);
+    proxy->nvectors = vdev->nvectors;
     return 0;
 }
 
@@ -577,6 +580,7 @@ static PCIDeviceInfo virtio_info[] = {
         .init      = virtio_serial_init_pci,
         .exit      = virtio_exit_pci,
         .qdev.props = (Property[]) {
+            DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 0),
             DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0),
             DEFINE_PROP_UINT32("max_ports", VirtIOPCIProxy, max_virtserial_ports,
                                31),
-- 
1.6.3.rc4.29.g8146

