From patchwork Tue Jul 21 15:57:42 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 36557 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 n6LFwh3L003987 for ; Tue, 21 Jul 2009 15:58:43 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755069AbZGUP6k (ORCPT ); Tue, 21 Jul 2009 11:58:40 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755074AbZGUP6k (ORCPT ); Tue, 21 Jul 2009 11:58:40 -0400 Received: from mx2.redhat.com ([66.187.237.31]:59752 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754938AbZGUP6j (ORCPT ); Tue, 21 Jul 2009 11:58:39 -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 n6LFwer2022767 for ; Tue, 21 Jul 2009 11:58:40 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n6LFwdej011958; Tue, 21 Jul 2009 11:58:39 -0400 Received: from redhat.com (vpn-10-22.str.redhat.com [10.32.10.22]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n6LFwZRb007132; Tue, 21 Jul 2009 11:58:36 -0400 Date: Tue, 21 Jul 2009 18:57:42 +0300 From: "Michael S. Tsirkin" To: kvm@vger.kernel.org, avi@redhat.com, gleb@redhat.com Subject: [PATCH] qemu-kvm: reserve the low 24 gsi values Message-ID: <20090721155742.GC3229@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org reserve gsi 0 to 23 so that they won't be allocated for msi Signed-off-by: Michael S. Tsirkin --- -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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;