All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Théo Lebrun" <theo.lebrun@bootlin.com>
To: "Bartosz Golaszewski" <brgl@bgdev.pl>
Cc: "Linus Walleij" <linus.walleij@linaro.org>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
	<linux-gpio@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-mips@vger.kernel.org>,
	"Gregory CLEMENT" <gregory.clement@bootlin.com>,
	"Vladimir Kondratiev" <vladimir.kondratiev@mobileye.com>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	"Tawfik Bayouk" <tawfik.bayouk@mobileye.com>
Subject: Re: [PATCH 16/23] gpio: nomadik: support shared GPIO IRQs
Date: Mon, 19 Feb 2024 16:54:55 +0100	[thread overview]
Message-ID: <CZ96EIJ22CYS.1AMRRY388V466@bootlin.com> (raw)
In-Reply-To: <CAMRc=MdFBFFTYKHgDfOieNZJ+-x7ZZMiYty6buOp2J=eFUjt0Q@mail.gmail.com>

Hello,

On Mon Feb 19, 2024 at 4:48 PM CET, Bartosz Golaszewski wrote:
> On Wed, Feb 14, 2024 at 5:24 PM Théo Lebrun <theo.lebrun@bootlin.com> wrote:
> >
> > Support a single IRQs used by multiple GPIO banks. Change the IRQ
> > handler type from a chained handler (as used by gpiolib
> > for ->parent_handler) to a threaded IRQ.
> >
> > Use a fake raw spinlock to ensure generic_handle_irq() is called in a
> > no-irq context. See Documentation/driver-api/gpio/driver.rst, "CHAINED
> > CASCADED GPIO IRQCHIPS" for additional information.
> >
>
> Any reason for not using preempt_disable()?

I did what the doc recommended:

> The generic_handle_irq() is expected to be called with IRQ disabled,
> so the IRQ core will complain if it is called from an IRQ handler which is
> forced to a thread. The "fake?" raw lock can be used to work around this
> problem::
>
>   raw_spinlock_t wa_lock;
>   static irqreturn_t omap_gpio_irq_handler(int irq, void *gpiobank)
>       unsigned long wa_lock_flags;
>       raw_spin_lock_irqsave(&bank->wa_lock, wa_lock_flags);
>       generic_handle_irq(irq_find_mapping(bank->chip.irq.domain, bit));
>       raw_spin_unlock_irqrestore(&bank->wa_lock, wa_lock_flags);

If you confirm I should be using preempt_disable() that's what I'll do
in the next revision. I could even throw in a documentation patch if
the advice is outdated.

Thanks Bartosz,

--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

WARNING: multiple messages have this Message-ID (diff)
From: "Théo Lebrun" <theo.lebrun@bootlin.com>
To: "Bartosz Golaszewski" <brgl@bgdev.pl>
Cc: "Linus Walleij" <linus.walleij@linaro.org>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
	<linux-gpio@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-mips@vger.kernel.org>,
	"Gregory CLEMENT" <gregory.clement@bootlin.com>,
	"Vladimir Kondratiev" <vladimir.kondratiev@mobileye.com>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	"Tawfik Bayouk" <tawfik.bayouk@mobileye.com>
Subject: Re: [PATCH 16/23] gpio: nomadik: support shared GPIO IRQs
Date: Mon, 19 Feb 2024 16:54:55 +0100	[thread overview]
Message-ID: <CZ96EIJ22CYS.1AMRRY388V466@bootlin.com> (raw)
In-Reply-To: <CAMRc=MdFBFFTYKHgDfOieNZJ+-x7ZZMiYty6buOp2J=eFUjt0Q@mail.gmail.com>

Hello,

On Mon Feb 19, 2024 at 4:48 PM CET, Bartosz Golaszewski wrote:
> On Wed, Feb 14, 2024 at 5:24 PM Théo Lebrun <theo.lebrun@bootlin.com> wrote:
> >
> > Support a single IRQs used by multiple GPIO banks. Change the IRQ
> > handler type from a chained handler (as used by gpiolib
> > for ->parent_handler) to a threaded IRQ.
> >
> > Use a fake raw spinlock to ensure generic_handle_irq() is called in a
> > no-irq context. See Documentation/driver-api/gpio/driver.rst, "CHAINED
> > CASCADED GPIO IRQCHIPS" for additional information.
> >
>
> Any reason for not using preempt_disable()?

I did what the doc recommended:

> The generic_handle_irq() is expected to be called with IRQ disabled,
> so the IRQ core will complain if it is called from an IRQ handler which is
> forced to a thread. The "fake?" raw lock can be used to work around this
> problem::
>
>   raw_spinlock_t wa_lock;
>   static irqreturn_t omap_gpio_irq_handler(int irq, void *gpiobank)
>       unsigned long wa_lock_flags;
>       raw_spin_lock_irqsave(&bank->wa_lock, wa_lock_flags);
>       generic_handle_irq(irq_find_mapping(bank->chip.irq.domain, bit));
>       raw_spin_unlock_irqrestore(&bank->wa_lock, wa_lock_flags);

