public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Michal Simek <michal.simek@xilinx.com>
Cc: linux-kernel@vger.kernel.org, monstr@monstr.eu, git@xilinx.com,
	Stefan Asserhall <stefan.asserhall@xilinx.com>,
	Jason Cooper <jason@lakedaemon.net>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/3] irqchip: xilinx: Use handle_domain_irq()
Date: Fri, 21 Feb 2020 11:46:51 +0000	[thread overview]
Message-ID: <f028666cf1b1af428ad0564c4f93688b@kernel.org> (raw)
In-Reply-To: <49c5a093d7ba1f20930c7433ed632e7c9bc7a2cb.1581496793.git.michal.simek@xilinx.com>

On 2020-02-12 08:39, Michal Simek wrote:
> Call generic domain specific irq handler which does the most of things
> self. Also get rid of concurrent_irq counting which hasn't been 
> exported
> anywhere.
> Based on this loop was also optimized by using do/while loop instead of
> goto loop.
> 
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> Reviewed-by: Stefan Asserhall <stefan.asserhall@xilinx.com>
> ---
> 
>  arch/microblaze/Kconfig           |  1 +
>  arch/microblaze/kernel/irq.c      |  5 ----
>  drivers/irqchip/irq-xilinx-intc.c | 44 +++++++++++--------------------
>  3 files changed, 16 insertions(+), 34 deletions(-)
> 
> diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
> index 3a314aa2efa1..242f58ec086b 100644
> --- a/arch/microblaze/Kconfig
> +++ b/arch/microblaze/Kconfig
> @@ -48,6 +48,7 @@ config MICROBLAZE
>  	select MMU_GATHER_NO_RANGE if MMU
>  	select SPARSE_IRQ
>  	select GENERIC_IRQ_MULTI_HANDLER
> +	select HANDLE_DOMAIN_IRQ
> 
>  # Endianness selection
>  choice
> diff --git a/arch/microblaze/kernel/irq.c 
> b/arch/microblaze/kernel/irq.c
> index 1f8cb4c4f74f..0b37dde60a1e 100644
> --- a/arch/microblaze/kernel/irq.c
> +++ b/arch/microblaze/kernel/irq.c
> @@ -22,13 +22,8 @@
> 
>  void __irq_entry do_IRQ(struct pt_regs *regs)
>  {
> -	struct pt_regs *old_regs = set_irq_regs(regs);
>  	trace_hardirqs_off();
> -
> -	irq_enter();
>  	handle_arch_irq(regs);
> -	irq_exit();
> -	set_irq_regs(old_regs);
>  	trace_hardirqs_on();
>  }
> 
> diff --git a/drivers/irqchip/irq-xilinx-intc.c
> b/drivers/irqchip/irq-xilinx-intc.c
> index ad9e678c24ac..fa468e618762 100644
> --- a/drivers/irqchip/irq-xilinx-intc.c
> +++ b/drivers/irqchip/irq-xilinx-intc.c
> @@ -125,20 +125,6 @@ static unsigned int xintc_get_irq_local(struct
> xintc_irq_chip *irqc)
>  	return irq;
>  }
> 
> -static unsigned int xintc_get_irq(void)
> -{
> -	u32 hwirq;
> -	unsigned int irq = -1;
> -
> -	hwirq = xintc_read(primary_intc, IVR);
> -	if (hwirq != -1U)
> -		irq = irq_find_mapping(primary_intc->root_domain, hwirq);
> -
> -	pr_debug("irq-xilinx: hwirq=%d, irq=%d\n", hwirq, irq);
> -
> -	return irq;
> -}
> -
>  static int xintc_map(struct irq_domain *d, unsigned int irq,
> irq_hw_number_t hw)
>  {
>  	struct xintc_irq_chip *irqc = d->host_data;
> @@ -178,23 +164,23 @@ static void xil_intc_irq_handler(struct irq_desc 
> *desc)
>  	chained_irq_exit(chip, desc);
>  }
> 
> -static u32 concurrent_irq;
> -
>  static void xil_intc_handle_irq(struct pt_regs *regs)
>  {
> -	unsigned int irq;
> -
> -	irq = xintc_get_irq();
> -next_irq:
> -	BUG_ON(!irq);
> -	generic_handle_irq(irq);
> -
> -	irq = xintc_get_irq();
> -	if (irq != -1U) {
> -		pr_debug("next irq: %d\n", irq);
> -		++concurrent_irq;
> -		goto next_irq;
> -	}
> +	u32 hwirq;
> +	struct xintc_irq_chip *irqc = primary_intc;
> +
> +	do {
> +		hwirq = xintc_read(irqc, IVR);
> +		if (hwirq != -1U) {
> +			int ret;
> +
> +			ret = handle_domain_irq(irqc->root_domain, hwirq, regs);
> +			WARN_ONCE(ret, "Unhandled HWIRQ %d\n", hwirq);
> +			continue;
> +		}
> +
> +		break;
> +	} while (1);

OK, so this what I suggested already. Just squash the two patches
in one, there is no point in keeping them separate.

Thanks,

         M.
-- 
Jazz is not dead. It just smells funny...

  reply	other threads:[~2020-02-21 11:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-12  8:39 [PATCH 0/3] irqchip: xilinx: Switch to generic domain handler Michal Simek
2020-02-12  8:39 ` [PATCH 1/3] irqchip: xilinx: Fill error code when irq domain registration fails Michal Simek
2020-02-12  8:39 ` [PATCH 2/3] irqchip: xilinx: Enable generic irq multi handler Michal Simek
2020-02-21 11:45   ` Marc Zyngier
2020-02-12  8:39 ` [PATCH 3/3] irqchip: xilinx: Use handle_domain_irq() Michal Simek
2020-02-21 11:46   ` Marc Zyngier [this message]
2020-02-21 11:49     ` Michal Simek
2020-02-21 10:36 ` [PATCH 0/3] irqchip: xilinx: Switch to generic domain handler Michal Simek

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=f028666cf1b1af428ad0564c4f93688b@kernel.org \
    --to=maz@kernel.org \
    --cc=git@xilinx.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=monstr@monstr.eu \
    --cc=stefan.asserhall@xilinx.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