soc/tegra: pmc: Fail to allocate more than one wake IRQ
PATCH 1/2 soc/tegra: pmc: Fail to allocate more than one wake IRQ
From: Thierry Reding <[email protected]>
The code currently doesn't support allocating more than one wake IRQ at a time. Detect this situation and error out. Also make sure to output a warning when that happens to help track down callers.
--- drivers/soc/tegra/pmc.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/soc/tegra/pmc.c +3 -0
@@ -1863,6 +1863,9 @@ static int tegra_pmc_irq_alloc(struct irq_domain *domain, unsigned int virq,unsigned int i;int err =0 ; +if (WARN_ON (num_irqs >1 )) +return -EINVAL ; +for (i =0 ; i < soc->num_wake_events; i++) {const struct tegra_wake_event *event = &soc->wake_events[i];
Signature · 1 line
2.21.0
PATCH 2/2 soc/tegra: pmc: Avoid crash for non-wake IRQs
From: Thierry Reding <[email protected]>
For interrupts that are not wakeup sources but that may end up getting mapped through the PMC as interrupt parent (this can happen for GPIOs), return early in order to avoid a subsequent crash from an out-of-bounds access to the register region.
--- drivers/soc/tegra/pmc.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/soc/tegra/pmc.c +3 -0
@@ -1924,6 +1924,9 @@ static int tegra_pmc_irq_set_wake(struct irq_data *data, unsigned int on)unsigned int offset, bit;u32 value; +if (WARN_ON (data->hwirq ==ULONG_MAX )) +return 0 ; + offset = data->hwirq /32 ; bit = data->hwirq %32 ;
Signature · 1 line
2.21.0
Quoted 16 lines · Thierry Reding
From: Thierry Reding <[email protected]>
The code currently doesn't support allocating more than one wake IRQ at a time. Detect this situation and error out. Also make sure to output a warning when that happens to help track down callers.
Signed-off-by Thierry Reding <[email protected]>--- drivers/soc/tegra/pmc.c | 3 +++ 1 file changed, 3 insertions(+)drivers/soc/tegra/pmc.c +0
-0
drivers/soc/tegra/pmc.c static int tegra_pmc_irq_alloc(struct irq_domain *domain, unsigned int virq, · line 1870
Quoted 8 lines
drivers/soc/tegra/pmc.c +3
-0@@ -1863,6 +1863,9 @@ static int tegra_pmc_irq_alloc(struct irq_domain *domain, unsigned int virq,unsigned int i;int err =0 ; +if (WARN_ON (num_irqs >1 )) +return -EINVAL ; +for (i =0 ; i < soc->num_wake_events; i++) {const struct tegra_wake_event *event = &soc->wake_events[i];
Cheers
Jon
Signature · 1 line
nvpublic
Re: [PATCH 2/2] soc/tegra: pmc: Avoid crash for non-wake IRQs
In reply to Thierry RedingQuoted 6 lines · Thierry Reding
From: Thierry Reding <[email protected]>
For interrupts that are not wakeup sources but that may end up getting mapped through the PMC as interrupt parent (this can happen for GPIOs), return early in order to avoid a subsequent crash from an out-of-bounds access to the register region.
Maybe worth clarifying here what you mean by 'not wakeup sources' because the Tegra GPIO driver does have a set_wake() API to enable wakeup at the LIC IIRC. So maybe GPIOs that are not wakeup sources for what level of suspend?
Quoted 11 lines
Reported-by Bitan Biswas <[email protected]>Signed-off-by Thierry Reding <[email protected]>--- drivers/soc/tegra/pmc.c | 3 +++ 1 file changed, 3 insertions(+)drivers/soc/tegra/pmc.c +0
-0
drivers/soc/tegra/pmc.c static int tegra_pmc_irq_set_wake(struct irq_data *data, unsigned int on) · line 1931
Quoted 8 lines
drivers/soc/tegra/pmc.c +3
-0@@ -1924,6 +1924,9 @@ static int tegra_pmc_irq_set_wake(struct irq_data *data, unsigned int on)unsigned int offset, bit;u32 value; +if (WARN_ON (data->hwirq ==ULONG_MAX )) +return 0 ; + offset = data->hwirq /32 ; bit = data->hwirq %32 ;
Otherwise ...
Cheers
Jon
Signature · 1 line
nvpublic
Re: [PATCH 2/2] soc/tegra: pmc: Avoid crash for non-wake IRQs
Quoted 10 lines · Jon Hunter
Quoted 6 lines · Thierry Reding
From: Thierry Reding <[email protected]>
For interrupts that are not wakeup sources but that may end up getting mapped through the PMC as interrupt parent (this can happen for GPIOs), return early in order to avoid a subsequent crash from an out-of-bounds access to the register region.
Quoted 4 lines
Maybe worth clarifying here what you mean by 'not wakeup sources' because the Tegra GPIO driver does have a
set_wake()API to enable wakeup at the LIC IIRC. So maybe GPIOs that are not wakeup sources for what level of suspend?
Wakeup sources in the context of PMC is always LP0 wakeup sources. At that point I don't think LIC is enabled anymore. So LIC is to wake up from LP1 (and perhaps LP2), while PMC wakeup sources need to be configured in order to wake up from LP0.
Adding Peter to confirm, I think he's more familiar with the power states on earlier chips than I am.
Thierry
Quoted 23 lines
Quoted 12 lines
Reported-by Bitan Biswas <[email protected]>Signed-off-by Thierry Reding <[email protected]>--- drivers/soc/tegra/pmc.c | 3 +++ 1 file changed, 3 insertions(+)drivers/soc/tegra/pmc.c +0
-0drivers/soc/tegra/pmc.c static int tegra_pmc_irq_set_wake(struct irq_data *data, unsigned int on) · line 1931
Quoted 8 lines
drivers/soc/tegra/pmc.c +3
-0@@ -1924,6 +1924,9 @@ static int tegra_pmc_irq_set_wake(struct irq_data *data, unsigned int on)unsigned int offset, bit;u32 value; +if (WARN_ON (data->hwirq ==ULONG_MAX )) +return 0 ; + offset = data->hwirq /32 ; bit = data->hwirq %32 ;Otherwise ...
Quoted 8 lines
Acked-by Jon Hunter <[email protected]>Cheers
JonSignature · 1 line
nvpublic
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH 2/2] soc/tegra: pmc: Avoid crash for non-wake IRQs
Quoted 16 lines · Thierry Reding
Quoted 10 lines · Jon Hunter
Quoted 6 lines · Thierry Reding
From: Thierry Reding <[email protected]>
For interrupts that are not wakeup sources but that may end up getting mapped through the PMC as interrupt parent (this can happen for GPIOs), return early in order to avoid a subsequent crash from an out-of-bounds access to the register region.
Quoted 4 lines
Maybe worth clarifying here what you mean by 'not wakeup sources' because the Tegra GPIO driver does have a
set_wake()API to enable wakeup at the LIC IIRC. So maybe GPIOs that are not wakeup sources for what level of suspend?
Quoted 7 lines
Wakeup sources in the context of PMC is always LP0 wakeup sources. At that point I don't think LIC is enabled anymore. So LIC is to wake up from LP1 (and perhaps LP2), while PMC wakeup sources need to be configured in order to wake up from LP0.
Adding Peter to confirm, I think he's more familiar with the power states on earlier chips than I am.
Yes. LIC is in a domain which is off during SC7 so it can't trigger a wakeup.
Peter.