mbox series

[v2,0/3] Start getting rid of the GPIO_NO_WAKE_IRQ

Message ID 1629373993-13370-1-git-send-email-mkshah@codeaurora.org
Headers show
Series Start getting rid of the GPIO_NO_WAKE_IRQ | expand

Message

Maulik Shah Aug. 19, 2021, 11:53 a.m. UTC
v2:
- Use fix from marc [1] and drop v1 patch 2
- Add new patch for fixes irq_domain_trim_hierarchy()

gpio_to_irq() reports error at irq_domain_trim_hierarchy() for non wakeup
capable GPIOs that do not have dedicated interrupt at GIC.

Since PDC irqchip do not allocate irq at parent GIC domain for such GPIOs
indicate same by using irq_domain_disconnect_hierarchy() for it own domain
and all its parent domains.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/commit/?h=irq/qcom-pdc-nowake&id=331b2ba388a4a79b5c40b8addf56cbe35099a410
[2] https://patchwork.kernel.org/project/linux-arm-msm/list/?series=532669

Marc Zyngier (1):
  irqchip/qcom-pdc: Start getting rid of the GPIO_NO_WAKE_IRQ

Maulik Shah (2):
  irqdomain: Export irq_domain_disconnect_hierarchy()
  irqdomain: Fix irq_domain_trim_hierarchy()

 drivers/irqchip/qcom-pdc.c | 75 +++++++++++-----------------------------------
 kernel/irq/irqdomain.c     |  6 ++--
 2 files changed, 22 insertions(+), 59 deletions(-)

Comments

Marc Zyngier Aug. 20, 2021, 3:54 p.m. UTC | #1
On Thu, 19 Aug 2021 12:53:12 +0100,
Maulik Shah <mkshah@codeaurora.org> wrote:
> 

> Currently tail marker is moving along with parent domain

> irq data. Fix this to initialize only once from where all

> parent domain needs trimming.

> 

> Also correct the valid irq chip check.

> 

> Signed-off-by: Maulik Shah <mkshah@codeaurora.org>

> ---

>  kernel/irq/irqdomain.c | 5 +++--

>  1 file changed, 3 insertions(+), 2 deletions(-)

> 

> diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c

> index 19e83e9..9f6187b 100644

> --- a/kernel/irq/irqdomain.c

> +++ b/kernel/irq/irqdomain.c

> @@ -1235,7 +1235,7 @@ static int irq_domain_trim_hierarchy(unsigned int virq)

>  	 */

>  	for (irqd = irq_data->parent_data; irqd; irq_data = irqd, irqd = irqd->parent_data) {

>  		/* Can't have a valid irqchip after a trim marker */

> -		if (irqd->chip && tail)

> +		if (!IS_ERR(irqd->chip) && tail)

>  			return -EINVAL;

>  

>  		/* Can't have an empty irqchip before a trim marker */

> @@ -1247,7 +1247,8 @@ static int irq_domain_trim_hierarchy(unsigned int virq)

>  			if (PTR_ERR(irqd->chip) != -ENOTCONN)

>  				return -EINVAL;

>  

> -			tail = irq_data;

> +			if (!tail)

> +				tail = irq_data;

>  		}

>  	}


I think you have the wrong end of the stick. 'tail' represent the
*unique* point in the hierarchy where you can have a trim marker:

(1) If there is a valid irqchip after a trim marker, this is wrong
(2) If there is a trim marker after another trim marker, this is wrong
(3) If there is a NULL irqchip before a trim marker, this is wrong
(4) If there is an error that isn't a trim marker, this is wrong

(1) and (2) are captured by:
		if (irqd->chip && tail)
(3) is captured by:
		if (!irqd->chip && !tail)
(4) is captured by:
		if (IS_ERR(irqd->chip)) {
			/* Only -ENOTCONN is a valid trim marker */
			if (PTR_ERR(irqd->chip) != -ENOTCONN)

The expected usage is that:

- there is a single potential trim marker in the hierarchy
- all the irqd->chip pointers below the marker are NULL
- all the irqd->chip before the marker are neither NULL nor an error

I don't see any bug here.

Thanks,

	M.

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