Re: [PATCH] gpio: vf610: Mask all GPIO interrupts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 27.01.2019 22:58, Andrew Lunn wrote:
> On SoC reset all GPIO interrupts are disable. However, if kexec is
> used to boot into a new kernel, the SoC does not experience a
> reset. Hence GPIO interrupts can be left enabled from the previous
> kernel. It is then possible for the interrupt to fire before an
> interrupt handler is registered, resulting in the kernel complaining
> of an "unexpected IRQ trap", the interrupt is never cleared, and so
> fires again, resulting in an interrupt storm.

This behavior might be used by the secondary CPU, e.g. when the M4 is
registering for an interrupt.

However, this is anyway a bit hacky, and probably shouldn't be used in
practise. One should only assign complete banks to the secondary CPU,
and disable handling on the Linux side.

So from my POV:

Acked-by: Stefan Agner <stefan@xxxxxxxx>

--
Stefan

> 
> Disable all GPIO interrupts before registering the GPIO IRQ chip.
> 
> Cc: Stefan Agner <stefan@xxxxxxxx>
> Fixes: 7f2691a19627 ("gpio: vf610: add gpiolib/IRQ chip driver for Vybrid")
> Signed-off-by: Andrew Lunn <andrew@xxxxxxx>
> ---
> 
> Hi Linus
> 
> I was wondering if this should be done in gpiolib, as part of
> gpiochip_irqchip_add() ?
> 
>  drivers/gpio/gpio-vf610.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c
> index 1b79ebcfce3e..541fa6ac399d 100644
> --- a/drivers/gpio/gpio-vf610.c
> +++ b/drivers/gpio/gpio-vf610.c
> @@ -253,6 +253,7 @@ static int vf610_gpio_probe(struct platform_device *pdev)
>  	struct vf610_gpio_port *port;
>  	struct resource *iores;
>  	struct gpio_chip *gc;
> +	int i;
>  	int ret;
>  
>  	port = devm_kzalloc(&pdev->dev, sizeof(*port), GFP_KERNEL);
> @@ -319,6 +320,10 @@ static int vf610_gpio_probe(struct platform_device *pdev)
>  	if (ret < 0)
>  		return ret;
>  
> +	/* Mask all GPIO interrupts */
> +	for (i = 0; i < gc->ngpio; i++)
> +		vf610_gpio_writel(0, port->base + PORT_PCR(i));
> +
>  	/* Clear the interrupt status register for all GPIO's */
>  	vf610_gpio_writel(~0, port->base + PORT_ISFR);



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux