From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason Baron Subject: [PATCH] kvm: set gsi_bits and max_gsi correctly Date: Wed, 28 Mar 2012 14:18:05 -0400 Message-ID: <201203281818.q2SII5ng021559@int-mx11.intmail.prod.int.phx2.redhat.com> Cc: qemu-devel@nongnu.org, jan.kiszka@siemens.com, alex.williamson@redhat.com To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:62628 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932302Ab2C1SSJ (ORCPT ); Wed, 28 Mar 2012 14:18:09 -0400 Sender: kvm-owner@vger.kernel.org List-ID: The current kvm_init_irq_routing() doesn't set up the used_gsi_bitmap correctly, and as a consequence pins max_gsi to 32 when it really should be 1024. I ran into this limitation while testing pci passthrough, where I consistently got an -ENOSPC return from kvm_get_irq_route_gsi() called from assigned_dev_update_msix_mmio(). Signed-off-by: Jason Baron --- kvm-all.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index ab88c7c..b616c7d 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -873,7 +873,7 @@ static void kvm_init_irq_routing(KVMState *s) unsigned int gsi_bits, i; /* Round up so we can search ints using ffs */ - gsi_bits = (gsi_count + 31) / 32; + gsi_bits = ALIGN(gsi_count, 32); s->used_gsi_bitmap = g_malloc0(gsi_bits / 8); s->max_gsi = gsi_bits; -- 1.7.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:35176) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCxRk-0007m1-MO for qemu-devel@nongnu.org; Wed, 28 Mar 2012 14:18:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SCxRg-0006Ld-6r for qemu-devel@nongnu.org; Wed, 28 Mar 2012 14:18:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47066) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCxRf-0006LI-IM for qemu-devel@nongnu.org; Wed, 28 Mar 2012 14:18:07 -0400 Date: Wed, 28 Mar 2012 14:18:05 -0400 From: Jason Baron Message-Id: <201203281818.q2SII5ng021559@int-mx11.intmail.prod.int.phx2.redhat.com> Subject: [Qemu-devel] [PATCH] kvm: set gsi_bits and max_gsi correctly List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: kvm@vger.kernel.org Cc: jan.kiszka@siemens.com, alex.williamson@redhat.com, qemu-devel@nongnu.org The current kvm_init_irq_routing() doesn't set up the used_gsi_bitmap correctly, and as a consequence pins max_gsi to 32 when it really should be 1024. I ran into this limitation while testing pci passthrough, where I consistently got an -ENOSPC return from kvm_get_irq_route_gsi() called from assigned_dev_update_msix_mmio(). Signed-off-by: Jason Baron --- kvm-all.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index ab88c7c..b616c7d 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -873,7 +873,7 @@ static void kvm_init_irq_routing(KVMState *s) unsigned int gsi_bits, i; /* Round up so we can search ints using ffs */ - gsi_bits = (gsi_count + 31) / 32; + gsi_bits = ALIGN(gsi_count, 32); s->used_gsi_bitmap = g_malloc0(gsi_bits / 8); s->max_gsi = gsi_bits; -- 1.7.1