From patchwork Wed Apr 8 02:30:56 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sheng Yang X-Patchwork-Id: 16994 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n382Ver1029165 for ; Wed, 8 Apr 2009 02:31:41 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759124AbZDHCbA (ORCPT ); Tue, 7 Apr 2009 22:31:00 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758336AbZDHCa7 (ORCPT ); Tue, 7 Apr 2009 22:30:59 -0400 Received: from mga11.intel.com ([192.55.52.93]:64770 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755090AbZDHCa7 (ORCPT ); Tue, 7 Apr 2009 22:30:59 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 07 Apr 2009 19:26:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.39,341,1235980800"; d="scan'208";a="445973592" Received: from syang10-desktop.sh.intel.com (HELO syang10-desktop) ([10.239.13.189]) by fmsmga002.fm.intel.com with ESMTP; 07 Apr 2009 19:26:06 -0700 Received: from yasker by syang10-desktop with local (Exim 4.69) (envelope-from ) id 1LrNZ2-0003z3-M6; Wed, 08 Apr 2009 10:30:56 +0800 From: Sheng Yang To: Avi Kivity Cc: kvm@vger.kernel.org, Alex Williamson , Sheng Yang Subject: [PATCH] kvm: Fix wrong counting of MSI-X table size Date: Wed, 8 Apr 2009 10:30:56 +0800 Message-Id: <1239157856-15295-1-git-send-email-sheng@linux.intel.com> X-Mailer: git-send-email 1.5.6.3 MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The PCI spec said... System software reads this field to determine the MSI-X Table Size *N*, which is encoded as *N-1*. For example, a returned value of “00000000011” indicates a table size of 4. Signed-off-by: Sheng Yang --- qemu/hw/device-assignment.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/qemu/hw/device-assignment.c b/qemu/hw/device-assignment.c index 09e54ae..f33ce3c 100644 --- a/qemu/hw/device-assignment.c +++ b/qemu/hw/device-assignment.c @@ -818,6 +818,7 @@ static int assigned_dev_update_msix_mmio(PCIDevice *pci_dev) entries_max_nr = pci_dev->config[pos + 2]; entries_max_nr &= PCI_MSIX_TABSIZE; + entries_max_nr += 1; /* Get the usable entry number for allocating */ for (i = 0; i < entries_max_nr; i++) {