If you confirm I should be using preempt_disable() that's what I'll do
in the next revision. I could even throw in a documentation patch if
the advice is outdated.

Thanks Bartosz,

--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

  reply	other threads:[~2024-02-19 15:54 UTC|newest]

Thread overview: 124+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-14 16:23 [PATCH 00/23] Rework Nomadik GPIO to add Mobileye EyeQ5 support Théo Lebrun
2024-02-14 16:23 ` Théo Lebrun
2024-02-14 16:23 ` [PATCH 01/23] dt-bindings: gpio: nomadik: convert into yaml format Théo Lebrun
2024-02-14 16:23   ` Théo Lebrun
2024-02-15  9:11   ` Krzysztof Kozlowski
2024-02-15  9:11     ` Krzysztof Kozlowski
2024-02-15  9:47     ` Théo Lebrun
2024-02-15  9:47       ` Théo Lebrun
2024-02-19 14:50   ` Linus Walleij
2024-02-19 14:50     ` Linus Walleij
2024-02-14 16:23 ` [PATCH 02/23] dt-bindings: gpio: nomadik: add optional ngpios property Théo Lebrun
2024-02-14 16:23   ` Théo Lebrun
2024-02-15  9:12   ` Krzysztof Kozlowski
2024-02-15  9:12     ` Krzysztof Kozlowski
2024-02-19 14:50   ` Linus Walleij
2024-02-19 14:50     ` Linus Walleij
2024-02-19 14:55     ` Théo Lebrun
2024-02-19 14:55       ` Théo Lebrun
2024-02-14 16:23 ` [PATCH 03/23] dt-bindings: gpio: nomadik: add mobileye,eyeq5-gpio compatible Théo Lebrun
2024-02-14 16:23   ` Théo Lebrun
2024-02-15  9:13   ` Krzysztof Kozlowski
2024-02-15  9:13     ` Krzysztof Kozlowski
2024-02-15  9:52     ` Théo Lebrun
2024-02-15  9:52       ` Théo Lebrun
2024-02-14 16:23 ` [PATCH 04/23] dt-bindings: gpio: nomadik: add optional reset property Théo Lebrun
2024-02-14 16:23   ` Théo Lebrun
2024-02-15  9:13   ` Krzysztof Kozlowski
2024-02-15  9:13     ` Krzysztof Kozlowski
2024-02-19 14:55   ` Linus Walleij
2024-02-19 14:55     ` Linus Walleij
2024-02-14 16:23 ` [PATCH 05/23] gpio: nomadik: extract GPIO platform driver from drivers/pinctrl/nomadik/ Théo Lebrun
2024-02-14 16:23   ` Théo Lebrun
2024-02-15 10:03   ` Philipp Zabel
2024-02-15 10:03     ` Philipp Zabel
2024-02-16 10:43     ` Théo Lebrun
2024-02-16 10:43       ` Théo Lebrun
2024-02-19 15:33     ` Bartosz Golaszewski
2024-02-19 15:33       ` Bartosz Golaszewski
2024-02-21 11:41       ` Philipp Zabel
2024-02-21 11:41         ` Philipp Zabel
2024-02-19 16:08   ` Bartosz Golaszewski
2024-02-19 16:08     ` Bartosz Golaszewski
2024-02-21 16:02     ` Théo Lebrun
2024-02-21 16:02       ` Théo Lebrun
2024-02-21 14:37   ` Linus Walleij
2024-02-21 14:37     ` Linus Walleij
2024-02-21 16:20     ` Théo Lebrun
2024-02-21 16:20       ` Théo Lebrun
2024-02-21 19:31       ` Linus Walleij
2024-02-21 19:31         ` Linus Walleij
2024-02-14 16:23 ` [PATCH 06/23] pinctrl: nomadik: fix build warning (-Wformat) Théo Lebrun
2024-02-14 16:23   ` Théo Lebrun
2024-02-14 16:24 ` [PATCH 07/23] pinctrl: nomadik: fix build warning (-Wpointer-to-int-cast) Théo Lebrun
2024-02-14 16:24   ` Théo Lebrun
2024-02-14 16:24 ` [PATCH 08/23] pinctrl: nomadik: minimise indentation in probe Théo Lebrun
2024-02-14 16:24   ` Théo Lebrun
2024-02-14 16:24 ` [PATCH 09/23] pinctrl: nomadik: follow type-system kernel coding conventions Théo Lebrun
2024-02-14 16:24   ` Théo Lebrun
2024-02-14 16:24 ` [PATCH 10/23] pinctrl: nomadik: follow whitespace " Théo Lebrun
2024-02-14 16:24   ` Théo Lebrun
2024-02-14 16:24 ` [PATCH 11/23] pinctrl: nomadik: follow conditional " Théo Lebrun
2024-02-14 16:24   ` Théo Lebrun
2024-02-14 16:24 ` [PATCH 12/23] gpio: nomadik: request dynamic ID allocation Théo Lebrun
2024-02-14 16:24   ` Théo Lebrun
2024-02-14 16:24 ` [PATCH 13/23] gpio: nomadik: fix offset bug in nmk_pmx_set() Théo Lebrun
2024-02-14 16:24   ` Théo Lebrun
2024-02-19 15:54   ` Bartosz Golaszewski
2024-02-19 15:54     ` Bartosz Golaszewski
2024-02-21 15:57     ` Théo Lebrun
2024-02-21 15:57       ` Théo Lebrun
2024-02-19 21:56   ` Linus Walleij
2024-02-19 21:56     ` Linus Walleij
2024-02-21 16:05     ` Théo Lebrun
2024-02-21 16:05       ` Théo Lebrun
2024-02-14 16:24 ` [PATCH 14/23] gpio: nomadik: make clock optional Théo Lebrun
2024-02-14 16:24   ` Théo Lebrun
2024-02-14 16:24 ` [PATCH 15/23] gpio: nomadik: change driver name from gpio to gpio-nomadik Théo Lebrun
2024-02-14 16:24   ` Théo Lebrun
2024-02-14 16:24 ` [PATCH 16/23] gpio: nomadik: support shared GPIO IRQs Théo Lebrun
2024-02-14 16:24   ` Théo Lebrun
2024-02-19 15:48   ` Bartosz Golaszewski
2024-02-19 15:48     ` Bartosz Golaszewski
2024-02-19 15:54     ` Théo Lebrun [this message]
2024-02-19 15:54       ` Théo Lebrun
2024-02-19 16:17       ` Bartosz Golaszewski
2024-02-19 16:17         ` Bartosz Golaszewski
2024-02-20  8:07     ` Linus Walleij
2024-02-20  8:07       ` Linus Walleij
2024-02-14 16:24 ` [PATCH 17/23] gpio: nomadik: handle variadic GPIO count Théo Lebrun
2024-02-14 16:24   ` Théo Lebrun
2024-02-19 16:17   ` Bartosz Golaszewski
2024-02-19 16:17     ` Bartosz Golaszewski
2024-02-20  8:08   ` Linus Walleij
2024-02-20  8:08     ` Linus Walleij
2024-02-14 16:24 ` [PATCH 18/23] gpio: nomadik: support mobileye,eyeq5-gpio Théo Lebrun
2024-02-14 16:24   ` Théo Lebrun
2024-02-21 13:45   ` Linus Walleij
2024-02-21 13:45     ` Linus Walleij
2024-02-21 16:22     ` Théo Lebrun
2024-02-21 16:22       ` Théo Lebrun
2024-02-21 14:31   ` Linus Walleij
2024-02-21 14:31     ` Linus Walleij
2024-02-21 16:16     ` Théo Lebrun
2024-02-21 16:16       ` Théo Lebrun
2024-02-21 19:36       ` Linus Walleij
2024-02-21 19:36         ` Linus Walleij
2024-02-22  9:37         ` Théo Lebrun
2024-02-22  9:37           ` Théo Lebrun
2024-02-14 16:24 ` [PATCH 19/23] gpio: nomadik: grab optional reset control and deassert it at probe Théo Lebrun
2024-02-14 16:24   ` Théo Lebrun
2024-02-15 10:19   ` Philipp Zabel
2024-02-15 10:19     ` Philipp Zabel
2024-02-16 10:46     ` Théo Lebrun
2024-02-16 10:46       ` Théo Lebrun
2024-02-14 16:24 ` [PATCH 20/23] MIPS: eyeq5_defconfig: enable GPIO by default Théo Lebrun
2024-02-14 16:24   ` Théo Lebrun
2024-02-14 16:24 ` [PATCH 21/23] MIPS: mobileye: eyeq5: add two GPIO bank nodes Théo Lebrun
2024-02-14 16:24   ` Théo Lebrun
2024-02-14 16:24 ` [PATCH 22/23] MIPS: mobileye: eyeq5: add resets to GPIO banks Théo Lebrun
2024-02-14 16:24   ` Théo Lebrun
2024-02-14 16:24 ` [PATCH 23/23] MIPS: mobileye: eyeq5: map GPIOs to pins using gpio-ranges Théo Lebrun
2024-02-14 16:24   ` Théo Lebrun
2024-02-19 15:44 ` [PATCH 00/23] Rework Nomadik GPIO to add Mobileye EyeQ5 support Bartosz Golaszewski
2024-02-19 15:44   ` Bartosz Golaszewski

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=CZ96EIJ22CYS.1AMRRY388V466@bootlin.com \
    --to=theo.lebrun@bootlin.com \
    --cc=brgl@bgdev.pl \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregory.clement@bootlin.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=tawfik.bayouk@mobileye.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=tsbogend@alpha.franken.de \
    --cc=vladimir.kondratiev@mobileye.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 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.