From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Williamson Subject: Re: [PATCH v5] kvm: Use a bitmap for tracking used GSIs Date: Wed, 13 May 2009 11:13:03 -0600 Message-ID: <1242234783.9456.167.camel@lappy> References: <20090513043835.6696.27384.stgit@dl380g6-3.ned.telco.ned.telco> <20090513150815.8221.49221.stgit@dl380g6-3.ned.telco.ned.telco> <20090513160519.GA1738@redhat.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, sheng.yang@intel.com, avi@redhat.com To: "Michael S. Tsirkin" Return-path: Received: from g1t0028.austin.hp.com ([15.216.28.35]:14898 "EHLO g1t0028.austin.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758950AbZEMRNG (ORCPT ); Wed, 13 May 2009 13:13:06 -0400 In-Reply-To: <20090513160519.GA1738@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, 2009-05-13 at 19:05 +0300, Michael S. Tsirkin wrote: > On Wed, May 13, 2009 at 09:13:38AM -0600, Alex Williamson wrote: > > @@ -323,6 +326,28 @@ kvm_context_t kvm_init(struct kvm_callbacks *callbacks, > > kvm->no_irqchip_creation = 0; > > kvm->no_pit_creation = 0; > > > > + gsi_count = kvm_get_gsi_count(kvm); > > + if (gsi_count > 0) { > > + int gsi_bytes, i; > > + > > + /* Round up so we can search ints using ffs */ > > + gsi_bytes = ((gsi_count + 31) / 32) * 4; > > Let's take ALIGN macro from linux/kernel.h? It's already defined in libkvm.c, I'll just move it up in the file. There's also a BITMAP_SIZE macro by it that looks like it can be nuked. > > + kvm->used_gsi_bitmap = malloc(gsi_bytes); > > + if (!kvm->used_gsi_bitmap) > > + goto out_close; > > + memset(kvm->used_gsi_bitmap, 0, gsi_bytes); > > + kvm->max_gsi = gsi_bytes * 8; > > + > > + /* Mark all the IOAPIC pin GSIs and any over-allocated > > + * GSIs as already in use. */ > > Align '*'s please. Argh, fixed. > > +#ifdef KVM_IOAPIC_NUM_PINS > > I think we should just export > #define KVM_IOAPIC_NUM_PINS 0 > for ppc in kernel headers (or in libkvm), > and get rid of this ifdef completely. Ok, I'll add an #ifndef and make it zero in libkvm.c. It can be cleaned out further from there. Thanks, Alex