Subject: Re: [PATCH 6/7] MPIC MSI allocator

From: [email-masked] (Olof Johansson)
Date: Sun, 22 Apr 2007 22:50:25 -0500

On Thu, Apr 19, 2007 at 05:35:28PM +1000, Michael Ellerman wrote:
> To support MSI on MPIC we need a way to reserve and allocate hardware irq
> numbers, this patch implements an allocator for that.
> 
> New firmware platforms must define a "msi-available-ranges" property on their
> MPIC node for MSI to work. For BROKEN_U3 we do a best-guess setup.

It's time to rename BROKEN_U3. It used to be the config option to enable
a few workarounds, but now it's used to select whenever there's a U3 in
the system. Care to do it in the scope of this patch set?

> Index: msi-new/include/asm-powerpc/mpic.h
> ===================================================================
> --- msi-new.orig/include/asm-powerpc/mpic.h
> +++ msi-new/include/asm-powerpc/mpic.h
> @@ -292,6 +292,11 @@ struct mpic
>  	u32			*hw_set;
>  #endif
>  
> +#ifdef CONFIG_PCI_MSI
> +	spinlock_t		bitmap_lock;
> +	unsigned long		*hwirq_bitmap;
> +#endif

Besides the #ifdef there's nothing in the name that indicates that it's
used for msi. Better names could be useful.

> @@ -440,5 +445,11 @@ void mpic_set_clk_ratio(struct mpic *mpi
>  /* Enable/Disable EPIC serial interrupt mode */
>  void mpic_set_serial_int(struct mpic *mpic, int enable);
>  
> +#ifdef CONFIG_PCI_MSI
> +extern int mpic_msi_init_allocator(struct mpic *mpic);
> +extern irq_hw_number_t mpic_msi_alloc_hwirqs(struct mpic *mpic, int num);
> +extern void mpic_msi_free_hwirqs(struct mpic *mpic, int offset, int num);
> +#endif

These should go in mpic.h instead.

-Olof