* How to use linear mapping without DT?
@ 2012-06-14 9:54 ludovic.desroches
2012-06-15 16:01 ` Shawn Guo
0 siblings, 1 reply; 6+ messages in thread
From: ludovic.desroches @ 2012-06-14 9:54 UTC (permalink / raw)
To: linux-arm-kernel
Hello,
In fact, my question depends on sparse irq, irq domain and non DT.
I have enabled sparse_irq use for at91 sub architecture. I don't know if
it is the good solution... I won't like to use n_irqs in my machine
descriptor. I think the goal of sparse irq is to allocate the irq
descriptor only when the irq is used. It's better than allocating the
range that can be managed by the controller which should be indicated by
nr_irqs.
In this case using the legacy irq domain is not the right solution since
I will have to allocate the range of irq managed by the controller.
Moving to linear irq domain should be better. Moreover, I have seen that
Grant may want to remove it.
So, how to move to linear irq domain? In DT case, all the interrupts
into the DT are mapped so the irq descriptor is allocated and my device
will have the right virq number. In non DT case, my device has an irq
number corresponding to a fixed value (which is in fact the hwirq
number) but probably not to any existing virq.
So how to get a valid virq? Do I have to call irq_create_mapping from my
driver? It's probably not the right way... Should I keep legacy domain
and set nr_irqs?
Thanks
Regards
Ludovic
^ permalink raw reply [flat|nested] 6+ messages in thread
* How to use linear mapping without DT?
2012-06-14 9:54 How to use linear mapping without DT? ludovic.desroches
@ 2012-06-15 16:01 ` Shawn Guo
2012-06-15 16:07 ` Mark Brown
2012-06-15 16:32 ` ludovic.desroches
0 siblings, 2 replies; 6+ messages in thread
From: Shawn Guo @ 2012-06-15 16:01 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Jun 14, 2012 at 11:54:36AM +0200, ludovic.desroches wrote:
> Hello,
>
> In fact, my question depends on sparse irq, irq domain and non DT.
>
> I have enabled sparse_irq use for at91 sub architecture. I don't
> know if it is the good solution... I won't like to use n_irqs in my
> machine descriptor. I think the goal of sparse irq is to allocate
> the irq descriptor only when the irq is used. It's better than
> allocating the range that can be managed by the controller which
> should be indicated by nr_irqs.
>
> In this case using the legacy irq domain is not the right solution
> since I will have to allocate the range of irq managed by the
> controller. Moving to linear irq domain should be better. Moreover,
> I have seen that Grant may want to remove it.
>
> So, how to move to linear irq domain? In DT case, all the interrupts
> into the DT are mapped so the irq descriptor is allocated and my
> device will have the right virq number. In non DT case, my device
> has an irq number corresponding to a fixed value (which is in fact
> the hwirq number) but probably not to any existing virq.
>
> So how to get a valid virq? Do I have to call irq_create_mapping
> from my driver? It's probably not the right way... Should I keep
> legacy domain and set nr_irqs?
>
Short answer - Don't use linear but legacy domain for non-DT.
I was getting punched on the head for thinking about using legacy
domain for non-DT.[1] Also Documentation/IRQ-domain.txt suggests
that as below.
| The Legacy mapping is a special case for drivers that already have a
| range of irq_descs allocated for the hwirqs. It is used when the
| driver cannot be immediately converted to use the linear mapping. For
| example, many embedded system board support files use a set of #defines
| for IRQ numbers that are passed to struct device registrations. In that
| case the Linux IRQ numbers cannot be dynamically assigned and the legacy
| mapping should be used.
So as long as you need to support non-DT users, you will need to use
legacy domain. But that does not necessarily mean you need to set
.nr_irqs in mach_desc for enabling spare-irq. If you have all your
irqchips call irq_alloc_descs to allocate their irqdescs, you can enable
spare-irq without the need of setting .nr_irq. I posted the series
"[PATCH 00/16] Enable SPARSE_IRQ support for imx" yesterday doing that
for imx.
Regards,
Shawn
[1] http://thread.gmane.org/gmane.linux.ports.arm.kernel/151860/focus=152072
^ permalink raw reply [flat|nested] 6+ messages in thread
* How to use linear mapping without DT?
2012-06-15 16:01 ` Shawn Guo
@ 2012-06-15 16:07 ` Mark Brown
2012-06-15 16:32 ` ludovic.desroches
1 sibling, 0 replies; 6+ messages in thread
From: Mark Brown @ 2012-06-15 16:07 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Jun 16, 2012 at 12:01:57AM +0800, Shawn Guo wrote:
> Short answer - Don't use linear but legacy domain for non-DT.
...except if the domain is internal to a device in which case the device
can easily find the domain to do the mappings and linear works perfectly
fine.
> [1] http://thread.gmane.org/gmane.linux.ports.arm.kernel/151860/focus=152072
Note Grant's followup here, this applies to the case where you've got
devices using the interrupt controller with raw numbers.
^ permalink raw reply [flat|nested] 6+ messages in thread
* How to use linear mapping without DT?
2012-06-15 16:01 ` Shawn Guo
2012-06-15 16:07 ` Mark Brown
@ 2012-06-15 16:32 ` ludovic.desroches
2012-06-16 2:35 ` Shawn Guo
1 sibling, 1 reply; 6+ messages in thread
From: ludovic.desroches @ 2012-06-15 16:32 UTC (permalink / raw)
To: linux-arm-kernel
Hello,
Le 06/15/2012 06:01 PM, Shawn Guo a ?crit :
> On Thu, Jun 14, 2012 at 11:54:36AM +0200, ludovic.desroches wrote:
>> Hello,
>>
>> In fact, my question depends on sparse irq, irq domain and non DT.
>>
>> I have enabled sparse_irq use for at91 sub architecture. I don't
>> know if it is the good solution... I won't like to use n_irqs in my
>> machine descriptor. I think the goal of sparse irq is to allocate
>> the irq descriptor only when the irq is used. It's better than
>> allocating the range that can be managed by the controller which
>> should be indicated by nr_irqs.
>>
>> In this case using the legacy irq domain is not the right solution
>> since I will have to allocate the range of irq managed by the
>> controller. Moving to linear irq domain should be better. Moreover,
>> I have seen that Grant may want to remove it.
>>
>> So, how to move to linear irq domain? In DT case, all the interrupts
>> into the DT are mapped so the irq descriptor is allocated and my
>> device will have the right virq number. In non DT case, my device
>> has an irq number corresponding to a fixed value (which is in fact
>> the hwirq number) but probably not to any existing virq.
>>
>> So how to get a valid virq? Do I have to call irq_create_mapping
>> from my driver? It's probably not the right way... Should I keep
>> legacy domain and set nr_irqs?
>>
> Short answer - Don't use linear but legacy domain for non-DT.
>
Ok it's much more easier for me to not move to linear domain.
> I was getting punched on the head for thinking about using legacy
> domain for non-DT.[1] Also Documentation/IRQ-domain.txt suggests
> that as below.
>
> | The Legacy mapping is a special case for drivers that already have a
> | range of irq_descs allocated for the hwirqs. It is used when the
> | driver cannot be immediately converted to use the linear mapping. For
> | example, many embedded system board support files use a set of #defines
> | for IRQ numbers that are passed to struct device registrations. In that
> | case the Linux IRQ numbers cannot be dynamically assigned and the legacy
> | mapping should be used.
>
> So as long as you need to support non-DT users, you will need to use
> legacy domain. But that does not necessarily mean you need to set
> .nr_irqs in mach_desc for enabling spare-irq. If you have all your
> irqchips call irq_alloc_descs to allocate their irqdescs, you can enable
> spare-irq without the need of setting .nr_irq. I posted the series
> "[PATCH 00/16] Enable SPARSE_IRQ support for imx" yesterday doing that
> for imx.
>
I've seen your patch series and I am wondering what is the difference
between these two solutions:
- not using nr_irqs: you will have NR_IRQS_LEGACY irqdescs allocated and
you will allocate the irqdescs for your controller just after by calling
irq_alloc_descs so you will have to manage the NR_IRQS_LEGACY offset.
- using nr_irqs: you will have all your irqdescs allocated and won't
have to manage the NR_IRQS_LEGACY offset.
Regards
Ludovic
> Regards,
> Shawn
>
> [1] http://thread.gmane.org/gmane.linux.ports.arm.kernel/151860/focus=152072
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* How to use linear mapping without DT?
2012-06-15 16:32 ` ludovic.desroches
@ 2012-06-16 2:35 ` Shawn Guo
2012-06-18 12:10 ` ludovic.desroches
0 siblings, 1 reply; 6+ messages in thread
From: Shawn Guo @ 2012-06-16 2:35 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Jun 15, 2012 at 06:32:29PM +0200, ludovic.desroches wrote:
> I've seen your patch series and I am wondering what is the
> difference between these two solutions:
> - not using nr_irqs: you will have NR_IRQS_LEGACY irqdescs allocated
> and you will allocate the irqdescs for your controller just after by
> calling irq_alloc_descs so you will have to manage the
> NR_IRQS_LEGACY offset.
> - using nr_irqs: you will have all your irqdescs allocated and won't
> have to manage the NR_IRQS_LEGACY offset.
>
First of all, NR_IRQS_LEGACY shifting is a good thing we are actually
looking for because we want to reserve virq number 0 for no-interrupt
case. [1]
Secondly, with .nr_irqs approach, you will have to somehow maintain
irq_base for each irqchip, which is needed when adding legacy domain.
Calling irq_alloc_descs will just return you the irq_base.
Lastly, irq_alloc_descs approach can save irqdesc than .nr_irq in some
cases, where not all the irqchips get instantiated for every single
boot. That's said, .nr_irqs has to be set the possible maximum numbers
for the machine, while some irqchips, e.g. peripheral/device inside
ones, are not always instantiated. irq_alloc_descs approach will save
irqdescs for such cases.
Regards,
Shawn
[1] http://thread.gmane.org/gmane.linux.kernel.next/18991/focus=10108
^ permalink raw reply [flat|nested] 6+ messages in thread
* How to use linear mapping without DT?
2012-06-16 2:35 ` Shawn Guo
@ 2012-06-18 12:10 ` ludovic.desroches
0 siblings, 0 replies; 6+ messages in thread
From: ludovic.desroches @ 2012-06-18 12:10 UTC (permalink / raw)
To: linux-arm-kernel
Le 06/16/2012 04:35 AM, Shawn Guo a ?crit :
> On Fri, Jun 15, 2012 at 06:32:29PM +0200, ludovic.desroches wrote:
>> I've seen your patch series and I am wondering what is the
>> difference between these two solutions:
>> - not using nr_irqs: you will have NR_IRQS_LEGACY irqdescs allocated
>> and you will allocate the irqdescs for your controller just after by
>> calling irq_alloc_descs so you will have to manage the
>> NR_IRQS_LEGACY offset.
>> - using nr_irqs: you will have all your irqdescs allocated and won't
>> have to manage the NR_IRQS_LEGACY offset.
>>
> First of all, NR_IRQS_LEGACY shifting is a good thing we are actually
> looking for because we want to reserve virq number 0 for no-interrupt
> case. [1]
I don't think it's an issue for legacy domain since virq number 0 is
ignored.
>
> Secondly, with .nr_irqs approach, you will have to somehow maintain
> irq_base for each irqchip, which is needed when adding legacy domain.
> Calling irq_alloc_descs will just return you the irq_base.
>
> Lastly, irq_alloc_descs approach can save irqdesc than .nr_irq in some
> cases, where not all the irqchips get instantiated for every single
> boot. That's said, .nr_irqs has to be set the possible maximum numbers
> for the machine, while some irqchips, e.g. peripheral/device inside
> ones, are not always instantiated. irq_alloc_descs approach will save
> irqdescs for such cases.
Of course it makes sense.
Thanks for these explanations. I'll correct my patches to use the
NR_IRQS_LEGACY shifting instead of using nr_irqs.
Regards
Ludovic
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-06-18 12:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-14 9:54 How to use linear mapping without DT? ludovic.desroches
2012-06-15 16:01 ` Shawn Guo
2012-06-15 16:07 ` Mark Brown
2012-06-15 16:32 ` ludovic.desroches
2012-06-16 2:35 ` Shawn Guo
2012-06-18 12:10 ` ludovic.desroches
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).