All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Marc Zyngier <maz@kernel.org>
Cc: Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"open list:BROADCOM NVRAM DRIVER" <linux-mips@vger.kernel.org>,
	linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
	Linux-sh list <linux-sh@vger.kernel.org>,
	Daniel Mack <daniel@zonque.org>,
	Robert Jarzmik <robert.jarzmik@free.fr>,
	Haojian Zhuang <haojian.zhuang@gmail.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Rich Felker <dalias@libc.org>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 4/9] sh: intc: Drop the use of irq_create_identity_mapping()
Date: Tue, 6 Apr 2021 12:32:13 +0200	[thread overview]
Message-ID: <CAMuHMdU3vo1AWuDr69WK8-1w38+Q7KturAoL=cFpspZiYr2ssA@mail.gmail.com> (raw)
In-Reply-To: <20210406093557.1073423-5-maz@kernel.org>

Hi Marc,

On Tue, Apr 6, 2021 at 11:44 AM Marc Zyngier <maz@kernel.org> wrote:
> Instead of playing games with using irq_create_identity_mapping()
> and irq_domain_associate(), drop the use of the former and only
> use the latter, together with the allocation of the irq_desc
> as needed.
>
> It doesn't make the code less awful, but at least the intent
> is clearer.
>
> Signed-off-by: Marc Zyngier <maz@kernel.org>

Thanks for your patch!

