Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751515AbdFFJgH (ORCPT ); Tue, 6 Jun 2017 05:36:07 -0400 Received: from smtp5-g21.free.fr ([212.27.42.5]:40522 "EHLO smtp5-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751383AbdFFJgG (ORCPT ); Tue, 6 Jun 2017 05:36:06 -0400 Subject: Re: Design of interrupt controller driver To: Thomas Gleixner Cc: Marc Zyngier , Jason Cooper , Mark Rutland , Arnd Bergmann , Linux ARM , LKML References: <8bce8bdd-5801-f0c3-ada3-e1c68acc8913@free.fr> <025780ef-06e6-1e85-58da-4ce8f6c93536@free.fr> <6e4da485-42cc-9b70-1b4a-9729f646e014@free.fr> <77a6e423-5c6a-9e5a-d679-c2576074fe6d@free.fr> From: Mason Message-ID: Date: Tue, 6 Jun 2017 11:35:48 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2611 Lines: 75 On 06/06/2017 09:39, Thomas Gleixner wrote: > On Mon, 5 Jun 2017, Mason wrote: > >> Is it possible to call the interrupt controller's mask callback >> from the DMA engine driver ISR, or is that reserved for the IRQ >> framework? Because that's what the HW designers had in mind, >> thus they didn't provide a way to mask the interrupt in the >> device. It just outputs the signal to the interrupt router. > > No, it's not and we are not going to provide an interface for that because > that violates any form of layering and abstractions. The DMA device driver > has to be oblivious of the underlying interrupt handling machinery. Sorry, I didn't mean *explicitly* calling the mask callback, but rather void mask_irq(struct irq_desc *desc); I note that mask_irq() is *not* exported, which means modules cannot to use it. In-tree drivers are probably not supposed to use it either? Same thing for irq_disable? What about disable_irq(virq); That function /is/ exported API, and eventually calls mask_irq. disable_irq -> __disable_irq_nosync -> __disable_irq -> irq_disable -> mask_irq >> So their proposed setup is as follows: >> >> Start the system with the DMA interrupt masked in the intc. >> When SW needs to perform a DMA op, the DMA driver starts >> the op (thus the interrupt signal goes low), then unmasks >> the interrupt in the intc. Interrupt triggers when signal >> goes high (level high). Driver masks interrupt in ISR, >> until next op is available. >> >> Is that possible in the Linux framework? > > You can do that, but not for shared interrupts: > > isr() > { > disable_irq_nosync(); > ..... > } > > submit() > { > .... > enable_irq(); > } > > init() > { > irq_set_status_flags(irq, IRQ_NOAUTOEN); > request_irq(irq, ....); > } > > This affects the whole interrupt line, so if you share that interrupt at > the CPU interrupt controller level this wont work. > > If your 'router' IP has a mechanism to mask input lines individually, then > you can do something about this. > > Each group of inputs which shares an output becomes it's own demultiplexing > interrupt domain with it's own interrupt chip which controls the input > lines. The output is handled by a chained interrupt handler which checks > the status of the input lines and invokes the handlers for the devices with > an active input. > > Then the above example will disable the interrupt at the 'router' level > which will not affect the other device which shares the underlying output > to the GIC (or whatever interrupt controller your CPU has). I will have to re-read this a few times to digest it. Regards.