From mboxrd@z Thu Jan 1 00:00:00 1970 From: 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> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org, Alex Williamson , Sheng Yang To: Avi Kivity Return-path: 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 Sender: kvm-owner@vger.kernel.org List-ID: 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 =E2=80=9C00= 000000011=E2=80=9D 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) =20 entries_max_nr =3D pci_dev->config[pos + 2]; entries_max_nr &=3D PCI_MSIX_TABSIZE; + entries_max_nr +=3D 1; =20 /* Get the usable entry number for allocating */ for (i =3D 0; i < entries_max_nr; i++) { --=20 1.5.4.5