Re: [PATCH v5] kvm: Use a bitmap for tracking used GSIs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

> +		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.

> +#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.

Avi, agree?

> +		for (i = 0; i < min(KVM_IOAPIC_NUM_PINS, gsi_count); i++)
> +			set_bit(kvm->used_gsi_bitmap, i);
> +#endif
> +		for (i = gsi_count; i < kvm->max_gsi; i++)
> +			set_bit(kvm->used_gsi_bitmap, i);
> +	}
> +
>  	return kvm;
>   out_close:
>  	close(fd);

-- 
MST
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux