linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] GIC: Assign correct flow handler type in set_type callback
@ 2010-12-30  5:29 Abhijeet Dharmapurikar
  2010-12-30  6:27 ` Rabin Vincent
  0 siblings, 1 reply; 4+ messages in thread
From: Abhijeet Dharmapurikar @ 2010-12-30  5:29 UTC (permalink / raw)
  To: linux-arm-kernel

There are some interrupts that are true edge triggered in nature. If not
marked IRQ_PENDING, when disabled, they will be lost.

Use the set_type callback to assign the correct flow type handler for
shared peripheral interrupts.

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
---
This came to light when a edge triggered interrupt was supposed to wakeup the
sytem. The flow handler was set to the default handle_level_irq. On the resume
path the flow handler was invoked right after the I bit was cleared but before
each individual interrupts were enabled. This made the handle_level_irq ignore
the interrupt (mask_ack it) and it was lost. handle_edge_irq does the right
thing by marking the interrupt as IRQ_PENDING and when the resume code gets to
enabling each interrupt this interrupt is resent again.

 arch/arm/common/gic.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c
index e6388dc..a83594a 100644
--- a/arch/arm/common/gic.c
+++ b/arch/arm/common/gic.c
@@ -136,6 +136,9 @@ static int gic_set_type(unsigned int irq, unsigned int type)
 
 	spin_unlock(&irq_controller_lock);
 
+	if ((type & IRQ_TYPE_EDGE_RISING) && gicirq > 31)
+		__set_irq_handler_unlocked(irq, handle_edge_irq);
+
 	return 0;
 }
 
-- 
1.7.1
Sent by an employee of Qualcomm Innovation Center, Inc. Qualcomm Innovation
Center, Inc. is a member of Code Aurora Forum.

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

* [PATCH] GIC: Assign correct flow handler type in set_type callback
  2010-12-30  5:29 [PATCH] GIC: Assign correct flow handler type in set_type callback Abhijeet Dharmapurikar
@ 2010-12-30  6:27 ` Rabin Vincent
  2010-12-31 10:39   ` Abhijeet Dharmapurikar
  0 siblings, 1 reply; 4+ messages in thread
From: Rabin Vincent @ 2010-12-30  6:27 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Dec 30, 2010 at 10:59 AM, Abhijeet Dharmapurikar
<adharmap@codeaurora.org> wrote:
> There are some interrupts that are true edge triggered in nature. If not
> marked IRQ_PENDING, when disabled, they will be lost.
>
> Use the set_type callback to assign the correct flow type handler for
> shared peripheral interrupts.
>
> Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
> ---
> This came to light when a edge triggered interrupt was supposed to wakeup the
> sytem. The flow handler was set to the default handle_level_irq. On the resume
> path the flow handler was invoked right after the I bit was cleared but before
> each individual interrupts were enabled. This made the handle_level_irq ignore

Why does the flow handler hit when the interrupt is disabled?  Have you set
IRQF_NOSUSPEND on this interrupt?

> the interrupt (mask_ack it) and it was lost. handle_edge_irq does the right
> thing by marking the interrupt as IRQ_PENDING and when the resume code gets to
> enabling each interrupt this interrupt is resent again.

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

* [PATCH] GIC: Assign correct flow handler type in set_type callback
  2010-12-30  6:27 ` Rabin Vincent
@ 2010-12-31 10:39   ` Abhijeet Dharmapurikar
  2011-01-02  6:26     ` Abhijeet Dharmapurikar
  0 siblings, 1 reply; 4+ messages in thread
From: Abhijeet Dharmapurikar @ 2010-12-31 10:39 UTC (permalink / raw)
  To: linux-arm-kernel

On 12/29/2010 10:27 PM, Rabin Vincent wrote:
> On Thu, Dec 30, 2010 at 10:59 AM, Abhijeet Dharmapurikar
> <adharmap@codeaurora.org>  wrote:
>> There are some interrupts that are true edge triggered in nature. If not
>> marked IRQ_PENDING, when disabled, they will be lost.
>>
>> Use the set_type callback to assign the correct flow type handler for
>> shared peripheral interrupts.
>>
>> Signed-off-by: Abhijeet Dharmapurikar<adharmap@codeaurora.org>
>> ---
>> This came to light when a edge triggered interrupt was supposed to wakeup the
>> sytem. The flow handler was set to the default handle_level_irq. On the resume
>> path the flow handler was invoked right after the I bit was cleared but before
>> each individual interrupts were enabled. This made the handle_level_irq ignore
>
> Why does the flow handler hit when the interrupt is disabled?  Have you set
> IRQF_NOSUSPEND on this interrupt?
>
Since GIC doesnt have disable callback it implements lazy disabling. The 
interrupt is only marked IRQ_DISABLED in the descriptor but is not 
masked in the GIC. Hence the interrupt flow handler is hit.

Now that I re-read the code setting IRQF_NO_SUSPEND would fix the issue. 
But shouldnt set_irq_wake() do something similar?

Do I need to request IRQF_NO_SUSPEND for all the interrupts that could 
possibly wakeup the system - seems a bit unnecessary. IMO the interrupt 
should not be disabled if it is marked IRQF_NO_SUPEND || IRQ_WAKEUP is set.

Abhijeet

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

* [PATCH] GIC: Assign correct flow handler type in set_type callback
  2010-12-31 10:39   ` Abhijeet Dharmapurikar
@ 2011-01-02  6:26     ` Abhijeet Dharmapurikar
  0 siblings, 0 replies; 4+ messages in thread
From: Abhijeet Dharmapurikar @ 2011-01-02  6:26 UTC (permalink / raw)
  To: linux-arm-kernel

On 12/31/2010 02:39 AM, Abhijeet Dharmapurikar wrote:
> On 12/29/2010 10:27 PM, Rabin Vincent wrote:
>> On Thu, Dec 30, 2010 at 10:59 AM, Abhijeet Dharmapurikar
>> <adharmap@codeaurora.org> wrote:
>>> There are some interrupts that are true edge triggered in nature. If not
>>> marked IRQ_PENDING, when disabled, they will be lost.
>>>
>>> Use the set_type callback to assign the correct flow type handler for
>>> shared peripheral interrupts.
>>>
>>> Signed-off-by: Abhijeet Dharmapurikar<adharmap@codeaurora.org>
>>> ---
>>> This came to light when a edge triggered interrupt was supposed to
>>> wakeup the
>>> sytem. The flow handler was set to the default handle_level_irq. On
>>> the resume
>>> path the flow handler was invoked right after the I bit was cleared
>>> but before
>>> each individual interrupts were enabled. This made the
>>> handle_level_irq ignore
>>
>> Why does the flow handler hit when the interrupt is disabled? Have you
>> set
>> IRQF_NOSUSPEND on this interrupt?
>>
> Since GIC doesnt have disable callback it implements lazy disabling. The
> interrupt is only marked IRQ_DISABLED in the descriptor but is not
> masked in the GIC. Hence the interrupt flow handler is hit.
>
> Now that I re-read the code setting IRQF_NO_SUSPEND would fix the issue.

Let me correct myself, IRQF_NO_SUSPEND isnt exactly what I want to do. 
If an interrupt triggers after suspend_device_irqs() is run and before 
the I bit is set in arch_suspend_disable_irqs() the system will handle 
the interrupt but will not abort suspend - check_wakeup_irqs() will 
return 0.

IMO, using handle_edge_irq() for an edge triggered wakeup interrupt 
would be the right way to address the issue.

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

end of thread, other threads:[~2011-01-02  6:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-30  5:29 [PATCH] GIC: Assign correct flow handler type in set_type callback Abhijeet Dharmapurikar
2010-12-30  6:27 ` Rabin Vincent
2010-12-31 10:39   ` Abhijeet Dharmapurikar
2011-01-02  6:26     ` Abhijeet Dharmapurikar

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