linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: "Cousson, Benoit" <b-cousson@ti.com>
Cc: tony Lindgren <tony@atomide.com>,
	linux-omap <linux-omap@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"Nayak, Rajendra" <rnayak@ti.com>
Subject: Re: [PATCH] ARM: OMAP: irqs: Fix NR_IRQS value to handle PRCM interrupts
Date: Tue, 28 Feb 2012 20:43:20 +0000	[thread overview]
Message-ID: <20120228204320.GB5627@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <4F4D39DC.9020800@ti.com>

On Tue, Feb 28, 2012 at 09:32:28PM +0100, Cousson, Benoit wrote:
> Hi Russell,
>
> On 2/28/2012 3:36 PM, Russell King - ARM Linux wrote:
>> On Tue, Feb 28, 2012 at 02:10:09PM +0100, Cousson, Benoit wrote:
>>> The following commit: 2f31b51659c2d8315ea2888ba5b93076febe672b
>>> Author: Tero Kristo<t-kristo@ti.com>
>>> Date:   Fri Dec 16 14:37:00 2011 -0700
>>>
>>>      ARM: OMAP4: PRM: use PRCM interrupt handler
>>>
>>> introduced the PRCM interrupt handler and thus the need
>>> for 64 more interrupts. Since SPARSE_IRQ is still not fully
>>> functional on OMAP, the NR_IRQS needs to be updated to avoid
>>> the failure that happen during irq_alloc_descs call inside
>>> the PRCM driver:
>>>
>>> [    0.208221] PRCM: failed to allocate irq descs: -12
>>>
>>> Later the mux framework is then unable to request an IRQ from
>>> the PRCM interrupt handler.
>>>
>>> [    1.802795] mux: Failed to setup hwmod io irq -22
>>
>> This is fine for rc, but longer term...
>>
>> Do any of these have hard-coded interrupt numbers associated with them?
>> If not, just enabling sparse IRQ will sort this out.
>
> You're right, in that case, it does not depend on any hard-coded number.
>
>> As I tried to explain yesterday, there are two modes for IRQ allocation:
>>
>> 1. Without sparse IRQ enabled, irq_alloc_descs(-1, from, num, -1) will
>>     allocate IRQs _within_ the existing from..NR_IRQS range, and will fail
>>     if there is insufficient IRQs available.
>>
>> 2. With sparse IRQs enabled, irq_alloc_descs(-1, from, num, -1) will
>>     allocate IRQs starting at max(from, NR_IRQS) and working upwards.
>>
>> In either case, irq_alloc_descs(start, 0, num, -1) will allocate 'num'
>> IRQs at 'start' or fail if the range is already in use (and 0..NR_IRQS
>> is defined as 'being in use' when sparse IRQs are enabled.)
>>
>> So, if the PRCM interrupts aren't statically assigned (the code suggests
>> that they aren't) then it's already sparse-IRQ compliant, and enabling
>> sparse IRQ support will mean that they will be allocated above NR_IRQS.
>>
>> Therefore, I suggest rather than raising NR_IRQS, you instead enable
>> SPARSE_IRQ now so that anyone using the dynamic IRQ allocation can
>> benefit from sparse IRQ support without having to have a large NR_IRQS.
>>
>> So, you don't have to wait until everything is converted to use
>> sparse IRQ.  You just need to make sure that nothing uses
>> irq_alloc_descs(start, from, num, ...) where start<  NR_IRQS, and
>> nothing using that requires statically defined IRQ numbering.
>
> Yes, I fully agree, and that's still the plan. That's why I started  
> sending last week a bunch of cleanup for SPARSE_IRQ support.  
> Unfortunately, they might not be ready for 3.4 either, but I'm still  
> working on it.

One thing I didn't consider is that the GIC has been converted to
sparse IRQ support, so enabling it on OMAP will make the irq_alloc_descs()
in there to fail if you try and keep it below NR_IRQS.

That rules out a piecemeal conversion, which rather sucks.

  reply	other threads:[~2012-02-28 20:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-28 13:10 [PATCH] ARM: OMAP: irqs: Fix NR_IRQS value to handle PRCM interrupts Cousson, Benoit
2012-02-28 14:36 ` Russell King - ARM Linux
2012-02-28 20:32   ` Cousson, Benoit
2012-02-28 20:43     ` Russell King - ARM Linux [this message]
2012-02-28 23:55 ` Tony Lindgren

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=20120228204320.GB5627@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=b-cousson@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=rnayak@ti.com \
    --cc=tony@atomide.com \
    /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).