From patchwork Fri Dec 16 01:14:26 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zanghongyong@huawei.com X-Patchwork-Id: 131768 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 592601007D7 for ; Fri, 16 Dec 2011 13:09:13 +1100 (EST) Received: from localhost ([::1]:40003 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RbNEU-0003Qc-82 for incoming@patchwork.ozlabs.org; Thu, 15 Dec 2011 21:09:10 -0500 Received: from eggs.gnu.org ([140.186.70.92]:47608) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RbNEM-0003QR-01 for qemu-devel@nongnu.org; Thu, 15 Dec 2011 21:09:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RbNEK-0006Ev-8T for qemu-devel@nongnu.org; Thu, 15 Dec 2011 21:09:01 -0500 Received: from szxga03-in.huawei.com ([58.251.152.66]:35374) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RbNEI-0006Ee-T6 for qemu-devel@nongnu.org; Thu, 15 Dec 2011 21:09:00 -0500 Received: from huawei.com (szxga03-in [172.24.2.9]) by szxga03-in.huawei.com (iPlanet Messaging Server 5.2 HotFix 2.14 (built Aug 8 2006)) with ESMTP id <0LW900DBXXYDYW@szxga03-in.huawei.com> for qemu-devel@nongnu.org; Fri, 16 Dec 2011 10:08:37 +0800 (CST) Received: from szxrg01-dlp.huawei.com ([172.24.2.119]) by szxga03-in.huawei.com (iPlanet Messaging Server 5.2 HotFix 2.14 (built Aug 8 2006)) with ESMTP id <0LW9003E0XYDZH@szxga03-in.huawei.com> for qemu-devel@nongnu.org; Fri, 16 Dec 2011 10:08:37 +0800 (CST) Received: from szxeml202-edg.china.huawei.com ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.1.9-GA) with ESMTP id AFV87132; Fri, 16 Dec 2011 10:08:37 +0800 Received: from SZXEML406-HUB.china.huawei.com (10.82.67.93) by szxeml202-edg.china.huawei.com (172.24.2.42) with Microsoft SMTP Server (TLS) id 14.1.323.3; Fri, 16 Dec 2011 10:08:25 +0800 Received: from localhost.localdomain (10.166.29.45) by szxeml406-hub.china.huawei.com (10.82.67.93) with Microsoft SMTP Server id 14.1.323.3; Fri, 16 Dec 2011 10:08:30 +0800 Date: Fri, 16 Dec 2011 09:14:26 +0800 From: zanghongyong@huawei.com X-Originating-IP: [10.166.29.45] To: qemu-devel@nongnu.org Message-id: <1323998066-2396-1-git-send-email-zanghongyong@huawei.com> MIME-version: 1.0 X-Mailer: git-send-email 1.7.0.4 Content-type: text/plain Content-transfer-encoding: 7BIT X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: Solaris 9 X-Received-From: 58.251.152.66 Cc: aliguori@us.ibm.com, wusongwei@huawei.com, kvm@vger.kernel.org, hanweidong@huawei.com, rusty@rustcorp.com.au, xiaowei.yang@huawei.com, Hongyong Zang , jiangningyu@huawei.com, amit.shah@redhat.com Subject: [Qemu-devel] [PATCH] virtio-serial: Allow one MSI-X vector per virtqueue X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Hongyong Zang 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 --- 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;