From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH] qemu-kvm: reserve the low 24 gsi values Date: Tue, 21 Jul 2009 20:21:15 +0300 Message-ID: <20090721172115.GD1424@redhat.com> References: <20090721155742.GC3229@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, avi@redhat.com To: "Michael S. Tsirkin" Return-path: Received: from mx2.redhat.com ([66.187.237.31]:34813 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755853AbZGURVR (ORCPT ); Tue, 21 Jul 2009 13:21:17 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n6LHLH3o011720 for ; Tue, 21 Jul 2009 13:21:17 -0400 Content-Disposition: inline In-Reply-To: <20090721155742.GC3229@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Jul 21, 2009 at 06:57:42PM +0300, Michael S. Tsirkin wrote: > reserve gsi 0 to 23 so that they won't be allocated for msi > In the not so distant future we may want to support more then one ioapic, so 23 will became 23*n where n is a number of ioapics. I prefer to fix it by moving msi injection to its own ioctl. But for now may be we can scan used_gsi_bitmap from the end during allocation of gsi for msi? > Signed-off-by: Michael S. Tsirkin > > --- > > diff --git a/qemu-kvm.c b/qemu-kvm.c > index c6c9fc6..f440b2d 100644 > --- a/qemu-kvm.c > +++ b/qemu-kvm.c > @@ -1613,10 +1613,12 @@ int kvm_get_irq_route_gsi(kvm_context_t kvm) > { > int i, bit; > uint32_t *buf = kvm->used_gsi_bitmap; > + uint32_t mask = 0xff000000; > > /* Return the lowest unused GSI in the bitmap */ > - for (i = 0; i < kvm->max_gsi / 32; i++) { > - bit = ffs(~buf[i]); > + for (i = 0; i < kvm->max_gsi / 32; i++) { > + bit = ffs(~buf[i] & mask); > + mask = 0xffffffff; > if (!bit) > continue; > -- Gleb.