Re: [RFC 12/14] irq_domain: Add support for base irq and hwirq in legacy mappings

From
Grant Likely <hidden>
Date
2012-01-13 00:54:20
Also in
lkml
Reply to
Rob Herring, 2012-01-13
On Thu, Jan 12, 2012 at 5:37 PM, Rob Herring [off-list ref] wrote:
On 01/11/2012 02:22 PM, Grant Likely wrote:
quoted
Add support for a legacy mapping where irq =3D (hwirq - first_hwirq + fi=
rst_irq)
quoted
so that a controller driver can allocate a fixed range of irq_descs and =
use
quoted
a simple calculation to translate back and forth between linux and hw ir=
q
quoted
numbers. =A0This is needed to use an irq_domain with many of the ARM int=
errupt
quoted
controller drivers that manage their own irq_desc allocations. =A0Ultima=
tely
quoted
the goal is to migrate those drivers to use the linear revmap, but doing=
 it
quoted
this way allows each driver to be converted separately which makes the
migration path easier.

This patch generalizes the IRQ_DOMAIN_MAP_LEGACY method to use
(first_irq-first_hwirq) as the offset between hwirq and linux irq number=
,
quoted
and adds checks to make sure that the hwirq number does not exceed range
assigned to the controller.

Signed-off-by: Grant Likely <redacted>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
=A0arch/powerpc/include/asm/irq.h =A0 | =A0 =A03 -
=A0arch/powerpc/sysdev/i8259.c =A0 =A0 =A0| =A0 =A02 +-
=A0arch/powerpc/sysdev/tsi108_pci.c | =A0 =A02 +-
=A0include/linux/irqdomain.h =A0 =A0 =A0 =A0| =A0 20 +++++++++-
=A0kernel/irq/irqdomain.c =A0 =A0 =A0 =A0 =A0 | =A0 78 +++++++++++++++++=
++++++++-------------
quoted
=A05 files changed, 73 insertions(+), 32 deletions(-)
snip...
quoted
@@ -454,8 +477,11 @@ unsigned int irq_find_mapping(struct irq_domain *do=
main,
quoted
=A0 =A0 =A0 =A0 =A0 =A0 =A0 return 0;

=A0 =A0 =A0 /* legacy -> bail early */
- =A0 =A0 if (domain->revmap_type =3D=3D IRQ_DOMAIN_MAP_LEGACY)
- =A0 =A0 =A0 =A0 =A0 =A0 return hwirq;
+ =A0 =A0 if (domain->revmap_type =3D=3D IRQ_DOMAIN_MAP_LEGACY) {
+ =A0 =A0 =A0 =A0 =A0 =A0 if (hwirq > domain->revmap_data.legacy.size)
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return 0;
+ =A0 =A0 =A0 =A0 =A0 =A0 return domain->revmap_data.legacy.first_irq + =
hwirq;
This needs a "- domain->revmap_data.legacy.first_hwirq"
Good catch, thanks.
g.
Thread (36 messages) 36 messages, 6 authors, 2013-08-23
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help