From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752238AbcGUKzE (ORCPT ); Thu, 21 Jul 2016 06:55:04 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:58344 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751641AbcGUKy5 (ORCPT ); Thu, 21 Jul 2016 06:54:57 -0400 From: Arnd Bergmann To: Wan ZongShun Cc: Wan Zongshun , Jason Cooper , linux-arm-kernel , Russell King , devicetree@vger.kernel.org, linux-clk@vger.kernel.org, Daniel Lezcano , Thomas Gleixner , linux-kernel , Rob Herring , p.zabel@pengutronix.de Subject: Re: [PATCH v2 02/10] irqchip: add irqchip driver for nuc900 Date: Fri, 15 Jul 2016 12:02:55 +0200 Message-ID: <1885052.EkH2ZADWZS@wuerfel> User-Agent: KMail/5.1.3 (Linux/4.4.0-28-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: References: <1468135649-19980-1-git-send-email-vw@iommu.org> <16178876.fFBuoBSjbd@wuerfel> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:bVHg0uif8kSncJjzwTi1BgY87ftCvJ9k1K5MKodZ5r/34AlAoY2 Ml0qTWNrdjYBCY6WchRcO54yamYz++FTCe/bCaqkUURgRPW5ftYN6JFs/UKXThgWhFs+32s 3/DZq90BhPCPaavwFKv61AIytyu9g3wEiuCrmWRmhBnsgm+npYv6hZgmDgR+qGsFls0Jhbz QMGaUPQzDaQOk/JAS3ROQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:9okkVnEfI34=:UojwQATvPKcOHWnJ18DeFK ZWNtRNw6rgGRuxBRSml0kiHFED/Yupf4WMRY4HV0EYWTiZy8p1b8rN8Jpc6RAZmV0hyf3AUjI jO0P+SEMH8SucOw2LJzbd6DWZw9ZCRlbw5IxVbw1MwOHZcVMBpxDBMkmqoARepk+MUxzaT1Vm 2s5BCnktOYzyGL6Ns8WCzqA9f6SkLcMsBe/fp9KFqHCZmNDEvdLF/v7/fItv4X1fpHZwTnaXm CGU1mh9he7lSntBVZNeTc2fdIZSxTLVSbUULS00lVyGFlj2Fh+hQX4VWb3E8B3ebW3HLjImCC vzsO/nJI5Rs2tYeIKVdTO3dH8fVoaUPp1NamneMVV3m3CpyTfhn8tvH0Ar03PJlWNZ0wexf78 WwomH2qrtIko/4ciPDQ4dJIwJrrQE9lFn8M9NF4XICzishg3B99bsjp3h4kveM+wsiMFyiC5M mbOy6mCF2HBxM9kQTNkW+A15WfRxYZY7tVZTQjZ472CfP4VvA7bxuODuauPhmJL2TokkUpz88 1AlaF93juGWnysh1yLd7i+8/lcjC48STp4IiBDy/n3qKcig5J/oP8lO68j0LYj35PrucFamlf RYmqso3CT6TtuEPnHLa448p0PJlNRgVl6JorMrO9zWvJg9qNJV6Kz3hdJYh9w6KCM3gE4d3tY QOWerI0BHHxonYefEFWQBf4yNi/ERYeetdPhQS4AEB+j0BGEwnPGlUWgtVX05IBT/9zDJX7Zr PW8ByQa8eX/3fGHv Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Friday, July 15, 2016 5:44:50 PM CEST Wan ZongShun wrote: > 2016-07-15 15:00 GMT+08:00 Arnd Bergmann : > > On Friday, July 15, 2016 1:15:58 PM CEST Wan Zongshun wrote: > >> > >> Actually, I have two choice to implement this function: > >> > >> option1: > >> > >> void __exception_irq_entry aic_handle_irq(struct pt_regs *regs) > >> { > >> u32 hwirq; > >> > >> (void)readl(aic_base + REG_AIC_IPER); > >> hwirq = readl(aic_base + REG_AIC_ISNR); > >> > >> handle_IRQ((irq_find_mapping(aic_domain, hwirq)), regs); > >> } > > > > (side note: I think you want handle_domain_irq()) > > > >> option2: > >> > >> void __exception_irq_entry aic_handle_irq(struct pt_regs *regs) > >> { > >> u32 hwirq; > >> > >> hwirq = readl(aic_base + REG_AIC_IPER); > >> hwirq <<= 2; > >> > >> handle_IRQ((irq_find_mapping(aic_domain, hwirq)), regs); > >> } > >> > >> Though the option2 do shift for hwirq, but it seems better than do io > >> operation by readl,so I prefer to option2, agree? > > > > That will only return an irq number that is a multiple of four, which > > seems wrong since the numbers are not that. Did you mean to write > > > > hwirq = ilog2(hwirq); ? > > Sorry, my fault, I mean hwirq >>= 2, bit[7:2] indicates which irq is triggering. > so I have to do right shift 2 for IPER value. Ok, got it. > > That assumes that REG_AIC_IPER contains a 32-bit value with one single > > bit set to indicate which IRQ was triggered. > > > > If the difference is only in performance, you could try measuring which > > of the two ends up being faster. > > It seems hard to measure. I think Do IO operation should be slower > than shift 2. It depends on how fast that particular I/O path is. A lot of readl() operations are awfully slow, but the hardware design for the interrupt controller may in fact have optimized this to be reasonably fast. Another option would be to avoid the shift and just use the raw value of the REG_AIC_IPER register as the hwirq, with a custom map() callback that turns shifts the number read from the DT two bits so it matches the register value. Arnd