linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: gic: fix irq_alloc_descs handling for sparse irq
Date: Sat, 22 Oct 2011 22:43:19 -0500	[thread overview]
Message-ID: <4EA38D57.8050007@gmail.com> (raw)
In-Reply-To: <20111022203635.GA30950@n2100.arm.linux.org.uk>

Russell,

On 10/22/2011 03:36 PM, Russell King - ARM Linux wrote:
> On Sat, Oct 22, 2011 at 03:20:08PM -0500, Rob Herring wrote:
>> @@ -657,7 +664,7 @@ int __init gic_of_init(struct device_node *node, struct device_node *parent)
>>  
>>  	domain->of_node = of_node_get(node);
>>  
>> -	gic_init(gic_cnt, 16, dist_base, cpu_base);
>> +	gic_init(gic_cnt, -1, dist_base, cpu_base);
>>  
>>  	if (parent) {
>>  		irq = irq_of_parse_and_map(node, 0);
> 
> You don't explain this change - '16' is used here to skip the SGI
> interrupts which will never be passed to the generic IRQ subsystem
> from the GIC.

This makes irq_alloc_descs do dynamic IRQ# assignment rather than
allocating at the specified IRQ#.

> 
> Moreover, the second parameter is an unsigned integer, not a signed
> integer.
> 
> And not only that, but:
> 
>         gic->irq_offset = (irq_start - 1) & ~31;
> 
> means that irq_offset ends up being -2 & ~31, or -32.  Do you really
> want the PPIs to generate IRQ numbers from -16 to -1 ?  It doesn't stop
> there:
> 
>         for (i = irq_start; i < irq_limit; i++) {
>                 irq_set_chip_and_handler(i, &gic_chip, handle_fasteoi_irq);
>                 irq_set_chip_data(i, gic);
>                 set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
>         }
> 
> This will start from -1 to irq_limit (-1 + number of GIC IRQs).
> 
> Basically, -1 is not legal here - 1 is the minimum valid value that
> this function takes for proper operation - but that's just wasteful, so
> 16 is the realistic minimum value.

You're not looking at the right version of gic code. This is the basis
of this patch which has changes to the lines you reference:

http://lists.infradead.org/pipermail/linux-arm-kernel/2011-September/067588.html

You are right about irq_start needing to be signed.

Rob

  reply	other threads:[~2011-10-23  3:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-22 20:20 [PATCH] ARM: gic: fix irq_alloc_descs handling for sparse irq Rob Herring
2011-10-22 20:36 ` Russell King - ARM Linux
2011-10-23  3:43   ` Rob Herring [this message]
2011-10-24 14:36 ` [PATCH v2] " Rob Herring
2011-11-14 13:19   ` Magnus Damm
2011-11-14 14:11     ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EA38D57.8050007@gmail.com \
    --to=robherring2@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).