mbox series

[0/4] Fix the regression for the thunderx gpio

Message ID 20200114082821.14015-1-haokexin@gmail.com
Headers show
Series Fix the regression for the thunderx gpio | expand

Message

Kevin Hao Jan. 14, 2020, 8:28 a.m. UTC
Hi Linus,

Since the commit a7fc89f9d5fc ("gpio: thunderx: Switch to
GPIOLIB_IRQCHIP"), the thunderx gpio doesn't work anymore. I noticed
that you have submitted a patch [1] to fix the " irq_domain_push_irq: -22"
error, but the kernel would panic after applying that fix because the hwirq
passed to the msi irqdomain is still not correct. It seems that we need
more codes to make the thunderx gpio work with the GPIOLIB_IRQCHIP. So I
would prefer to revert the commit a7fc89f9d5fc first to make the thunderx
gpio to work on the 5.4.x and 5.5 at least. We can then do more test for
GPIOLIB_IRQCHIP switching (which the patch 2 ~ 4 do) before merging
them.

[1] https://patchwork.ozlabs.org/patch/1210180/

Kevin Hao (4):
  Revert "gpio: thunderx: Switch to GPIOLIB_IRQCHIP"
  gpiolib: Add support for the irqdomain which doesn't use irq_fwspec as
    arg
  gpiolib: Add the support for the msi parent domain
  gpio: thunderx: Switch to GPIOLIB_IRQCHIP

 drivers/gpio/gpio-tegra186.c             | 13 ++++++--
 drivers/gpio/gpio-thunderx.c             | 36 +++++++++++++++++++---
 drivers/gpio/gpiolib.c                   | 51 ++++++++++++++++++++++----------
 drivers/pinctrl/qcom/pinctrl-spmi-gpio.c |  2 +-
 drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c |  2 +-
 include/linux/gpio/driver.h              | 21 +++++--------
 6 files changed, 87 insertions(+), 38 deletions(-)

Comments

Linus Walleij Jan. 15, 2020, 10:20 a.m. UTC | #1
On Tue, Jan 14, 2020 at 9:39 AM Kevin Hao <haokexin@gmail.com> wrote:

> Since the commit a7fc89f9d5fc ("gpio: thunderx: Switch to
> GPIOLIB_IRQCHIP"), the thunderx gpio doesn't work anymore. I noticed
> that you have submitted a patch [1] to fix the " irq_domain_push_irq: -22"
> error, but the kernel would panic after applying that fix because the hwirq
> passed to the msi irqdomain is still not correct. It seems that we need
> more codes to make the thunderx gpio work with the GPIOLIB_IRQCHIP. So I
> would prefer to revert the commit a7fc89f9d5fc first to make the thunderx
> gpio to work on the 5.4.x and 5.5 at least. We can then do more test for
> GPIOLIB_IRQCHIP switching (which the patch 2 ~ 4 do) before merging
> them.

Thanks a LOT Kevin, and I'm sorry for open coding and breaking this
driver so much :/

I have applied all four patches for fixes.

Yours,
Linus Walleij
Tim Harvey March 10, 2020, 8:40 p.m. UTC | #2
On Wed, Jan 15, 2020 at 2:20 AM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Tue, Jan 14, 2020 at 9:39 AM Kevin Hao <haokexin@gmail.com> wrote:
>
> > Since the commit a7fc89f9d5fc ("gpio: thunderx: Switch to
> > GPIOLIB_IRQCHIP"), the thunderx gpio doesn't work anymore. I noticed
> > that you have submitted a patch [1] to fix the " irq_domain_push_irq: -22"
> > error, but the kernel would panic after applying that fix because the hwirq
> > passed to the msi irqdomain is still not correct. It seems that we need
> > more codes to make the thunderx gpio work with the GPIOLIB_IRQCHIP. So I
> > would prefer to revert the commit a7fc89f9d5fc first to make the thunderx
> > gpio to work on the 5.4.x and 5.5 at least. We can then do more test for
> > GPIOLIB_IRQCHIP switching (which the patch 2 ~ 4 do) before merging
> > them.
>
> Thanks a LOT Kevin, and I'm sorry for open coding and breaking this
> driver so much :/
>
> I have applied all four patches for fixes.
>

I'm running into an issue with thunderx-gpio when using a gpio as an
interrupt with an mfd driver I'm working on[1]. The breakage appeared
with 0d04d0c146786da42c6e68c7d2f09c956c5b5bd3 'gpio: thunderx: Use the
default parent apis for {request,release}_resources'[2] and occurs
when irq_chip_request_resources_parent() fails with -ENOSYS. Any ideas
what happened here... It seems perhaps parent_data got lost?

1. https://patchwork.kernel.org/patch/11401555/
2. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/gpio/gpio-thunderx.c?id=0d04d0c146786da42c6e68c7d2f09c956c5b5bd3

Best regards,

Tim
Kevin Hao March 13, 2020, 1:14 a.m. UTC | #3
On Tue, Mar 10, 2020 at 01:40:56PM -0700, Tim Harvey wrote:
> On Wed, Jan 15, 2020 at 2:20 AM Linus Walleij <linus.walleij@linaro.org> wrote:
> >
> > On Tue, Jan 14, 2020 at 9:39 AM Kevin Hao <haokexin@gmail.com> wrote:
> >
> > > Since the commit a7fc89f9d5fc ("gpio: thunderx: Switch to
> > > GPIOLIB_IRQCHIP"), the thunderx gpio doesn't work anymore. I noticed
> > > that you have submitted a patch [1] to fix the " irq_domain_push_irq: -22"
> > > error, but the kernel would panic after applying that fix because the hwirq
> > > passed to the msi irqdomain is still not correct. It seems that we need
> > > more codes to make the thunderx gpio work with the GPIOLIB_IRQCHIP. So I
> > > would prefer to revert the commit a7fc89f9d5fc first to make the thunderx
> > > gpio to work on the 5.4.x and 5.5 at least. We can then do more test for
> > > GPIOLIB_IRQCHIP switching (which the patch 2 ~ 4 do) before merging
> > > them.
> >
> > Thanks a LOT Kevin, and I'm sorry for open coding and breaking this
> > driver so much :/
> >
> > I have applied all four patches for fixes.
> >
> 
> I'm running into an issue with thunderx-gpio when using a gpio as an
> interrupt with an mfd driver I'm working on[1]. The breakage appeared
> with 0d04d0c146786da42c6e68c7d2f09c956c5b5bd3 'gpio: thunderx: Use the
> default parent apis for {request,release}_resources'[2] and occurs
> when irq_chip_request_resources_parent() fails with -ENOSYS. Any ideas
> what happened here... It seems perhaps parent_data got lost?

No, the parent_data doesn't get lost. The reason that -ENOSYS is returned is because
the its_msi_irq_chip (the parent irq chip of thunderx-gpio) doesn't implement the
.irq_request_resources callback. As you can see in the irq_chip_request_resources_parent() code:
    int irq_chip_request_resources_parent(struct irq_data *data)
    {
    	data = data->parent_data;
    
    	if (data->chip->irq_request_resources)
    		return data->chip->irq_request_resources(data);
    
    	return -ENOSYS;
    }

So the commit 0d04d0c14678 does change the logic of the original code and make
the thunderx_gpio_irq_request_resources() return -ENOSYS in a normal case. But
it doesn't matter now since the thunderx_gpio_irq_request_resources() has been
dropped by the patches in this patch series. So your code should work with the latest
code. Could you rebase your code and git it a try?

Thanks,
Kevin


> 
> 1. https://patchwork.kernel.org/patch/11401555/
> 2. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/gpio/gpio-thunderx.c?id=0d04d0c146786da42c6e68c7d2f09c956c5b5bd3
> 
> Best regards,
> 
> Tim