From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D35C5C433EF for ; Mon, 20 Sep 2021 11:24:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B396C60F70 for ; Mon, 20 Sep 2021 11:24:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230411AbhITLZ4 (ORCPT ); Mon, 20 Sep 2021 07:25:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:47454 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230138AbhITLZ4 (ORCPT ); Mon, 20 Sep 2021 07:25:56 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B1D5860F56; Mon, 20 Sep 2021 11:24:29 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mSHPP-00BkJd-M9; Mon, 20 Sep 2021 12:24:27 +0100 Date: Mon, 20 Sep 2021 12:24:27 +0100 Message-ID: <87wnnbv6ac.wl-maz@kernel.org> From: Marc Zyngier To: Daniel Palmer Cc: DTML , Rob Herring , Thomas Gleixner , linux-arm-kernel , Romain Perier Subject: Re: [PATCH 2/3] irqchip: SigmaStar SSD20xD gpi In-Reply-To: References: <20210914100415.1549208-1-daniel@0x0f.com> <20210914100415.1549208-3-daniel@0x0f.com> <87zgs7vavl.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: daniel@0x0f.com, devicetree@vger.kernel.org, robh+dt@kernel.org, tglx@linutronix.de, linux-arm-kernel@lists.infradead.org, romain.perier@gmail.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Mon, 20 Sep 2021 11:05:26 +0100, Daniel Palmer wrote: > > Hi Marc, > > On Mon, 20 Sept 2021 at 18:45, Marc Zyngier wrote: > > > +static void ssd20xd_gpi_unmask_irq(struct irq_data *data) > > > +{ > > > + irq_hw_number_t hwirq = irqd_to_hwirq(data); > > > + struct ssd20xd_gpi *gpi = irq_data_get_irq_chip_data(data); > > > + int offset_reg = REG_OFFSET(hwirq); > > > + int offset_bit = BIT_OFFSET(hwirq); > > > + > > > + regmap_update_bits(gpi->regmap, REG_MASK + offset_reg, offset_bit, 0); > > > > Is this regmap call atomic? When running this, you are holding a > > raw_spinlock already. From what I can see, this is unlikely to work > > correctly with the current state of regmap. > > I didn't even think about it. I will check. You may want to enable lockdep to verify that. > > > > +static void ssd20x_gpi_chainedhandler(struct irq_desc *desc) > > > +{ > > > + struct ssd20xd_gpi *intc = irq_desc_get_handler_data(desc); > > > + struct irq_chip *chip = irq_desc_get_chip(desc); > > > + unsigned int irqbit, hwirq, virq, status; > > > + int i; > > > + > > > + chained_irq_enter(chip, desc); > > > + > > > + for (i = 0; i < NUM_IRQ / IRQS_PER_REG; i++) { > > > + int offset_reg = STRIDE * i; > > > + int offset_irq = IRQS_PER_REG * i; > > > + > > > + regmap_read(intc->regmap, REG_STATUS + offset_reg, &status); > > > > Does this act as an ACK in the HW? > > Not that I'm aware of. The status registers have the interrupt bits > set until the EOI callback is called from what I can tell. Then this doesn't work for edge signalling, as you will lose interrupts that occur between the handling and EOI. > Technically I think the EOI callback should actually be ACK instead > but from my fuzzy memory with the stack of IRQ controllers that > resulted in a null pointer dereference. That's probably because you are using the wrong flow handler. You should turn this irq_eoi into an irq_ack, because that's really what it is, and use handle_edge_irq() as the flow handler. Thanks, M. -- Without deviation from the norm, progress is not possible.