From bc8c6788b60cbbe56700568bcb645e139ab29b7d Mon Sep 17 00:00:00 2001 From: Jason Baron Date: Wed, 28 Mar 2012 14:18:05 -0400 Subject: [PATCH] kvm: set gsi_bits and max_gsi correctly 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 Acked-by: Alex Williamson Acked-by: Jan Kiszka Signed-off-by: Marcelo Tosatti --- kvm-all.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kvm-all.c b/kvm-all.c index 5ff954abd7..b8e9dc69de 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -871,7 +871,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; -- 2.11.4.GIT