linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 5.4 2/5] gpio: ixp4xx: Make irqchip immutable
       [not found] <20220921155436.235371-1-sashal@kernel.org>
@ 2022-09-21 15:54 ` Sasha Levin
  2022-09-21 16:57   ` Marc Zyngier
  0 siblings, 1 reply; 6+ messages in thread
From: Sasha Levin @ 2022-09-21 15:54 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Linus Walleij, Marc Zyngier, Bartosz Golaszewski, Sasha Levin,
	linusw, kaloz, khalasa, linux-arm-kernel, linux-gpio

From: Linus Walleij <linus.walleij@linaro.org>

[ Upstream commit 94e9bc73d85aa6ecfe249e985ff57abe0ab35f34 ]

This turns the IXP4xx GPIO irqchip into an immutable
irqchip, a bit different from the standard template due
to being hierarchical.

Tested on the IXP4xx which uses drivers/ata/pata_ixp4xx_cf.c
for a rootfs on compact flash with IRQs from this GPIO
block to the CF ATA controller.

Cc: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpio/gpio-ixp4xx.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpio-ixp4xx.c b/drivers/gpio/gpio-ixp4xx.c
index b3b050604e0b..6bd047e2ca46 100644
--- a/drivers/gpio/gpio-ixp4xx.c
+++ b/drivers/gpio/gpio-ixp4xx.c
@@ -67,6 +67,14 @@ static void ixp4xx_gpio_irq_ack(struct irq_data *d)
 	__raw_writel(BIT(d->hwirq), g->base + IXP4XX_REG_GPIS);
 }
 
+static void ixp4xx_gpio_mask_irq(struct irq_data *d)
+{
+	struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
+
+	irq_chip_mask_parent(d);
+	gpiochip_disable_irq(gc, d->hwirq);
+}
+
 static void ixp4xx_gpio_irq_unmask(struct irq_data *d)
 {
 	struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
@@ -76,6 +84,7 @@ static void ixp4xx_gpio_irq_unmask(struct irq_data *d)
 	if (!(g->irq_edge & BIT(d->hwirq)))
 		ixp4xx_gpio_irq_ack(d);
 
+	gpiochip_enable_irq(gc, d->hwirq);
 	irq_chip_unmask_parent(d);
 }
 
@@ -153,12 +162,14 @@ static int ixp4xx_gpio_irq_set_type(struct irq_data *d, unsigned int type)
 	return irq_chip_set_type_parent(d, IRQ_TYPE_LEVEL_HIGH);
 }
 
