lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACxGe6tQ2U-u6-=3qGFTxXFViPAS2Y1g4i8MUNhPJdE_WzkA3A@mail.gmail.com>
Date:	Thu, 12 Jan 2012 17:53:57 -0700
From:	Grant Likely <grant.likely@...retlab.ca>
To:	Rob Herring <robherring2@...il.com>
Cc:	linux-kernel@...r.kernel.org,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	linuxppc-dev@...ts.ozlabs.org,
	Russell King <linux@....linux.org.uk>, sfr@...b.auug.org.au
Subject: Re: [RFC 12/14] irq_domain: Add support for base irq and hwirq in
 legacy mappings

On Thu, Jan 12, 2012 at 5:37 PM, Rob Herring <robherring2@...il.com> wrote:
> On 01/11/2012 02:22 PM, Grant Likely wrote:
>> Add support for a legacy mapping where irq = (hwirq - first_hwirq + first_irq)
>> so that a controller driver can allocate a fixed range of irq_descs and use
>> a simple calculation to translate back and forth between linux and hw irq
>> numbers.  This is needed to use an irq_domain with many of the ARM interrupt
>> controller drivers that manage their own irq_desc allocations.  Ultimately
>> the goal is to migrate those drivers to use the linear revmap, but doing it
>> 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,
>> and adds checks to make sure that the hwirq number does not exceed range
>> assigned to the controller.
>>
>> Signed-off-by: Grant Likely <grant.likely@...retlab.ca>
>> Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>
>> ---
>>  arch/powerpc/include/asm/irq.h   |    3 -
>>  arch/powerpc/sysdev/i8259.c      |    2 +-
>>  arch/powerpc/sysdev/tsi108_pci.c |    2 +-
>>  include/linux/irqdomain.h        |   20 +++++++++-
>>  kernel/irq/irqdomain.c           |   78 +++++++++++++++++++++++++-------------
>>  5 files changed, 73 insertions(+), 32 deletions(-)
>>
>
> snip...
>
>> @@ -454,8 +477,11 @@ unsigned int irq_find_mapping(struct irq_domain *domain,
>>               return 0;
>>
>>       /* legacy -> bail early */
>> -     if (domain->revmap_type == IRQ_DOMAIN_MAP_LEGACY)
>> -             return hwirq;
>> +     if (domain->revmap_type == IRQ_DOMAIN_MAP_LEGACY) {
>> +             if (hwirq > domain->revmap_data.legacy.size)
>> +                     return 0;
>> +             return domain->revmap_data.legacy.first_irq + hwirq;
>
> This needs a "- domain->revmap_data.legacy.first_hwirq"

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