linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "Marek Behún" <kabel@kernel.org>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "Gregory Clement" <gregory.clement@bootlin.com>,
	"Sebastian Hesselbarth" <sebastian.hesselbarth@gmail.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	linux-arm-kernel@lists.infradead.org, arm@kernel.org,
	"Andy Shevchenko" <andy@kernel.org>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Pali Rohár" <pali@kernel.org>
Subject: Re: [PATCH 2/4] irqchip/armada-370-xp: Exit ipi_resume() early if IPI is not used
Date: Wed, 19 Jun 2024 21:27:14 +0200	[thread overview]
Message-ID: <20240619212714.27e5b8fd@thinkpad> (raw)
In-Reply-To: <5c5d74f0-36a5-4835-a0cd-772e1bfc2574@lunn.ch>

On Wed, 19 Jun 2024 19:11:44 +0200
Andrew Lunn <andrew@lunn.ch> wrote:

> On Wed, Jun 19, 2024 at 04:11:32PM +0200, Marek Behún wrote:
> > From: Pali Rohár <pali@kernel.org>
> > 
> > Exit ipi_resume() early if IPI is not used.
> > 
> > IPI is used only on systems where the mpic controller does not have a
> > parent GIC IRQ (e.g. on Armada XP).
> > 
> > Signed-off-by: Pali Rohár <pali@kernel.org>
> > [ changed commit message and moved the code change into ipi_resume() ]
> > Signed-off-by: Marek Behún <kabel@kernel.org>
> > ---
> >  drivers/irqchip/irq-armada-370-xp.c | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> > 
> > diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
> > index f488c35d9130..65f21624263e 100644
> > --- a/drivers/irqchip/irq-armada-370-xp.c
> > +++ b/drivers/irqchip/irq-armada-370-xp.c
> > @@ -29,6 +29,7 @@
> >  #include <linux/slab.h>
> >  #include <linux/syscore_ops.h>
> >  #include <linux/msi.h>
> > +#include <linux/types.h>
> >  #include <asm/mach/arch.h>
> >  #include <asm/exception.h>
> >  #include <asm/smp_plat.h>
> > @@ -156,6 +157,12 @@ static DEFINE_MUTEX(msi_used_lock);
> >  static phys_addr_t msi_doorbell_addr;
> >  #endif
> >  
> > +static inline bool is_ipi_available(void)
> > +{
> > +	/* IPI is used only if we do not have parent irq */
> > +	return parent_irq <= 0;
> > +}
> > +
> >  static inline bool is_percpu_irq(irq_hw_number_t irq)
> >  {
> >  	if (irq <= ARMADA_370_XP_MAX_PER_CPU_IRQS)
> > @@ -429,6 +436,9 @@ static void ipi_resume(void)
> >  {
> >  	int i;
> >  
> > +	if (!is_ipi_available())
> > +		return;  
> 
> But of a nitpick, but it seems odd calling ipi_resume() if it does not
> exist. I would prefer
> 
>        
> 	if (is_ipi_available())
> 		ipi_resume();
> 
> At the two places ipi_resume() is called.

That is how it was in the original patch, just hardcoded (there
was no is_ipi_available() call, instead it was

  /* comment */
  if (parent_irq <= 0)
    ...

I guess I was trying to be smart in deduplicating code, and I got too
far the other way.

I will fix this in v2.

Marek


  reply	other threads:[~2024-06-19 19:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-19 14:11 [PATCH 0/4] armada-370-xp irqchip updates Marek Behún
2024-06-19 14:11 ` [PATCH 1/4] irqchip/armada-370-xp: Do not allow mapping IRQ 0 and 1 Marek Behún
2024-06-19 17:08   ` Andrew Lunn
2024-06-19 19:25     ` Marek Behún
2024-06-19 14:11 ` [PATCH 2/4] irqchip/armada-370-xp: Exit ipi_resume() early if IPI is not used Marek Behún
2024-06-19 17:11   ` Andrew Lunn
2024-06-19 19:27     ` Marek Behún [this message]
2024-06-19 14:11 ` [PATCH 3/4] irqchip/armada-370-xp: Do not touch IPI registers on platforms without IPI Marek Behún
2024-06-19 17:17   ` Andrew Lunn
2024-06-19 14:11 ` [PATCH 4/4] irqchip/armada-370-xp: Add support for 32 MSI interrupts on non-IPI platforms Marek Behún
2024-06-19 17:21   ` Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240619212714.27e5b8fd@thinkpad \
    --to=kabel@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=andy@kernel.org \
    --cc=arm@kernel.org \
    --cc=gregory.clement@bootlin.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=pali@kernel.org \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).