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=-11.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 7CF8EC433E1 for ; Wed, 26 Aug 2020 17:53:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4A84F20737 for ; Wed, 26 Aug 2020 17:53:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598464380; bh=Zd24Yb4vjHVqZMcBZUg6fD4NfTY3pGvnVh3ocrW4duI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-ID:From; b=Cd2s4KbtZUNUbRFj1z+FURw2sbvYiVEf2ASEaCcghr5dK8HmIyL+glUxvO/+XqLjY 017j1UueH0YqGFTzju63yWoho2q3zO2kLNsqEbIjU4XLGwvP1TkqcDeBuvx1TNk++5 3Nv/TTC1O9TcvKp9saXgaT5CLIOr8GiggNhaXwJg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726609AbgHZRw5 (ORCPT ); Wed, 26 Aug 2020 13:52:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:54778 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726187AbgHZRw4 (ORCPT ); Wed, 26 Aug 2020 13:52: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 72EF020737; Wed, 26 Aug 2020 17:52:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598464375; bh=Zd24Yb4vjHVqZMcBZUg6fD4NfTY3pGvnVh3ocrW4duI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=oGt4PCbs/J/rOYxOmxVGNKn7rv/v0UjhddU8AUqIHs964IXq8BnhDLiJ8XBgsLFx1 fDs78zRjxBJ5BWor2KAViU/xDWDheyIrw+P6gipyU7fSHwO4aM88Xcdj50rMQZX/ZH UqTBYKrd/AAdlTV6iOrNrXmua3DyfNFcLED9v+Q0= Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kAzbR-006vbP-Jg; Wed, 26 Aug 2020 18:52:53 +0100 Date: Wed, 26 Aug 2020 18:52:46 +0100 Message-ID: <87lfi170r5.wl-maz@kernel.org> From: Marc Zyngier To: Valentin Schneider Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Bjorn Helgaas , Gregory Clement , Jason Cooper , Laurentiu Tudor , Thomas Gleixner Subject: Re: [PATCH 5/9] fsl-msi: Provide default retrigger callback In-Reply-To: <70107b944534c6a0eeff83e43b05865e@kernel.org> References: <20200824102317.1038259-1-maz@kernel.org> <20200824102317.1038259-6-maz@kernel.org> <70107b944534c6a0eeff83e43b05865e@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 EasyPG/1.0.0 Emacs/26.3 (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: 62.31.163.78 X-SA-Exim-Rcpt-To: valentin.schneider@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, bhelgaas@google.com, gregory.clement@bootlin.com, jason@lakedaemon.net, laurentiu.tudor@nxp.com, tglx@linutronix.de X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On Wed, 26 Aug 2020 17:37:30 +0100, Marc Zyngier wrote: > > Hi Valentin, > > On 2020-08-26 12:16, Valentin Schneider wrote: > > Hi Marc, > > > > Many thanks for picking this up! > > Below's the only comment I have, the rest LGTM. > > > > On 24/08/20 11:23, Marc Zyngier wrote: > >> Signed-off-by: Marc Zyngier > >> --- > >> drivers/bus/fsl-mc/fsl-mc-msi.c | 2 ++ > >> 1 file changed, 2 insertions(+) > >> > >> diff --git a/drivers/bus/fsl-mc/fsl-mc-msi.c > >> b/drivers/bus/fsl-mc/fsl-mc-msi.c > >> index 8edadf05cbb7..5306ba7dea3e 100644 > >> --- a/drivers/bus/fsl-mc/fsl-mc-msi.c > >> +++ b/drivers/bus/fsl-mc/fsl-mc-msi.c > >> @@ -144,6 +144,8 @@ static void fsl_mc_msi_update_chip_ops(struct > >> msi_domain_info *info) > >> */ > >> if (!chip->irq_write_msi_msg) > >> chip->irq_write_msi_msg = fsl_mc_msi_write_msg; > >> + if (!chip->irq_retrigger) > >> + chip->irq_retrigger = irq_chip_retrigger_hierarchy; > > > > AFAICT the closest generic hook we could use here is > > > > msi_create_irq_domain() -> msi_domain_update_chip_ops() > > > > which happens just below the fsl-specific ops update. > > > > > > However, placing a default .irq_retrigger callback in there would > > affect any > > and all MSI domain. IOW that would cover PCI and platform MSIs > > (covered by > > separate patches in this series), but also some x86 ("dmar" & > > "hpet") and > > TI thingies. > > > > I can't tell right now how bad of an idea it is, but I figured I'd > > throw > > this out there. > > The problem with this approach is that it requires the resend path to be > cooperative and actually check for more than the top-level irq_data. > Otherwise you'd never actually trigger the HW resend if it is below > the top level. > > But I like the idea though. Something like this should do the trick, and > is admittedly a bug fix: Well, not quite. > > diff --git a/kernel/irq/resend.c b/kernel/irq/resend.c > index c48ce19a257f..d11c729f9679 100644 > --- a/kernel/irq/resend.c > +++ b/kernel/irq/resend.c > @@ -86,6 +86,18 @@ static int irq_sw_resend(struct irq_desc *desc) > } > #endif > > +static int try_retrigger(struct irq_desc *desc) > +{ > +#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY > + return irq_chip_retrigger_hierarchy(&desc->irq_data); This only checks the parent, so we still need to evaluate the top-level. Something like this: diff --git a/kernel/irq/resend.c b/kernel/irq/resend.c index c48ce19a257f..8ccd32a0cc80 100644 --- a/kernel/irq/resend.c +++ b/kernel/irq/resend.c @@ -86,6 +86,18 @@ static int irq_sw_resend(struct irq_desc *desc) } #endif +static int try_retrigger(struct irq_desc *desc) +{ + if (desc->irq_data.chip->irq_retrigger) + return desc->irq_data.chip->irq_retrigger(&desc->irq_data); + +#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY + return irq_chip_retrigger_hierarchy(&desc->irq_data); +#else + return 0; +#endif +} + /* * IRQ resend * @@ -113,8 +125,7 @@ int check_irq_resend(struct irq_desc *desc, bool inject) desc->istate &= ~IRQS_PENDING; - if (!desc->irq_data.chip->irq_retrigger || - !desc->irq_data.chip->irq_retrigger(&desc->irq_data)) + if (!try_retrigger(desc)) err = irq_sw_resend(desc); /* If the retrigger was successfull, mark it with the REPLAY bit */ With that, I believe we can drop most of the patches in this series and only keep the GIC ones. M. -- Without deviation from the norm, progress is not possible.