public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
To: Yuriy Kolerov <yuriy.kolerov@synopsys.com>,
	<linux-snps-arc@lists.infradead.org>
Cc: <Alexey.Brodkin@synopsys.com>, <marc.zyngier@arm.com>,
	<tglx@linutronix.de>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/5] ARC: SMP: Pass virq to smp_ipi_irq_setup instead of hwirq
Date: Mon, 24 Oct 2016 19:25:43 -0700	[thread overview]
Message-ID: <cdfff9de-7451-098f-e5ec-dad593bfe150@synopsys.com> (raw)
In-Reply-To: <1477313194-2310-2-git-send-email-yuriy.kolerov@synopsys.com>

On 10/24/2016 05:46 AM, Yuriy Kolerov wrote:
> This function takes a cpu number and a virq number and registers an
> appropriate handler per cpu. However smp_ipi_irq_setup is incorrectly
> used in several places of ARC platform code - hwirq is passed instead of
> virq. There is a code with an example of inccorect usage of smp_ipi_irq_setup:
> 
>     smp_ipi_irq_setup(cpu, IPI_IRQ);
>     smp_ipi_irq_setup(cpu, SOFTIRQ_IRQ);
> 
> where IPI_IRQ and SOFTIRQ_IRQ are hwirq numbers for per cpu interrupts.
> Since smp_ipi_irq_setup must be taken a virq number insdead of a hwirq
> number then it is necessary to fix usage of this function this way:
> 
>     smp_ipi_irq_setup(cpu, irq_find_mapping(NULL, IPI_IRQ));
>     smp_ipi_irq_setup(cpu, irq_find_mapping(NULL, SOFTIRQ_IRQ));
> 
> The idea is to find an appropriate mapping of <domain, hwirq> to virq
> by using irq_find_mapping function. NULL value is used as a domain
> argument (a default domain) since smp_ipi_irq_setup is used for
> registering an IRQ handler for a root interrupt controller (a default
> IRQ domain must be used).
> 
> Signed-off-by: Yuriy Kolerov <yuriy.kolerov@synopsys.com>
> ---
>  arch/arc/kernel/mcip.c    | 5 +++--
>  arch/arc/plat-eznps/smp.c | 2 +-
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arc/kernel/mcip.c b/arch/arc/kernel/mcip.c
> index 72f9179..28ff766 100644
> --- a/arch/arc/kernel/mcip.c
> +++ b/arch/arc/kernel/mcip.c
> @@ -11,6 +11,7 @@
>  #include <linux/smp.h>
>  #include <linux/irq.h>
>  #include <linux/spinlock.h>
> +#include <linux/irqdomain.h>
>  #include <asm/irqflags-arcv2.h>
>  #include <asm/mcip.h>
>  #include <asm/setup.h>
> @@ -22,8 +23,8 @@ static DEFINE_RAW_SPINLOCK(mcip_lock);
>  
>  static void mcip_setup_per_cpu(int cpu)
>  {
> -	smp_ipi_irq_setup(cpu, IPI_IRQ);
> -	smp_ipi_irq_setup(cpu, SOFTIRQ_IRQ);
> +	smp_ipi_irq_setup(cpu, irq_find_mapping(NULL, IPI_IRQ));
> +	smp_ipi_irq_setup(cpu, irq_find_mapping(NULL, SOFTIRQ_IRQ));

Can we do this slightly differently. smp_ipi_irq_setup() is just a helper anyways,
can we keep the interface the same (maybe explicit'ify that it takes hwirq). And
call irq_find_mapping() inside it - this will reduce the code churn !


>  }
>  
>  static void mcip_ipi_send(int cpu)
> diff --git a/arch/arc/plat-eznps/smp.c b/arch/arc/plat-eznps/smp.c
> index 5e901f8..dd996e0 100644
> --- a/arch/arc/plat-eznps/smp.c
> +++ b/arch/arc/plat-eznps/smp.c
> @@ -134,7 +134,7 @@ static void eznps_ipi_send(int cpu)
>  
>  static void eznps_init_per_cpu(int cpu)
>  {
> -	smp_ipi_irq_setup(cpu, NPS_IPI_IRQ);
> +	smp_ipi_irq_setup(cpu, irq_find_mapping(NULL, NPS_IPI_IRQ));
>  
>  	eznps_init_core(cpu);
>  	mtm_enable_core(cpu);
> 

  reply	other threads:[~2016-10-25  2:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-24 12:46 [PATCH v2 1/5] ARC: SMP: Use "unsigned virq" in smp_ipi_irq_setup instead of "signed irq" Yuriy Kolerov
2016-10-24 12:46 ` [PATCH v2 2/5] ARC: SMP: Pass virq to smp_ipi_irq_setup instead of hwirq Yuriy Kolerov
2016-10-25  2:25   ` Vineet Gupta [this message]
2016-10-24 12:46 ` [PATCH v2 3/5] ARC: MCIP: Use hwirq instead of virq for resolution of IDU IRQ handlers Yuriy Kolerov
2016-10-24 12:46 ` [PATCH v2 4/5] ARC: MCIP: Set an initial affinity value in idu_irq_map Yuriy Kolerov
2016-10-25 18:28   ` Vineet Gupta
2016-10-26 14:05     ` Marc Zyngier
2016-10-26 16:17       ` Vineet Gupta
2016-10-26 16:36         ` Marc Zyngier
2016-10-26 17:21           ` Vineet Gupta
2016-10-24 12:46 ` [PATCH v2 5/5] ARC: MCIP: Use IDU_M_DISTRI_DEST mode if there is only 1 destination core Yuriy Kolerov
2016-10-25 17:52   ` Vineet Gupta
2016-10-25 18:16     ` Yuriy Kolerov
2016-10-24 20:06 ` [PATCH v2 1/5] ARC: SMP: Use "unsigned virq" in smp_ipi_irq_setup instead of "signed irq" Vineet Gupta
2016-10-25  2:28 ` Vineet Gupta
2016-10-25 17:26   ` Yuriy Kolerov

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=cdfff9de-7451-098f-e5ec-dad593bfe150@synopsys.com \
    --to=vineet.gupta1@synopsys.com \
    --cc=Alexey.Brodkin@synopsys.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=marc.zyngier@arm.com \
    --cc=tglx@linutronix.de \
    --cc=yuriy.kolerov@synopsys.com \
    /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