[PATCH 3/4] powerpc/mpic: Move internal interrupt source vector allocation to a separate function.

Sethi Varun-B16395 B16395 at freescale.com
Wed Mar 28 00:52:36 EST 2012



> -----Original Message-----
> From: Kumar Gala [mailto:galak at kernel.crashing.org]
> Sent: Tuesday, March 27, 2012 6:55 PM
> To: Sethi Varun-B16395
> Cc: Linuxppc-dev at lists.ozlabs.org
> Subject: Re: [PATCH 3/4] powerpc/mpic: Move internal interrupt source
> vector allocation to a separate function.
> 
> 
> On Mar 27, 2012, at 7:16 AM, Varun Sethi wrote:
> 
> > Allocate vector numbers for MPIC internal interrupt sources (IPIs and
> > Timers) in a separate function.
> >
> 
> Explain why you are making this change.


[Sethi Varun-B16395] With the current code it becomes fairly difficult to
add new internal interrupt sources. In my case I had to add 32 additional
interrupt sources corresponding to the MPIC error interrupts. It's more
convenient doing the internal interrupt source allocation using a loop.


> 
> > Signed-off-by: Varun Sethi <Varun.Sethi at freescale.com>
> > ---
> > arch/powerpc/include/asm/mpic.h |    7 +++++--
> > arch/powerpc/sysdev/mpic.c      |   30 +++++++++++++++++-------------
> > 2 files changed, 22 insertions(+), 15 deletions(-)
> >
> > diff --git a/arch/powerpc/include/asm/mpic.h
> > b/arch/powerpc/include/asm/mpic.h index 30e3b29..3929b4b 100644
> > --- a/arch/powerpc/include/asm/mpic.h
> > +++ b/arch/powerpc/include/asm/mpic.h
> > @@ -118,6 +118,9 @@
> > #define MPIC_MAX_CPUS		32
> > #define MPIC_MAX_ISU		32
> >
> > +#define MPIC_MAX_TIMER    8
> > +#define MPIC_MAX_IPI      4
> > +
> > /*
> >  * Tsi108 implementation of MPIC has many differences from the
> > original one  */ @@ -284,8 +287,8 @@ struct mpic
> > 	unsigned int		senses_count;
> >
> > 	/* vector numbers used for internal sources (ipi/timers) */
> > -	unsigned int		ipi_vecs[4];
> > -	unsigned int		timer_vecs[8];
> > +	unsigned int		ipi_vecs[MPIC_MAX_IPI];
> > +	unsigned int		timer_vecs[MPIC_MAX_TIMER];
> >
> > 	/* Spurious vector to program into unused sources */
> > 	unsigned int		spurious_vec;
> > diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
> > index 33520dd..c4da1d5 100644
> > --- a/arch/powerpc/sysdev/mpic.c
> > +++ b/arch/powerpc/sysdev/mpic.c
> > @@ -996,7 +996,8 @@ static int mpic_host_map(struct irq_host *h,
> unsigned int virq,
> > 	}
> > #endif /* CONFIG_SMP */
> >
> > -	if (hw >= mpic->timer_vecs[0] && hw <= mpic->timer_vecs[7]) {
> > +	if (hw >= mpic->timer_vecs[0] &&
> > +	    hw <= mpic->timer_vecs[MPIC_MAX_TIMER - 1]) {
> > 		WARN_ON(mpic->flags & MPIC_SECONDARY);
> >
> > 		DBG("mpic: mapping as timer\n");
> > @@ -1133,6 +1134,19 @@ static struct irq_host_ops mpic_host_ops = {
> > 	.xlate = mpic_host_xlate,
> > };
> >
> > +static void mpic_alloc_int_sources(struct mpic *mpic, int intvec_top)
> > +{
> > +	int i, intvec;
> > +
> > +	intvec = intvec_top;
> > +
> 
> local intvec is pointless.

[Sethi Varun-B16395] ok.

-Varun
 





More information about the Linuxppc-dev mailing list