> --- a/drivers/sh/intc/core.c
> +++ b/drivers/sh/intc/core.c
> @@ -179,6 +179,23 @@ static unsigned int __init save_reg(struct intc_desc_int *d,
>         return 0;
>  }
>
> +static bool __init intc_map(struct irq_domain *domain, int irq)
> +{
> +       int res;

warning: unused variable ‘res’ [-Wunused-variable]

> +
> +       if (!irq_to_desc(irq) && irq_alloc_desc_at(irq, NUMA_NO_NODE) != irq) {
> +               pr_err("uname to allocate IRQ %d\n", irq);
> +               return false;
> +       }
> +
> +       if (irq_domain_associate(domain, irq, irq)) {
> +               pr_err("domain association failure\n");
> +               return false;
> +       }
> +
> +       return true;
> +}
> +
>  int __init register_intc_controller(struct intc_desc *desc)
>  {
>         unsigned int i, k, smp;
> @@ -316,19 +333,8 @@ int __init register_intc_controller(struct intc_desc *desc)

warning: unused variable ‘res’ [-Wunused-variable]

>                 if (!vect->enum_id)
>                         continue;
>
> -               res = irq_create_identity_mapping(d->domain, irq);


> -               if (unlikely(res)) {
> -                       if (res == -EEXIST) {
> -                               res = irq_domain_associate(d->domain, irq, irq);
> -                               if (unlikely(res)) {
> -                                       pr_err("domain association failure\n");
> -                                       continue;
> -                               }
> -                       } else {
> -                               pr_err("can't identity map IRQ %d\n", irq);
> -                               continue;
> -                       }
> -               }
> +               if (!intc_map(d->domain, irq))
> +                       continue;
>
>                 intc_irq_xlate_set(irq, vect->enum_id, d);
>                 intc_register_irq(desc, d, vect->enum_id, irq);

Otherwise this seems to work fine on real hardware (landisk) and qemu
(rts7751r2d).  I did verify that the new function intc_map() is called.

Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

WARNING: multiple messages have this Message-ID (diff)
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Marc Zyngier <maz@kernel.org>
Cc: Rich Felker <dalias@libc.org>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Linux-sh list <linux-sh@vger.kernel.org>,
	Robert Jarzmik <robert.jarzmik@free.fr>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Haojian Zhuang <haojian.zhuang@gmail.com>,
	"open list:BROADCOM NVRAM DRIVER" <linux-mips@vger.kernel.org>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
	Daniel Mack <daniel@zonque.org>
Subject: Re: [PATCH 4/9] sh: intc: Drop the use of irq_create_identity_mapping()
Date: Tue, 6 Apr 2021 12:32:13 +0200	[thread overview]
Message-ID: <CAMuHMdU3vo1AWuDr69WK8-1w38+Q7KturAoL=cFpspZiYr2ssA@mail.gmail.com> (raw)
In-Reply-To: <20210406093557.1073423-5-maz@kernel.org>

Hi Marc,

On Tue, Apr 6, 2021 at 11:44 AM Marc Zyngier <maz@kernel.org> wrote:
> Instead of playing games with using irq_create_identity_mapping()
> and irq_domain_associate(), drop the use of the former and only
> use the latter, together with the allocation of the irq_desc
> as needed.
>
> It doesn't make the code less awful, but at least the intent
> is clearer.
>
> Signed-off-by: Marc Zyngier <maz@kernel.org>

Thanks for your patch!

> --- a/drivers/sh/intc/core.c
> +++ b/drivers/sh/intc/core.c
> @@ -179,6 +179,23 @@ static unsigned int __init save_reg(struct intc_desc_int *d,
>         return 0;
>  }
>
> +static bool __init intc_map(struct irq_domain *domain, int irq)
> +{
> +       int res;

warning: unused variable ‘res’ [-Wunused-variable]

> +
> +       if (!irq_to_desc(irq) && irq_alloc_desc_at(irq, NUMA_NO_NODE) != irq) {
> +               pr_err("uname to allocate IRQ %d\n", irq);
> +               return false;
> +       }
> +
> +       if (irq_domain_associate(domain, irq, irq)) {
> +               pr_err("domain association failure\n");
> +               return false;
> +       }
> +
> +       return true;
> +}
> +
>  int __init register_intc_controller(struct intc_desc *desc)
>  {
>         unsigned int i, k, smp;
> @@ -316,19 +333,8 @@ int __init register_intc_controller(struct intc_desc *desc)

warning: unused variable ‘res’ [-Wunused-variable]

>                 if (!vect->enum_id)
>                         continue;
>
> -               res = irq_create_identity_mapping(d->domain, irq);


> -               if (unlikely(res)) {
> -                       if (res == -EEXIST) {
> -                               res = irq_domain_associate(d->domain, irq, irq);
> -                               if (unlikely(res)) {
> -                                       pr_err("domain association failure\n");
> -                                       continue;
> -                               }
> -                       } else {
> -                               pr_err("can't identity map IRQ %d\n", irq);
> -                               continue;
> -                       }
> -               }
> +               if (!intc_map(d->domain, irq))
> +                       continue;
>
>                 intc_irq_xlate_set(irq, vect->enum_id, d);
>                 intc_register_irq(desc, d, vect->enum_id, irq);

Otherwise this seems to work fine on real hardware (landisk) and qemu
(rts7751r2d).  I did verify that the new function intc_map() is called.

Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

WARNING: multiple messages have this Message-ID (diff)
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Marc Zyngier <maz@kernel.org>
Cc: Linux ARM <linux-arm-kernel@lists.infradead.org>,
	 Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	 "open list:BROADCOM NVRAM DRIVER" <linux-mips@vger.kernel.org>,
	linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
	 Linux-sh list <linux-sh@vger.kernel.org>,
	Daniel Mack <daniel@zonque.org>,
	 Robert Jarzmik <robert.jarzmik@free.fr>,
	Haojian Zhuang <haojian.zhuang@gmail.com>,
	 Yoshinori Sato <ysato@users.sourceforge.jp>,
	Rich Felker <dalias@libc.org>,
	 Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Michael Ellerman <mpe@ellerman.id.au>,
	 Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 4/9] sh: intc: Drop the use of irq_create_identity_mapping()
Date: Tue, 6 Apr 2021 12:32:13 +0200	[thread overview]
Message-ID: <CAMuHMdU3vo1AWuDr69WK8-1w38+Q7KturAoL=cFpspZiYr2ssA@mail.gmail.com> (raw)
In-Reply-To: <20210406093557.1073423-5-maz@kernel.org>

Hi Marc,

On Tue, Apr 6, 2021 at 11:44 AM Marc Zyngier <maz@kernel.org> wrote:
> Instead of playing games with using irq_create_identity_mapping()
> and irq_domain_associate(), drop the use of the former and only
> use the latter, together with the allocation of the irq_desc
> as needed.
>
> It doesn't make the code less awful, but at least the intent
> is clearer.
>
> Signed-off-by: Marc Zyngier <maz@kernel.org>

Thanks for your patch!

> --- a/drivers/sh/intc/core.c
> +++ b/drivers/sh/intc/core.c
> @@ -179,6 +179,23 @@ static unsigned int __init save_reg(struct intc_desc_int *d,
>         return 0;
>  }
>
> +static bool __init intc_map(struct irq_domain *domain, int irq)
> +{
> +       int res;

warning: unused variable ‘res’ [-Wunused-variable]

> +
> +       if (!irq_to_desc(irq) && irq_alloc_desc_at(irq, NUMA_NO_NODE) != irq) {
> +               pr_err("uname to allocate IRQ %d\n", irq);
> +               return false;
> +       }
> +
> +       if (irq_domain_associate(domain, irq, irq)) {
> +               pr_err("domain association failure\n");
> +               return false;
> +       }
> +
> +       return true;
> +}
> +
>  int __init register_intc_controller(struct intc_desc *desc)
>  {
>         unsigned int i, k, smp;
> @@ -316,19 +333,8 @@ int __init register_intc_controller(struct intc_desc *desc)

warning: unused variable ‘res’ [-Wunused-variable]

>                 if (!vect->enum_id)
>                         continue;
>
> -               res = irq_create_identity_mapping(d->domain, irq);


> -               if (unlikely(res)) {
> -                       if (res == -EEXIST) {
> -                               res = irq_domain_associate(d->domain, irq, irq);
> -                               if (unlikely(res)) {
> -                                       pr_err("domain association failure\n");
> -                                       continue;
> -                               }
> -                       } else {
> -                               pr_err("can't identity map IRQ %d\n", irq);
> -                               continue;
> -                       }
> -               }
> +               if (!intc_map(d->domain, irq))
> +                       continue;
>
>                 intc_irq_xlate_set(irq, vect->enum_id, d);
>                 intc_register_irq(desc, d, vect->enum_id, irq);

Otherwise this seems to work fine on real hardware (landisk) and qemu
(rts7751r2d).  I did verify that the new function intc_map() is called.

Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-04-06 10:32 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-06  9:35 [PATCH 0/9] Cleaning up some of the irqdomain features Marc Zyngier
2021-04-06  9:35 ` Marc Zyngier
2021-04-06  9:35 ` Marc Zyngier
2021-04-06  9:35 ` [PATCH 1/9] irqdomain: Reimplement irq_linear_revmap() with irq_find_mapping() Marc Zyngier
2021-04-06  9:35   ` Marc Zyngier
2021-04-06  9:35   ` Marc Zyngier
2021-04-06 11:21   ` Christophe Leroy
2021-04-06 11:21     ` Christophe Leroy
2021-04-06 12:12     ` Marc Zyngier
2021-04-06 12:12       ` Marc Zyngier
2021-04-06 12:12       ` Marc Zyngier
2021-04-06  9:35 ` [PATCH 2/9] ARM: PXA: Kill use of irq_create_strict_mappings() Marc Zyngier
2021-04-06  9:35   ` Marc Zyngier
2021-04-06  9:35   ` Marc Zyngier
2021-04-22 13:53   ` [irqchip: irq/irqchip-next] " irqchip-bot for Marc Zyngier
2021-04-22 15:07   ` irqchip-bot for Marc Zyngier
2021-04-26 22:39   ` [PATCH 2/9] " Guenter Roeck
2021-04-26 22:39     ` Guenter Roeck
2021-04-26 22:39     ` Guenter Roeck
2021-04-27  8:30     ` Marc Zyngier
2021-04-27  8:30       ` Marc Zyngier
2021-04-27  8:30       ` Marc Zyngier
2021-04-27 12:56       ` Guenter Roeck
2021-04-27 12:56         ` Guenter Roeck
2021-04-27 12:56         ` Guenter Roeck
2021-04-29 12:56     ` [irqchip: irq/irqchip-next] ARM: PXA: Fix cplds irqdesc allocation when using legacy mode irqchip-bot for Marc Zyngier
2021-05-10 13:16     ` irqchip-bot for Marc Zyngier
2021-04-06  9:35 ` [PATCH 3/9] irqchip/jcore-aic: Kill use of irq_create_strict_mappings() Marc Zyngier
2021-04-06  9:35   ` Marc Zyngier
2021-04-06  9:35   ` Marc Zyngier
2021-04-22 13:53   ` [irqchip: irq/irqchip-next] " irqchip-bot for Marc Zyngier
2021-04-22 15:07   ` irqchip-bot for Marc Zyngier
2021-04-06  9:35 ` [PATCH 4/9] sh: intc: Drop the use of irq_create_identity_mapping() Marc Zyngier
2021-04-06  9:35   ` Marc Zyngier
2021-04-06  9:35   ` Marc Zyngier
2021-04-06 10:32   ` Geert Uytterhoeven [this message]
2021-04-06 10:32     ` Geert Uytterhoeven
2021-04-06 10:32     ` Geert Uytterhoeven
2021-04-06 13:02     ` Marc Zyngier
2021-04-06 13:02       ` Marc Zyngier
2021-04-06 13:02       ` Marc Zyngier
2021-04-06  9:35 ` [PATCH 5/9] irqdomain: Kill irq_create_strict_mappings()/irq_create_identity_mapping() Marc Zyngier
2021-04-06  9:35   ` Marc Zyngier
2021-04-06  9:35   ` Marc Zyngier
2021-04-06  9:35 ` [PATCH 6/9] mips: netlogic: Use irq_domain_simple_ops for XLP PIC Marc Zyngier
2021-04-06  9:35   ` Marc Zyngier
2021-04-06  9:35   ` Marc Zyngier
2021-04-06 11:36   ` Thomas Bogendoerfer
2021-04-06 11:36     ` Thomas Bogendoerfer
2021-04-06 11:36     ` Thomas Bogendoerfer
2021-04-06  9:35 ` [PATCH 7/9] irqdomain: Drop references to recusive irqdomain setup Marc Zyngier
2021-04-06  9:35   ` Marc Zyngier
2021-04-06  9:35   ` Marc Zyngier
2021-04-22 13:53   ` [irqchip: irq/irqchip-next] " irqchip-bot for Marc Zyngier
2021-04-22 15:07   ` irqchip-bot for Marc Zyngier
2021-04-06  9:35 ` [PATCH 8/9] powerpc: Convert irq_domain_add_legacy_isa use to irq_domain_add_legacy Marc Zyngier
2021-04-06  9:35   ` Marc Zyngier
2021-04-06  9:35   ` Marc Zyngier
2021-04-06  9:35 ` [PATCH 9/9] irqdomain: Kill irq_domain_add_legacy_isa Marc Zyngier
2021-04-06  9:35   ` Marc Zyngier
2021-04-06  9:35   ` Marc Zyngier

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='CAMuHMdU3vo1AWuDr69WK8-1w38+Q7KturAoL=cFpspZiYr2ssA@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=dalias@libc.org \
    --cc=daniel@zonque.org \
    --cc=haojian.zhuang@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maz@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=robert.jarzmik@free.fr \
    --cc=tglx@linutronix.de \
    --cc=tsbogend@alpha.franken.de \
    --cc=ysato@users.sourceforge.jp \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.