-static struct irq_chip ixp4xx_gpio_irqchip = {
+static const struct irq_chip ixp4xx_gpio_irqchip = {
 	.name = "IXP4GPIO",
 	.irq_ack = ixp4xx_gpio_irq_ack,
-	.irq_mask = irq_chip_mask_parent,
+	.irq_mask = ixp4xx_gpio_mask_irq,
 	.irq_unmask = ixp4xx_gpio_irq_unmask,
 	.irq_set_type = ixp4xx_gpio_irq_set_type,
+	.flags = IRQCHIP_IMMUTABLE,
+	GPIOCHIP_IRQ_RESOURCE_HELPERS,
 };
 
 static int ixp4xx_gpio_child_to_parent_hwirq(struct gpio_chip *gc,
@@ -282,7 +293,7 @@ static int ixp4xx_gpio_probe(struct platform_device *pdev)
 	g->gc.owner = THIS_MODULE;
 
 	girq = &g->gc.irq;
-	girq->chip = &ixp4xx_gpio_irqchip;
+	gpio_irq_chip_set_chip(girq, &ixp4xx_gpio_irqchip);
 	girq->fwnode = g->fwnode;
 	girq->parent_domain = parent;
 	girq->child_to_parent_hwirq = ixp4xx_gpio_child_to_parent_hwirq;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH AUTOSEL 5.4 2/5] gpio: ixp4xx: Make irqchip immutable
  2022-09-21 15:54 ` [PATCH AUTOSEL 5.4 2/5] gpio: ixp4xx: Make irqchip immutable Sasha Levin
@ 2022-09-21 16:57   ` Marc Zyngier
  2022-09-21 20:04     ` Bartosz Golaszewski
  0 siblings, 1 reply; 6+ messages in thread
From: Marc Zyngier @ 2022-09-21 16:57 UTC (permalink / raw)
  To: Sasha Levin
  Cc: linux-kernel, stable, Linus Walleij, Bartosz Golaszewski, linusw,
	kaloz, khalasa, linux-arm-kernel, linux-gpio

On 2022-09-21 16:54, Sasha Levin wrote:
> From: Linus Walleij <linus.walleij@linaro.org>
> 
> [ Upstream commit 94e9bc73d85aa6ecfe249e985ff57abe0ab35f34 ]
> 
> This turns the IXP4xx GPIO irqchip into an immutable
> irqchip, a bit different from the standard template due
> to being hierarchical.
> 
> Tested on the IXP4xx which uses drivers/ata/pata_ixp4xx_cf.c
> for a rootfs on compact flash with IRQs from this GPIO
> block to the CF ATA controller.
> 
> Cc: Marc Zyngier <maz@kernel.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> Acked-by: Marc Zyngier <maz@kernel.org>
> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
> Signed-off-by: Sasha Levin <sashal@kernel.org>

Why? The required dependencies are only in 5,19, and are
definitely NOT a stable candidate...

This isn't a fix by any stretch of the imagination.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH AUTOSEL 5.4 2/5] gpio: ixp4xx: Make irqchip immutable
  2022-09-21 16:57   ` Marc Zyngier
@ 2022-09-21 20:04     ` Bartosz Golaszewski
  2022-09-22  9:17       ` Marc Zyngier
  2022-09-25  3:17       ` Sasha Levin
  0 siblings, 2 replies; 6+ messages in thread
From: Bartosz Golaszewski @ 2022-09-21 20:04 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: Sasha Levin, linux-kernel, stable, Linus Walleij, linusw, kaloz,
	khalasa, linux-arm-kernel, linux-gpio

On Wed, Sep 21, 2022 at 6:57 PM Marc Zyngier <maz@kernel.org> wrote:
>
> On 2022-09-21 16:54, Sasha Levin wrote:
> > From: Linus Walleij <linus.walleij@linaro.org>
> >
> > [ Upstream commit 94e9bc73d85aa6ecfe249e985ff57abe0ab35f34 ]
> >
> > This turns the IXP4xx GPIO irqchip into an immutable
> > irqchip, a bit different from the standard template due
> > to being hierarchical.
> >
> > Tested on the IXP4xx which uses drivers/ata/pata_ixp4xx_cf.c
> > for a rootfs on compact flash with IRQs from this GPIO
> > block to the CF ATA controller.
> >
> > Cc: Marc Zyngier <maz@kernel.org>
> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> > Acked-by: Marc Zyngier <maz@kernel.org>
> > Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
> > Signed-off-by: Sasha Levin <sashal@kernel.org>
>
> Why? The required dependencies are only in 5,19, and are
> definitely NOT a stable candidate...
>
> This isn't a fix by any stretch of the imagination.
>

Hi Marc,

While I didn't mark it for stable (and it shouldn't go into any branch
earlier than 5.19.x), I did send the patches making the irqchips
immutable to Linus Torvalds as fixes as they technically do *fix* the
warning emitted by gpiolib and make the implementation correct.

I think these patches should still be part of the v5.19.x stable branch.

Bart

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH AUTOSEL 5.4 2/5] gpio: ixp4xx: Make irqchip immutable
  2022-09-21 20:04     ` Bartosz Golaszewski
@ 2022-09-22  9:17       ` Marc Zyngier
  2022-09-22  9:22         ` Bartosz Golaszewski
  2022-09-25  3:17       ` Sasha Levin
  1 sibling, 1 reply; 6+ messages in thread
From: Marc Zyngier @ 2022-09-22  9:17 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Sasha Levin, linux-kernel, stable, Linus Walleij, linusw, kaloz,
	khalasa, linux-arm-kernel, linux-gpio

Hi Bartosz,

On Wed, 21 Sep 2022 21:04:27 +0100,
Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> 
> On Wed, Sep 21, 2022 at 6:57 PM Marc Zyngier <maz@kernel.org> wrote:
> >
> > On 2022-09-21 16:54, Sasha Levin wrote:
> > > From: Linus Walleij <linus.walleij@linaro.org>
> > >
> > > [ Upstream commit 94e9bc73d85aa6ecfe249e985ff57abe0ab35f34 ]
> > >
> > > This turns the IXP4xx GPIO irqchip into an immutable
> > > irqchip, a bit different from the standard template due
> > > to being hierarchical.
> > >
> > > Tested on the IXP4xx which uses drivers/ata/pata_ixp4xx_cf.c
> > > for a rootfs on compact flash with IRQs from this GPIO
> > > block to the CF ATA controller.
> > >
> > > Cc: Marc Zyngier <maz@kernel.org>
> > > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> > > Acked-by: Marc Zyngier <maz@kernel.org>
> > > Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
> > > Signed-off-by: Sasha Levin <sashal@kernel.org>
> >
> > Why? The required dependencies are only in 5,19, and are
> > definitely NOT a stable candidate...
> >
> > This isn't a fix by any stretch of the imagination.
> >
> 
> Hi Marc,
> 
> While I didn't mark it for stable (and it shouldn't go into any branch
> earlier than 5.19.x), I did send the patches making the irqchips
> immutable to Linus Torvalds as fixes as they technically do *fix* the
> warning emitted by gpiolib and make the implementation correct.
> 
> I think these patches should still be part of the v5.19.x stable branch.

5.19, sure. All the dependencies are there, and tightening the driver
implementations is a valuable goal.

However, targeting all the other stable releases (5.4, 5.10, 5.15)
makes little sense. It won't even compile! Do the dependencies need to
be backported? I don't think it is worthwhile, as this is a long
series containing multiple related changes spread all over the tree.
This would defeat the very purpose of a stable tree.

	M.

-- 
Without deviation from the norm, progress is not possible.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH AUTOSEL 5.4 2/5] gpio: ixp4xx: Make irqchip immutable
  2022-09-22  9:17       ` Marc Zyngier
@ 2022-09-22  9:22         ` Bartosz Golaszewski
  0 siblings, 0 replies; 6+ messages in thread
From: Bartosz Golaszewski @ 2022-09-22  9:22 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: Sasha Levin, linux-kernel, stable, Linus Walleij, linusw, kaloz,
	khalasa, linux-arm-kernel, linux-gpio

On Thu, Sep 22, 2022 at 11:17 AM Marc Zyngier <maz@kernel.org> wrote:
>
> Hi Bartosz,
>
> On Wed, 21 Sep 2022 21:04:27 +0100,
> Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> >
> > On Wed, Sep 21, 2022 at 6:57 PM Marc Zyngier <maz@kernel.org> wrote:
> > >
> > > On 2022-09-21 16:54, Sasha Levin wrote:
> > > > From: Linus Walleij <linus.walleij@linaro.org>
> > > >
> > > > [ Upstream commit 94e9bc73d85aa6ecfe249e985ff57abe0ab35f34 ]
> > > >
> > > > This turns the IXP4xx GPIO irqchip into an immutable
> > > > irqchip, a bit different from the standard template due
> > > > to being hierarchical.
> > > >
> > > > Tested on the IXP4xx which uses drivers/ata/pata_ixp4xx_cf.c
> > > > for a rootfs on compact flash with IRQs from this GPIO
> > > > block to the CF ATA controller.
> > > >
> > > > Cc: Marc Zyngier <maz@kernel.org>
> > > > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> > > > Acked-by: Marc Zyngier <maz@kernel.org>
> > > > Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
> > > > Signed-off-by: Sasha Levin <sashal@kernel.org>
> > >
> > > Why? The required dependencies are only in 5,19, and are
> > > definitely NOT a stable candidate...
> > >
> > > This isn't a fix by any stretch of the imagination.
> > >
> >
> > Hi Marc,
> >
> > While I didn't mark it for stable (and it shouldn't go into any branch
> > earlier than 5.19.x), I did send the patches making the irqchips
> > immutable to Linus Torvalds as fixes as they technically do *fix* the
> > warning emitted by gpiolib and make the implementation correct.
> >
> > I think these patches should still be part of the v5.19.x stable branch.
>
> 5.19, sure. All the dependencies are there, and tightening the driver
> implementations is a valuable goal.
>
> However, targeting all the other stable releases (5.4, 5.10, 5.15)
> makes little sense. It won't even compile! Do the dependencies need to
> be backported? I don't think it is worthwhile, as this is a long
> series containing multiple related changes spread all over the tree.
> This would defeat the very purpose of a stable tree.
>

That's what I'm saying. All the conversions to immutable irqchips
should go to v5.19 but nowhere else.

I thought that by saying "This isn't a fix by any stretch of the
imagination." you meant it should go like regular feature patches into
the next merge window only.

Sasha: can you drop this from all branches earlier than v5.19?

Thanks,
Bartosz

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH AUTOSEL 5.4 2/5] gpio: ixp4xx: Make irqchip immutable
  2022-09-21 20:04     ` Bartosz Golaszewski
  2022-09-22  9:17       ` Marc Zyngier
@ 2022-09-25  3:17       ` Sasha Levin
  1 sibling, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2022-09-25  3:17 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Marc Zyngier, linux-kernel, stable, Linus Walleij, linusw, kaloz,
	khalasa, linux-arm-kernel, linux-gpio

On Wed, Sep 21, 2022 at 10:04:27PM +0200, Bartosz Golaszewski wrote:
>On Wed, Sep 21, 2022 at 6:57 PM Marc Zyngier <maz@kernel.org> wrote:
>>
>> On 2022-09-21 16:54, Sasha Levin wrote:
>> > From: Linus Walleij <linus.walleij@linaro.org>
>> >
>> > [ Upstream commit 94e9bc73d85aa6ecfe249e985ff57abe0ab35f34 ]
>> >
>> > This turns the IXP4xx GPIO irqchip into an immutable
>> > irqchip, a bit different from the standard template due
>> > to being hierarchical.
>> >
>> > Tested on the IXP4xx which uses drivers/ata/pata_ixp4xx_cf.c
>> > for a rootfs on compact flash with IRQs from this GPIO
>> > block to the CF ATA controller.
>> >
>> > Cc: Marc Zyngier <maz@kernel.org>
>> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
>> > Acked-by: Marc Zyngier <maz@kernel.org>
>> > Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
>> > Signed-off-by: Sasha Levin <sashal@kernel.org>
>>
>> Why? The required dependencies are only in 5,19, and are
>> definitely NOT a stable candidate...
>>
>> This isn't a fix by any stretch of the imagination.
>>
>
>Hi Marc,
>
>While I didn't mark it for stable (and it shouldn't go into any branch
>earlier than 5.19.x), I did send the patches making the irqchips
>immutable to Linus Torvalds as fixes as they technically do *fix* the
>warning emitted by gpiolib and make the implementation correct.
>
>I think these patches should still be part of the v5.19.x stable branch.

Yes, and as far as I see we are taking those fixes too.

-- 
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-09-25  3:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20220921155436.235371-1-sashal@kernel.org>
2022-09-21 15:54 ` [PATCH AUTOSEL 5.4 2/5] gpio: ixp4xx: Make irqchip immutable Sasha Levin
2022-09-21 16:57   ` Marc Zyngier
2022-09-21 20:04     ` Bartosz Golaszewski
2022-09-22  9:17       ` Marc Zyngier
2022-09-22  9:22         ` Bartosz Golaszewski
2022-09-25  3:17       ` Sasha Levin

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).