Re: [patch 46/47] powerpc: Use new irq allocator

From: Benjamin Herrenschmidt
Date: Thu Sep 30 2010 - 20:45:54 EST


On Thu, 2010-09-30 at 23:18 +0000, Thomas Gleixner wrote:
> plain text document attachment (powerpc-use-new-allocator.patch)
> Use the new functions and free the descriptor when the virq is
> destroyed.

Looks ok as a first pass, but we should go further and replace the
allocator we have in powerpc to use yours instead.

Then I should get rid of my big irq_map that maps virq to HW number &
domain pointers and instead put those in the irq data. Any objection to
me sticking some archdata there for that purpose ?

That would make things much cleaner and in fact move one large step
toward being able to make powerpc virq scheme generic, which seems to be
a good idea from what I've heard :-)

Cheers,
Ben.

> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> ---
> arch/powerpc/kernel/irq.c | 17 +++++++++--------
> 1 file changed, 9 insertions(+), 8 deletions(-)
>
> Index: linux-2.6-tip/arch/powerpc/kernel/irq.c
> ===================================================================
> --- linux-2.6-tip.orig/arch/powerpc/kernel/irq.c
> +++ linux-2.6-tip/arch/powerpc/kernel/irq.c
> @@ -676,16 +676,15 @@ void irq_set_virq_count(unsigned int cou
> static int irq_setup_virq(struct irq_host *host, unsigned int virq,
> irq_hw_number_t hwirq)
> {
> - struct irq_desc *desc;
> + int res;
>
> - desc = irq_to_desc_alloc_node(virq, 0);
> - if (!desc) {
> + res = irq_alloc_desc_at(virq, 0);
> + if (res != virq) {
> pr_debug("irq: -> allocating desc failed\n");
> goto error;
> }
>
> - /* Clear IRQ_NOREQUEST flag */
> - desc->status &= ~IRQ_NOREQUEST;
> + irq_clear_status_flags(virq, IRQ_NOREQUEST);
>
> /* map it */
> smp_wmb();
> @@ -694,11 +693,13 @@ static int irq_setup_virq(struct irq_hos
>
> if (host->ops->map(host, virq, hwirq)) {
> pr_debug("irq: -> mapping failed, freeing\n");
> - goto error;
> + goto errdesc;
> }
>
> return 0;
>
> +errdesc:
> + irq_free_descs(virq, 1);
> error:
> irq_free_virt(virq, 1);
> return -1;
> @@ -877,9 +878,9 @@ void irq_dispose_mapping(unsigned int vi
> smp_mb();
> irq_map[virq].hwirq = host->inval_irq;
>
> - /* Set some flags */
> - irq_to_desc(virq)->status |= IRQ_NOREQUEST;
> + irq_set_status_flags(virq, IRQ_NOREQUEST);
>
> + irq_free_descs(virq, 1);
> /* Free it */
> irq_free_virt(virq, 1);
> }
>


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/