All of lore.kernel.org
 help / color / mirror / Atom feed
* How kernel handle interrupts
@ 2012-12-20 14:27 Woody Wu
  2012-12-20 18:05 ` anish singh
  2012-12-20 18:16 ` How kernel handle interrupts Shahbaz khan
  0 siblings, 2 replies; 22+ messages in thread
From: Woody Wu @ 2012-12-20 14:27 UTC (permalink / raw)
  To: kernelnewbies

Hi, List

Where is the Kernel code that handles external interrupts? I want to
have a look at it but haven't found out where it is.

Actually, I have some basic questions about interrupt handling in Linux.
1. After Kernel's ISR received an interrupt, I believe it will invoke a
   handler defined in a device driver if any. But it should be the
   device driver's responsibility or kernel ISR's responsibility to
   clear (or acknowledge) the interrupt?

2. My device, an AX88796B network controller, asserting the interrupt
   line in a level-triggered manner. Now I met problem with the device that
   might caused by the CPU interrupt mode is not set as level-triggered by
   edge trigger.  My CPU is Samsung S3C2410, an ARM920T powered one.  Does
   anyone know usually where and how should I do this kind of setting?


Thanks in advance.

-- 
woody
I can't go back to yesterday - because I was a different person then.

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

* How kernel handle interrupts
  2012-12-20 14:27 How kernel handle interrupts Woody Wu
@ 2012-12-20 18:05 ` anish singh
  2012-12-21  9:34   ` Woody Wu
  2012-12-21 15:34   ` Woody Wu
  2012-12-20 18:16 ` How kernel handle interrupts Shahbaz khan
  1 sibling, 2 replies; 22+ messages in thread
From: anish singh @ 2012-12-20 18:05 UTC (permalink / raw)
  To: kernelnewbies

On Dec 20, 2012 6:30 AM, "Woody Wu" <narkewoody@gmail.com> wrote:
>
> Hi, List
>
> Where is the Kernel code that handles external interrupts? I want to
> have a look at it but haven't found out where it is.
>
> Actually, I have some basic questions about interrupt handling in Linux.
> 1. After Kernel's ISR received an interrupt, I believe it will invoke a
>    handler defined in a device driver if any. But it should be the
>    device driver's responsibility or kernel ISR's responsibility to
>    clear (or acknowledge) the interrupt?
If the interrupt in question is currently being handled then in
the case of edge triggered interrupt we just mask the interrupt,set it
pending and bail out.Once the interrupt handler completes then we check for
pending interrupt and handle it.In level triggered we don't do that.
Kerenel ISR -this is mixture of core kernel interrupt handling code + your
device driver interrupt handler(if this is chip driver which is supposed to
get one interrupt and is reponsible for calling other interrupt handlers
based on the chip register status then you do explicit masking unmasking
yourself).
If you device driver is a interrupt controller driver then you register
your driver with kernel interrupt handling code and need to write some
callbacks such as .mask,.unmask and so on.This callbacks are called at
appropiate places whenever the interrupt is raised.This interrupt is then
passed to drivers who has requested for this interrupt by calling
request_irq.
>
> 2. My device, an AX88796B network controller, asserting the interrupt
>    line in a level-triggered manner. Now I met problem with the device
that
>    might caused by the CPU interrupt mode is not set as level-triggered by
>    edge trigger.  My CPU is Samsung S3C2410, an ARM920T powered one.  Does
>    anyone know usually where and how should I do this kind of setting?
Just pass the parameter "level triggered" in request_irq in your device
driver.
>
>
> Thanks in advance.
>
> --
> woody
> I can't go back to yesterday - because I was a different person then.
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20121220/726cd73b/attachment.html 

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

* How kernel handle interrupts
  2012-12-20 14:27 How kernel handle interrupts Woody Wu
  2012-12-20 18:05 ` anish singh
@ 2012-12-20 18:16 ` Shahbaz khan
  2012-12-21  0:37   ` Woody Wu
  1 sibling, 1 reply; 22+ messages in thread
From: Shahbaz khan @ 2012-12-20 18:16 UTC (permalink / raw)
  To: kernelnewbies

Hi Woody,

Check "do_IRQ()" in arch/x86/kernel/irq.c. It is responsible to handle
device specific interrupts, while ipi and timer interrupts are dealt
elsewhere.

Hope this helps.

BR,
Shahbaz Khan

On Thu, Dec 20, 2012 at 3:27 PM, Woody Wu <narkewoody@gmail.com> wrote:

> Hi, List
>
> Where is the Kernel code that handles external interrupts? I want to
> have a look at it but haven't found out where it is.
>
> Actually, I have some basic questions about interrupt handling in Linux.
> 1. After Kernel's ISR received an interrupt, I believe it will invoke a
>    handler defined in a device driver if any. But it should be the
>    device driver's responsibility or kernel ISR's responsibility to
>    clear (or acknowledge) the interrupt?
>
> 2. My device, an AX88796B network controller, asserting the interrupt
>    line in a level-triggered manner. Now I met problem with the device that
>    might caused by the CPU interrupt mode is not set as level-triggered by
>    edge trigger.  My CPU is Samsung S3C2410, an ARM920T powered one.  Does
>    anyone know usually where and how should I do this kind of setting?
>
>
> Thanks in advance.
>
> --
> woody
> I can't go back to yesterday - because I was a different person then.
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>



-- 
Shahbaz Khan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20121220/bbc8a3f0/attachment.html 

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

* How kernel handle interrupts
  2012-12-20 18:16 ` How kernel handle interrupts Shahbaz khan
@ 2012-12-21  0:37   ` Woody Wu
  0 siblings, 0 replies; 22+ messages in thread
From: Woody Wu @ 2012-12-21  0:37 UTC (permalink / raw)
  To: kernelnewbies

On Thu, Dec 20, 2012 at 07:16:34PM +0100, Shahbaz khan wrote:
> Hi Woody,
> 
> Check "do_IRQ()" in arch/x86/kernel/irq.c. It is responsible to handle
> device specific interrupts, while ipi and timer interrupts are dealt
> elsewhere.
> 

Thanks. Maybe you also know what's the name of the same function for
ARM, which is actual arch I am working on.

> Hope this helps.
> 
> BR,
> Shahbaz Khan
> 
> On Thu, Dec 20, 2012 at 3:27 PM, Woody Wu <narkewoody@gmail.com> wrote:
> 
> > Hi, List
> >
> > Where is the Kernel code that handles external interrupts? I want to
> > have a look at it but haven't found out where it is.
> >
> > Actually, I have some basic questions about interrupt handling in Linux.
> > 1. After Kernel's ISR received an interrupt, I believe it will invoke a
> >    handler defined in a device driver if any. But it should be the
> >    device driver's responsibility or kernel ISR's responsibility to
> >    clear (or acknowledge) the interrupt?
> >
> > 2. My device, an AX88796B network controller, asserting the interrupt
> >    line in a level-triggered manner. Now I met problem with the device that
> >    might caused by the CPU interrupt mode is not set as level-triggered by
> >    edge trigger.  My CPU is Samsung S3C2410, an ARM920T powered one.  Does
> >    anyone know usually where and how should I do this kind of setting?
> >
> >
> > Thanks in advance.
> >
> > --
> > woody
> > I can't go back to yesterday - because I was a different person then.
> >
> > _______________________________________________
> > Kernelnewbies mailing list
> > Kernelnewbies at kernelnewbies.org
> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >
> 
> 
> 
> -- 
> Shahbaz Khan

-- 
woody
I can't go back to yesterday - because I was a different person then.

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

* How kernel handle interrupts
  2012-12-20 18:05 ` anish singh
@ 2012-12-21  9:34   ` Woody Wu
  2012-12-21 10:53     ` anish kumar
  2012-12-21 15:34   ` Woody Wu
  1 sibling, 1 reply; 22+ messages in thread
From: Woody Wu @ 2012-12-21  9:34 UTC (permalink / raw)
  To: kernelnewbies

? 2012-12-21 AM2:05?"anish singh" <anish198519851985@gmail.com>???
>
>
> On Dec 20, 2012 6:30 AM, "Woody Wu" <narkewoody@gmail.com> wrote:
> >
> > Hi, List
> >
> > Where is the Kernel code that handles external interrupts? I want to
> > have a look at it but haven't found out where it is.
> >
> > Actually, I have some basic questions about interrupt handling in Linux.
> > 1. After Kernel's ISR received an interrupt, I believe it will invoke a
> >    handler defined in a device driver if any. But it should be the
> >    device driver's responsibility or kernel ISR's responsibility to
> >    clear (or acknowledge) the interrupt?
> If the interrupt in question is currently being handled then in
> the case of edge triggered interrupt we just mask the interrupt,set it
pending and bail out.Once the interrupt handler completes then we check for
pending interrupt and handle it.In level triggered we don't do that.
> Kerenel ISR -this is mixture of core kernel interrupt handling code +
your device driver interrupt handler(if this is chip driver which is
supposed to get one interrupt and is reponsible for calling other interrupt
handlers based on the chip register status then you do explicit masking
unmasking yourself).
> If you device driver is a interrupt controller driver then you register
your driver with kernel interrupt handling code and need to write some
callbacks such as .mask,.unmask and so on.This callbacks are called at
appropiate places whenever the interrupt is raised.This interrupt is then
passed to drivers who has requested for this interrupt by calling
request_irq.

Sorry not fully understand . My device is an Ethernet controller. It needs
to response TX and RX interrupts triggered by the device itself. In this
case , my driver is a chip driver or interrupt controller driver in your
terms?

If my driver needs to do the mask and unmask job, what's the kernel API I
should call?

And , I don't understand why there exists differences between level and
edge triggered interrupts in terms of kernel handling.

I know my questions might be basic , so would please tell me what's the
kernel code for ARM architecture doing these complex jobs as you explained?

Thanks in advance !

>
> >
> > 2. My device, an AX88796B network controller, asserting the interrupt
> >    line in a level-triggered manner. Now I met problem with the device
that
> >    might caused by the CPU interrupt mode is not set as level-triggered
by
> >    edge trigger.  My CPU is Samsung S3C2410, an ARM920T powered one.
 Does
> >    anyone know usually where and how should I do this kind of setting?
> Just pass the parameter "level triggered" in request_irq in your device
driver.
>
> >
> >
> > Thanks in advance.
> >
> > --
> > woody
> > I can't go back to yesterday - because I was a different person then.
> >
> > _______________________________________________
> > Kernelnewbies mailing list
> > Kernelnewbies at kernelnewbies.org
> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20121221/9c0e469a/attachment.html 

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

* How kernel handle interrupts
  2012-12-21  9:34   ` Woody Wu
@ 2012-12-21 10:53     ` anish kumar
  2012-12-21 12:43       ` Woody Wu
  0 siblings, 1 reply; 22+ messages in thread
From: anish kumar @ 2012-12-21 10:53 UTC (permalink / raw)
  To: kernelnewbies

On Fri, 2012-12-21 at 17:34 +0800, Woody Wu wrote:
> 
> ? 2012-12-21 AM2:05?"anish singh" <anish198519851985@gmail.com>?
> ??
> >
> >
> > On Dec 20, 2012 6:30 AM, "Woody Wu" <narkewoody@gmail.com> wrote:
> > >
> > > Hi, List
> > >
> > > Where is the Kernel code that handles external interrupts? I want
> to
> > > have a look at it but haven't found out where it is.
> > >
> > > Actually, I have some basic questions about interrupt handling in
> Linux.
> > > 1. After Kernel's ISR received an interrupt, I believe it will
> invoke a
> > >    handler defined in a device driver if any. But it should be the
> > >    device driver's responsibility or kernel ISR's responsibility
> to
> > >    clear (or acknowledge) the interrupt?
> > If the interrupt in question is currently being handled then in
> > the case of edge triggered interrupt we just mask the interrupt,set
> it pending and bail out.Once the interrupt handler completes then we
> check for pending interrupt and handle it.In level triggered we don't
> do that.
> > Kerenel ISR -this is mixture of core kernel interrupt handling code
> + your device driver interrupt handler(if this is chip driver which is
> supposed to get one interrupt and is reponsible for calling other
> interrupt handlers based on the chip register status then you do
> explicit masking unmasking yourself).
> > If you device driver is a interrupt controller driver then you
> register your driver with kernel interrupt handling code and need to
> write some callbacks such as .mask,.unmask and so on.This callbacks
> are called at appropiate places whenever the interrupt is raised.This
> interrupt is then passed to drivers who has requested for this
> interrupt by calling request_irq.
> 
> Sorry not fully understand . My device is an interrupt line is back to
> inactive.Ethernet controller. It needs to response TX and RX
> interrupts triggered by the device itself. In this case , my driver is
> a chip driver or interrupt controller driver in your terms?
Your device is neither of these.
> 
> If my driver needs to do the mask and unmask job, what's the kernel
> API I should call?
You don't need to worry about mask and unmask job AFAIK.
> 
> And , I don't understand why there exists differences between level
> and edge triggered interrupts in terms of kernel handling.
Level type interrupts are active as long as the hardware line has the
active level. This may require to mask the interrupt and unmask it after
the associated handler has acknowledged the device, so the interrupt
line is back to inactive.
Edge interrupt occurs on the falling and/or rising edge of a hardware
signal.The occurrence is latched into the irq controller hardware
and must be acked in order to be re-enabled.
Read the code /kerel/irq/chip.c(handle_edge_irq & handle_level_irq)
> 
> I know my questions might be basic , so would please tell me what's
If it was not basic then this question wouldn't be in kernelnewbies
right :)?
>  the kernel code for ARM architecture doing these complex jobs as you
> explained?
You don't need to worry about it but if you want to know further then I
suggest tracing the call flow from asm interrupt handler(I believe
do_irq but not sure) in arm to handle_edge_irq call flow by adding some
logs or just browsing the code.
> 
> Thanks in advance !
> 
> >
> > >
> > > 2. My device, an AX88796B network controller, asserting the
> interrupt
> > >    line in a level-triggered manner. Now I met problem with the
> device that
> > >    might caused by the CPU interrupt mode is not set as
> level-triggered by
> > >    edge trigger.  My CPU is Samsung S3C2410, an ARM920T powered
> one.  Does
> > >    anyone know usually where and how should I do this kind of
> setting?
> > Just pass the parameter "level triggered" in request_irq in your
> device driver.
> >
> > >
> > >
> > > Thanks in advance.
> > >
> > > --
> > > woody
> > > I can't go back to yesterday - because I was a different person
> then.
> > >
> > > _______________________________________________
> > > Kernelnewbies mailing list
> > > Kernelnewbies at kernelnewbies.org
> > > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> 
> 

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

* How kernel handle interrupts
  2012-12-21 10:53     ` anish kumar
@ 2012-12-21 12:43       ` Woody Wu
  0 siblings, 0 replies; 22+ messages in thread
From: Woody Wu @ 2012-12-21 12:43 UTC (permalink / raw)
  To: kernelnewbies

? 2012-12-21 PM6:53?"anish kumar" <anish198519851985@gmail.com>???
>
> On Fri, 2012-12-21 at 17:34 +0800, Woody Wu wrote:
> >
> > ? 2012-12-21 AM2:05?"anish singh" <anish198519851985@gmail.com>?
> > ??
> > >
> > >
> > > On Dec 20, 2012 6:30 AM, "Woody Wu" <narkewoody@gmail.com> wrote:
> > > >
> > > > Hi, List
> > > >
> > > > Where is the Kernel code that handles external interrupts? I want
> > to
> > > > have a look at it but haven't found out where it is.
> > > >
> > > > Actually, I have some basic questions about interrupt handling in
> > Linux.
> > > > 1. After Kernel's ISR received an interrupt, I believe it will
> > invoke a
> > > >    handler defined in a device driver if any. But it should be the
> > > >    device driver's responsibility or kernel ISR's responsibility
> > to
> > > >    clear (or acknowledge) the interrupt?
> > > If the interrupt in question is currently being handled then in
> > > the case of edge triggered interrupt we just mask the interrupt,set
> > it pending and bail out.Once the interrupt handler completes then we
> > check for pending interrupt and handle it.In level triggered we don't
> > do that.
> > > Kerenel ISR -this is mixture of core kernel interrupt handling code
> > + your device driver interrupt handler(if this is chip driver which is
> > supposed to get one interrupt and is reponsible for calling other
> > interrupt handlers based on the chip register status then you do
> > explicit masking unmasking yourself).
> > > If you device driver is a interrupt controller driver then you
> > register your driver with kernel interrupt handling code and need to
> > write some callbacks such as .mask,.unmask and so on.This callbacks
> > are called at appropiate places whenever the interrupt is raised.This
> > interrupt is then passed to drivers who has requested for this
> > interrupt by calling request_irq.
> >
> > Sorry not fully understand . My device is an interrupt line is back to
> > inactive.Ethernet controller. It needs to response TX and RX
> > interrupts triggered by the device itself. In this case , my driver is
> > a chip driver or interrupt controller driver in your terms?
> Your device is neither of these.
> >
> > If my driver needs to do the mask and unmask job, what's the kernel
> > API I should call?
> You don't need to worry about mask and unmask job AFAIK.
> >
> > And , I don't understand why there exists differences between level
> > and edge triggered interrupts in terms of kernel handling.
> Level type interrupts are active as long as the hardware line has the
> active level. This may require to mask the interrupt and unmask it after
> the associated handler has acknowledged the device, so the interrupt
> line is back to inactive.

This is a little confusing. You just said I don't need to worry mask and
unmask things. But now you say I need to for the level triggered
interrupts...  And, what's the mask and unmask APIs that I can call?

> Edge interrupt occurs on the falling and/or rising edge of a hardware
> signal.The occurrence is latched into the irq controller hardware
> and must be acked in order to be re-enabled.
> Read the code /kerel/irq/chip.c(handle_edge_irq & handle_level_irq)

Thanks for pointing me there.

> >
> > I know my questions might be basic , so would please tell me what's
> If it was not basic then this question wouldn't be in kernelnewbies
> right :)?
> >  the kernel code for ARM architecture doing these complex jobs as you
> > explained?
> You don't need to worry about it but if you want to know further then I
> suggest tracing the call flow from asm interrupt handler(I believe
> do_irq but not sure) in arm to handle_edge_irq call flow by adding some
> logs or just browsing the code.

Okay I will be reading the code. If you have time please also be kind to
help answer my previous questions in this message. Thanks a lot!

> >
> > Thanks in advance !
> >
> > >
> > > >
> > > > 2. My device, an AX88796B network controller, asserting the
> > interrupt
> > > >    line in a level-triggered manner. Now I met problem with the
> > device that
> > > >    might caused by the CPU interrupt mode is not set as
> > level-triggered by
> > > >    edge trigger.  My CPU is Samsung S3C2410, an ARM920T powered
> > one.  Does
> > > >    anyone know usually where and how should I do this kind of
> > setting?
> > > Just pass the parameter "level triggered" in request_irq in your
> > device driver.
> > >
> > > >
> > > >
> > > > Thanks in advance.
> > > >
> > > > --
> > > > woody
> > > > I can't go back to yesterday - because I was a different person
> > then.
> > > >
> > > > _______________________________________________
> > > > Kernelnewbies mailing list
> > > > Kernelnewbies at kernelnewbies.org
> > > > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20121221/c5f7089e/attachment-0001.html 

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

* How kernel handle interrupts
  2012-12-20 18:05 ` anish singh
  2012-12-21  9:34   ` Woody Wu
@ 2012-12-21 15:34   ` Woody Wu
  2012-12-21 21:33       ` anish kumar
  1 sibling, 1 reply; 22+ messages in thread
From: Woody Wu @ 2012-12-21 15:34 UTC (permalink / raw)
  To: kernelnewbies

On Thu, Dec 20, 2012 at 10:05:05AM -0800, anish singh wrote:
> On Dec 20, 2012 6:30 AM, "Woody Wu" <narkewoody@gmail.com> wrote:
> >
> > Hi, List
> >
> > Where is the Kernel code that handles external interrupts? I want to
> > have a look at it but haven't found out where it is.
> >
> > Actually, I have some basic questions about interrupt handling in Linux.
> > 1. After Kernel's ISR received an interrupt, I believe it will invoke a
> >    handler defined in a device driver if any. But it should be the
> >    device driver's responsibility or kernel ISR's responsibility to
> >    clear (or acknowledge) the interrupt?
> If the interrupt in question is currently being handled then in
> the case of edge triggered interrupt we just mask the interrupt,set it
> pending and bail out.Once the interrupt handler completes then we check for
> pending interrupt and handle it.In level triggered we don't do that.
> Kerenel ISR -this is mixture of core kernel interrupt handling code + your
> device driver interrupt handler(if this is chip driver which is supposed to
> get one interrupt and is reponsible for calling other interrupt handlers
> based on the chip register status then you do explicit masking unmasking
> yourself).
> If you device driver is a interrupt controller driver then you register
> your driver with kernel interrupt handling code and need to write some
> callbacks such as .mask,.unmask and so on.This callbacks are called at
> appropiate places whenever the interrupt is raised.This interrupt is then
> passed to drivers who has requested for this interrupt by calling
> request_irq.
> >
> > 2. My device, an AX88796B network controller, asserting the interrupt
> >    line in a level-triggered manner. Now I met problem with the device
> that
> >    might caused by the CPU interrupt mode is not set as level-triggered by
> >    edge trigger.  My CPU is Samsung S3C2410, an ARM920T powered one.  Does
> >    anyone know usually where and how should I do this kind of setting?
> Just pass the parameter "level triggered" in request_irq in your device
> driver.

Hi Sign,

I searched the interrupt.h for the all the defined flags that I can pass
to the request_irq, but there is no a flag looks like "level triggered".
Would you tell me what you mean the parameter "level triggered"?

Thanks.

> >
> >
> > Thanks in advance.
> >
> > --
> > woody
> > I can't go back to yesterday - because I was a different person then.
> >
> > _______________________________________________
> > Kernelnewbies mailing list
> > Kernelnewbies at kernelnewbies.org
> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

-- 
woody
I can't go back to yesterday - because I was a different person then.

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

* Re: How kernel handle interrupts[AX88796B network controller]
  2012-12-21 15:34   ` Woody Wu
@ 2012-12-21 21:33       ` anish kumar
  0 siblings, 0 replies; 22+ messages in thread
From: anish kumar @ 2012-12-21 21:33 UTC (permalink / raw)
  To: Woody Wu; +Cc: kernelnewbies, linux-kernel

On Fri, 2012-12-21 at 23:34 +0800, Woody Wu wrote:
> On Thu, Dec 20, 2012 at 10:05:05AM -0800, anish singh wrote:
> > On Dec 20, 2012 6:30 AM, "Woody Wu" <narkewoody@gmail.com> wrote:
> > >
> > > Hi, List
> > >
> > > Where is the Kernel code that handles external interrupts? I want to
> > > have a look at it but haven't found out where it is.
> > >
> > > Actually, I have some basic questions about interrupt handling in Linux.
> > > 1. After Kernel's ISR received an interrupt, I believe it will invoke a
> > >    handler defined in a device driver if any. But it should be the
> > >    device driver's responsibility or kernel ISR's responsibility to
> > >    clear (or acknowledge) the interrupt?
> > If the interrupt in question is currently being handled then in
> > the case of edge triggered interrupt we just mask the interrupt,set it
> > pending and bail out.Once the interrupt handler completes then we check for
> > pending interrupt and handle it.In level triggered we don't do that.
> > Kerenel ISR -this is mixture of core kernel interrupt handling code + your
> > device driver interrupt handler(if this is chip driver which is supposed to
> > get one interrupt and is reponsible for calling other interrupt handlers
> > based on the chip register status then you do explicit masking unmasking
> > yourself).
> > If you device driver is a interrupt controller driver then you register
> > your driver with kernel interrupt handling code and need to write some
> > callbacks such as .mask,.unmask and so on.This callbacks are called at
> > appropiate places whenever the interrupt is raised.This interrupt is then
> > passed to drivers who has requested for this interrupt by calling
> > request_irq.
> > >
> > > 2. My device, an AX88796B network controller, asserting the interrupt
> > >    line in a level-triggered manner. Now I met problem with the device
> > that
> > >    might caused by the CPU interrupt mode is not set as level-triggered by
> > >    edge trigger.  My CPU is Samsung S3C2410, an ARM920T powered one.  Does
> > >    anyone know usually where and how should I do this kind of setting?
> > Just pass the parameter "level triggered" in request_irq in your device
> > driver.
> 
> Hi Sign,
> 
> I searched the interrupt.h for the all the defined flags that I can pass
> to the request_irq, but there is no a flag looks like "level triggered".
> Would you tell me what you mean the parameter "level triggered"?
irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW)

include/linux/irq.h
IRQ_TYPE_LEVEL_HIGH          - high level triggered
IRQ_TYPE_LEVEL_LOW           - low level triggered
> 
> Thanks.
> 
> > >
> > >
> > > Thanks in advance.
> > >
> > > --
> > > woody
> > > I can't go back to yesterday - because I was a different person then.
> > >
> > > _______________________________________________
> > > Kernelnewbies mailing list
> > > Kernelnewbies@kernelnewbies.org
> > > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> 



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

* How kernel handle interrupts[AX88796B network controller]
@ 2012-12-21 21:33       ` anish kumar
  0 siblings, 0 replies; 22+ messages in thread
From: anish kumar @ 2012-12-21 21:33 UTC (permalink / raw)
  To: kernelnewbies

On Fri, 2012-12-21 at 23:34 +0800, Woody Wu wrote:
> On Thu, Dec 20, 2012 at 10:05:05AM -0800, anish singh wrote:
> > On Dec 20, 2012 6:30 AM, "Woody Wu" <narkewoody@gmail.com> wrote:
> > >
> > > Hi, List
> > >
> > > Where is the Kernel code that handles external interrupts? I want to
> > > have a look at it but haven't found out where it is.
> > >
> > > Actually, I have some basic questions about interrupt handling in Linux.
> > > 1. After Kernel's ISR received an interrupt, I believe it will invoke a
> > >    handler defined in a device driver if any. But it should be the
> > >    device driver's responsibility or kernel ISR's responsibility to
> > >    clear (or acknowledge) the interrupt?
> > If the interrupt in question is currently being handled then in
> > the case of edge triggered interrupt we just mask the interrupt,set it
> > pending and bail out.Once the interrupt handler completes then we check for
> > pending interrupt and handle it.In level triggered we don't do that.
> > Kerenel ISR -this is mixture of core kernel interrupt handling code + your
> > device driver interrupt handler(if this is chip driver which is supposed to
> > get one interrupt and is reponsible for calling other interrupt handlers
> > based on the chip register status then you do explicit masking unmasking
> > yourself).
> > If you device driver is a interrupt controller driver then you register
> > your driver with kernel interrupt handling code and need to write some
> > callbacks such as .mask,.unmask and so on.This callbacks are called at
> > appropiate places whenever the interrupt is raised.This interrupt is then
> > passed to drivers who has requested for this interrupt by calling
> > request_irq.
> > >
> > > 2. My device, an AX88796B network controller, asserting the interrupt
> > >    line in a level-triggered manner. Now I met problem with the device
> > that
> > >    might caused by the CPU interrupt mode is not set as level-triggered by
> > >    edge trigger.  My CPU is Samsung S3C2410, an ARM920T powered one.  Does
> > >    anyone know usually where and how should I do this kind of setting?
> > Just pass the parameter "level triggered" in request_irq in your device
> > driver.
> 
> Hi Sign,
> 
> I searched the interrupt.h for the all the defined flags that I can pass
> to the request_irq, but there is no a flag looks like "level triggered".
> Would you tell me what you mean the parameter "level triggered"?
irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW)

include/linux/irq.h
IRQ_TYPE_LEVEL_HIGH          - high level triggered
IRQ_TYPE_LEVEL_LOW           - low level triggered
> 
> Thanks.
> 
> > >
> > >
> > > Thanks in advance.
> > >
> > > --
> > > woody
> > > I can't go back to yesterday - because I was a different person then.
> > >
> > > _______________________________________________
> > > Kernelnewbies mailing list
> > > Kernelnewbies at kernelnewbies.org
> > > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> 

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

* Re: How kernel handle interrupts[AX88796B network controller]
  2012-12-21 21:33       ` anish kumar
@ 2012-12-22 15:11         ` Woody Wu
  -1 siblings, 0 replies; 22+ messages in thread
From: Woody Wu @ 2012-12-22 15:11 UTC (permalink / raw)
  To: anish kumar; +Cc: kernelnewbies, linux-kernel

On Fri, Dec 21, 2012 at 01:33:03PM -0800, anish kumar wrote:
> On Fri, 2012-12-21 at 23:34 +0800, Woody Wu wrote:
> > On Thu, Dec 20, 2012 at 10:05:05AM -0800, anish singh wrote:
> > > On Dec 20, 2012 6:30 AM, "Woody Wu" <narkewoody@gmail.com> wrote:
> > > >
> > > > Hi, List
> > > >
> > > > Where is the Kernel code that handles external interrupts? I want to
> > > > have a look at it but haven't found out where it is.
> > > >
> > > > Actually, I have some basic questions about interrupt handling in Linux.
> > > > 1. After Kernel's ISR received an interrupt, I believe it will invoke a
> > > >    handler defined in a device driver if any. But it should be the
> > > >    device driver's responsibility or kernel ISR's responsibility to
> > > >    clear (or acknowledge) the interrupt?
> > > If the interrupt in question is currently being handled then in
> > > the case of edge triggered interrupt we just mask the interrupt,set it
> > > pending and bail out.Once the interrupt handler completes then we check for
> > > pending interrupt and handle it.In level triggered we don't do that.
> > > Kerenel ISR -this is mixture of core kernel interrupt handling code + your
> > > device driver interrupt handler(if this is chip driver which is supposed to
> > > get one interrupt and is reponsible for calling other interrupt handlers
> > > based on the chip register status then you do explicit masking unmasking
> > > yourself).
> > > If you device driver is a interrupt controller driver then you register
> > > your driver with kernel interrupt handling code and need to write some
> > > callbacks such as .mask,.unmask and so on.This callbacks are called at
> > > appropiate places whenever the interrupt is raised.This interrupt is then
> > > passed to drivers who has requested for this interrupt by calling
> > > request_irq.
> > > >
> > > > 2. My device, an AX88796B network controller, asserting the interrupt
> > > >    line in a level-triggered manner. Now I met problem with the device
> > > that
> > > >    might caused by the CPU interrupt mode is not set as level-triggered by
> > > >    edge trigger.  My CPU is Samsung S3C2410, an ARM920T powered one.  Does
> > > >    anyone know usually where and how should I do this kind of setting?
> > > Just pass the parameter "level triggered" in request_irq in your device
> > > driver.
> > 
> > Hi Sign,
> > 
> > I searched the interrupt.h for the all the defined flags that I can pass
> > to the request_irq, but there is no a flag looks like "level triggered".
> > Would you tell me what you mean the parameter "level triggered"?
> irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW)
> 
> include/linux/irq.h
> IRQ_TYPE_LEVEL_HIGH          - high level triggered
> IRQ_TYPE_LEVEL_LOW           - low level triggered

Thanks. Now I find the function.

I searched some code about irq in ARM architecure.  Some other
people talked about do_IRQ() probabaly is wrong for ARM. There is simply
no that function in ARM. Maybe the do_IRQ in x86 is replaced by
handle_IRQ.

For the irq_set_irq_type(), do you think what's the correct place to
call it? Inside my device driver or outside the device driver (probably
in the board definition file)? If that should be called inside a device
driver, should it be the driver probe function or in the open function?
After or before the invocation of request_irq()?

Sorry for asking too many question.  I found the kernel + device driver
irq handling part still not clear to me.


> > 
> > Thanks.
> > 
> > > >
> > > >
> > > > Thanks in advance.
> > > >
> > > > --
> > > > woody
> > > > I can't go back to yesterday - because I was a different person then.
> > > >
> > > > _______________________________________________
> > > > Kernelnewbies mailing list
> > > > Kernelnewbies@kernelnewbies.org
> > > > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> > 
> 

-- 
woody
I can't go back to yesterday - because I was a different person then.

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

* How kernel handle interrupts[AX88796B network controller]
@ 2012-12-22 15:11         ` Woody Wu
  0 siblings, 0 replies; 22+ messages in thread
From: Woody Wu @ 2012-12-22 15:11 UTC (permalink / raw)
  To: kernelnewbies

On Fri, Dec 21, 2012 at 01:33:03PM -0800, anish kumar wrote:
> On Fri, 2012-12-21 at 23:34 +0800, Woody Wu wrote:
> > On Thu, Dec 20, 2012 at 10:05:05AM -0800, anish singh wrote:
> > > On Dec 20, 2012 6:30 AM, "Woody Wu" <narkewoody@gmail.com> wrote:
> > > >
> > > > Hi, List
> > > >
> > > > Where is the Kernel code that handles external interrupts? I want to
> > > > have a look at it but haven't found out where it is.
> > > >
> > > > Actually, I have some basic questions about interrupt handling in Linux.
> > > > 1. After Kernel's ISR received an interrupt, I believe it will invoke a
> > > >    handler defined in a device driver if any. But it should be the
> > > >    device driver's responsibility or kernel ISR's responsibility to
> > > >    clear (or acknowledge) the interrupt?
> > > If the interrupt in question is currently being handled then in
> > > the case of edge triggered interrupt we just mask the interrupt,set it
> > > pending and bail out.Once the interrupt handler completes then we check for
> > > pending interrupt and handle it.In level triggered we don't do that.
> > > Kerenel ISR -this is mixture of core kernel interrupt handling code + your
> > > device driver interrupt handler(if this is chip driver which is supposed to
> > > get one interrupt and is reponsible for calling other interrupt handlers
> > > based on the chip register status then you do explicit masking unmasking
> > > yourself).
> > > If you device driver is a interrupt controller driver then you register
> > > your driver with kernel interrupt handling code and need to write some
> > > callbacks such as .mask,.unmask and so on.This callbacks are called at
> > > appropiate places whenever the interrupt is raised.This interrupt is then
> > > passed to drivers who has requested for this interrupt by calling
> > > request_irq.
> > > >
> > > > 2. My device, an AX88796B network controller, asserting the interrupt
> > > >    line in a level-triggered manner. Now I met problem with the device
> > > that
> > > >    might caused by the CPU interrupt mode is not set as level-triggered by
> > > >    edge trigger.  My CPU is Samsung S3C2410, an ARM920T powered one.  Does
> > > >    anyone know usually where and how should I do this kind of setting?
> > > Just pass the parameter "level triggered" in request_irq in your device
> > > driver.
> > 
> > Hi Sign,
> > 
> > I searched the interrupt.h for the all the defined flags that I can pass
> > to the request_irq, but there is no a flag looks like "level triggered".
> > Would you tell me what you mean the parameter "level triggered"?
> irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW)
> 
> include/linux/irq.h
> IRQ_TYPE_LEVEL_HIGH          - high level triggered
> IRQ_TYPE_LEVEL_LOW           - low level triggered

Thanks. Now I find the function.

I searched some code about irq in ARM architecure.  Some other
people talked about do_IRQ() probabaly is wrong for ARM. There is simply
no that function in ARM. Maybe the do_IRQ in x86 is replaced by
handle_IRQ.

For the irq_set_irq_type(), do you think what's the correct place to
call it? Inside my device driver or outside the device driver (probably
in the board definition file)? If that should be called inside a device
driver, should it be the driver probe function or in the open function?
After or before the invocation of request_irq()?

Sorry for asking too many question.  I found the kernel + device driver
irq handling part still not clear to me.


> > 
> > Thanks.
> > 
> > > >
> > > >
> > > > Thanks in advance.
> > > >
> > > > --
> > > > woody
> > > > I can't go back to yesterday - because I was a different person then.
> > > >
> > > > _______________________________________________
> > > > Kernelnewbies mailing list
> > > > Kernelnewbies at kernelnewbies.org
> > > > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> > 
> 

-- 
woody
I can't go back to yesterday - because I was a different person then.

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

* Re: How kernel handle interrupts[AX88796B network controller]
  2012-12-21 21:33       ` anish kumar
@ 2012-12-24 14:10         ` Woody Wu
  -1 siblings, 0 replies; 22+ messages in thread
From: Woody Wu @ 2012-12-24 14:10 UTC (permalink / raw)
  To: anish kumar; +Cc: kernelnewbies, linux-kernel

On Fri, Dec 21, 2012 at 01:33:03PM -0800, anish kumar wrote:
> On Fri, 2012-12-21 at 23:34 +0800, Woody Wu wrote:
> > On Thu, Dec 20, 2012 at 10:05:05AM -0800, anish singh wrote:
> > > On Dec 20, 2012 6:30 AM, "Woody Wu" <narkewoody@gmail.com> wrote:
> > > >
> > > > Hi, List
> > > >
> > > > Where is the Kernel code that handles external interrupts? I want to
> > > > have a look at it but haven't found out where it is.
> > > >
> > > > Actually, I have some basic questions about interrupt handling in Linux.
> > > > 1. After Kernel's ISR received an interrupt, I believe it will invoke a
> > > >    handler defined in a device driver if any. But it should be the
> > > >    device driver's responsibility or kernel ISR's responsibility to
> > > >    clear (or acknowledge) the interrupt?
> > > If the interrupt in question is currently being handled then in
> > > the case of edge triggered interrupt we just mask the interrupt,set it
> > > pending and bail out.Once the interrupt handler completes then we check for
> > > pending interrupt and handle it.In level triggered we don't do that.
> > > Kerenel ISR -this is mixture of core kernel interrupt handling code + your
> > > device driver interrupt handler(if this is chip driver which is supposed to
> > > get one interrupt and is reponsible for calling other interrupt handlers
> > > based on the chip register status then you do explicit masking unmasking
> > > yourself).
> > > If you device driver is a interrupt controller driver then you register
> > > your driver with kernel interrupt handling code and need to write some
> > > callbacks such as .mask,.unmask and so on.This callbacks are called at
> > > appropiate places whenever the interrupt is raised.This interrupt is then
> > > passed to drivers who has requested for this interrupt by calling
> > > request_irq.
> > > >
> > > > 2. My device, an AX88796B network controller, asserting the interrupt
> > > >    line in a level-triggered manner. Now I met problem with the device
> > > that
> > > >    might caused by the CPU interrupt mode is not set as level-triggered by
> > > >    edge trigger.  My CPU is Samsung S3C2410, an ARM920T powered one.  Does
> > > >    anyone know usually where and how should I do this kind of setting?
> > > Just pass the parameter "level triggered" in request_irq in your device
> > > driver.
> > 
> > Hi Sign,
> > 
> > I searched the interrupt.h for the all the defined flags that I can pass
> > to the request_irq, but there is no a flag looks like "level triggered".
> > Would you tell me what you mean the parameter "level triggered"?
> irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW)
> 
> include/linux/irq.h
> IRQ_TYPE_LEVEL_HIGH          - high level triggered
> IRQ_TYPE_LEVEL_LOW           - low level triggered

Thanks. You saved my ass.

Be curious, I found the api changes from 2.6 to 3.7.  In 2.6, there are
pair of funtions, set_irq_type and set_irq_handle (there is no
irq_set_irq_type in 2.6).  Problem is, I cannot find something like
irq_set_irq_handle in 3.7.  Does that mean, in 3.7, when
irq_set_irq_type is changed, the associated flow handler is also
changed?  In my case, the interrupt was originally assgined with a edge
flow handler and set type as edge irq. After I, by invoking
irq_set_irq_type, change it to level irq, I think the flow handler
should also be changed to a level handle.  Is that happened
automatically behind?  I search through the code, but did not find where
is it.


> > 
> > Thanks.
> > 
> > > >
> > > >
> > > > Thanks in advance.
> > > >
> > > > --
> > > > woody
> > > > I can't go back to yesterday - because I was a different person then.
> > > >
> > > > _______________________________________________
> > > > Kernelnewbies mailing list
> > > > Kernelnewbies@kernelnewbies.org
> > > > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> > 
> 

-- 
woody
I can't go back to yesterday - because I was a different person then.

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

* How kernel handle interrupts[AX88796B network controller]
@ 2012-12-24 14:10         ` Woody Wu
  0 siblings, 0 replies; 22+ messages in thread
From: Woody Wu @ 2012-12-24 14:10 UTC (permalink / raw)
  To: kernelnewbies

On Fri, Dec 21, 2012 at 01:33:03PM -0800, anish kumar wrote:
> On Fri, 2012-12-21 at 23:34 +0800, Woody Wu wrote:
> > On Thu, Dec 20, 2012 at 10:05:05AM -0800, anish singh wrote:
> > > On Dec 20, 2012 6:30 AM, "Woody Wu" <narkewoody@gmail.com> wrote:
> > > >
> > > > Hi, List
> > > >
> > > > Where is the Kernel code that handles external interrupts? I want to
> > > > have a look at it but haven't found out where it is.
> > > >
> > > > Actually, I have some basic questions about interrupt handling in Linux.
> > > > 1. After Kernel's ISR received an interrupt, I believe it will invoke a
> > > >    handler defined in a device driver if any. But it should be the
> > > >    device driver's responsibility or kernel ISR's responsibility to
> > > >    clear (or acknowledge) the interrupt?
> > > If the interrupt in question is currently being handled then in
> > > the case of edge triggered interrupt we just mask the interrupt,set it
> > > pending and bail out.Once the interrupt handler completes then we check for
> > > pending interrupt and handle it.In level triggered we don't do that.
> > > Kerenel ISR -this is mixture of core kernel interrupt handling code + your
> > > device driver interrupt handler(if this is chip driver which is supposed to
> > > get one interrupt and is reponsible for calling other interrupt handlers
> > > based on the chip register status then you do explicit masking unmasking
> > > yourself).
> > > If you device driver is a interrupt controller driver then you register
> > > your driver with kernel interrupt handling code and need to write some
> > > callbacks such as .mask,.unmask and so on.This callbacks are called at
> > > appropiate places whenever the interrupt is raised.This interrupt is then
> > > passed to drivers who has requested for this interrupt by calling
> > > request_irq.
> > > >
> > > > 2. My device, an AX88796B network controller, asserting the interrupt
> > > >    line in a level-triggered manner. Now I met problem with the device
> > > that
> > > >    might caused by the CPU interrupt mode is not set as level-triggered by
> > > >    edge trigger.  My CPU is Samsung S3C2410, an ARM920T powered one.  Does
> > > >    anyone know usually where and how should I do this kind of setting?
> > > Just pass the parameter "level triggered" in request_irq in your device
> > > driver.
> > 
> > Hi Sign,
> > 
> > I searched the interrupt.h for the all the defined flags that I can pass
> > to the request_irq, but there is no a flag looks like "level triggered".
> > Would you tell me what you mean the parameter "level triggered"?
> irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW)
> 
> include/linux/irq.h
> IRQ_TYPE_LEVEL_HIGH          - high level triggered
> IRQ_TYPE_LEVEL_LOW           - low level triggered

Thanks. You saved my ass.

Be curious, I found the api changes from 2.6 to 3.7.  In 2.6, there are
pair of funtions, set_irq_type and set_irq_handle (there is no
irq_set_irq_type in 2.6).  Problem is, I cannot find something like
irq_set_irq_handle in 3.7.  Does that mean, in 3.7, when
irq_set_irq_type is changed, the associated flow handler is also
changed?  In my case, the interrupt was originally assgined with a edge
flow handler and set type as edge irq. After I, by invoking
irq_set_irq_type, change it to level irq, I think the flow handler
should also be changed to a level handle.  Is that happened
automatically behind?  I search through the code, but did not find where
is it.


> > 
> > Thanks.
> > 
> > > >
> > > >
> > > > Thanks in advance.
> > > >
> > > > --
> > > > woody
> > > > I can't go back to yesterday - because I was a different person then.
> > > >
> > > > _______________________________________________
> > > > Kernelnewbies mailing list
> > > > Kernelnewbies at kernelnewbies.org
> > > > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> > 
> 

-- 
woody
I can't go back to yesterday - because I was a different person then.

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

* Re: How kernel handle interrupts[AX88796B network controller]
  2012-12-24 14:10         ` Woody Wu
@ 2012-12-24 16:07           ` Woody Wu
  -1 siblings, 0 replies; 22+ messages in thread
From: Woody Wu @ 2012-12-24 16:07 UTC (permalink / raw)
  To: anish kumar; +Cc: kernelnewbies, linux-kernel

On Mon, Dec 24, 2012 at 10:10:17PM +0800, Woody Wu wrote:
> On Fri, Dec 21, 2012 at 01:33:03PM -0800, anish kumar wrote:
> > On Fri, 2012-12-21 at 23:34 +0800, Woody Wu wrote:
> > > On Thu, Dec 20, 2012 at 10:05:05AM -0800, anish singh wrote:
> > > > On Dec 20, 2012 6:30 AM, "Woody Wu" <narkewoody@gmail.com> wrote:
> > > > >
> > > > > Hi, List
> > > > >
> > > > > Where is the Kernel code that handles external interrupts? I want to
> > > > > have a look at it but haven't found out where it is.
> > > > >
> > > > > Actually, I have some basic questions about interrupt handling in Linux.
> > > > > 1. After Kernel's ISR received an interrupt, I believe it will invoke a
> > > > >    handler defined in a device driver if any. But it should be the
> > > > >    device driver's responsibility or kernel ISR's responsibility to
> > > > >    clear (or acknowledge) the interrupt?
> > > > If the interrupt in question is currently being handled then in
> > > > the case of edge triggered interrupt we just mask the interrupt,set it
> > > > pending and bail out.Once the interrupt handler completes then we check for
> > > > pending interrupt and handle it.In level triggered we don't do that.
> > > > Kerenel ISR -this is mixture of core kernel interrupt handling code + your
> > > > device driver interrupt handler(if this is chip driver which is supposed to
> > > > get one interrupt and is reponsible for calling other interrupt handlers
> > > > based on the chip register status then you do explicit masking unmasking
> > > > yourself).
> > > > If you device driver is a interrupt controller driver then you register
> > > > your driver with kernel interrupt handling code and need to write some
> > > > callbacks such as .mask,.unmask and so on.This callbacks are called at
> > > > appropiate places whenever the interrupt is raised.This interrupt is then
> > > > passed to drivers who has requested for this interrupt by calling
> > > > request_irq.
> > > > >
> > > > > 2. My device, an AX88796B network controller, asserting the interrupt
> > > > >    line in a level-triggered manner. Now I met problem with the device
> > > > that
> > > > >    might caused by the CPU interrupt mode is not set as level-triggered by
> > > > >    edge trigger.  My CPU is Samsung S3C2410, an ARM920T powered one.  Does
> > > > >    anyone know usually where and how should I do this kind of setting?
> > > > Just pass the parameter "level triggered" in request_irq in your device
> > > > driver.
> > > 
> > > Hi Sign,
> > > 
> > > I searched the interrupt.h for the all the defined flags that I can pass
> > > to the request_irq, but there is no a flag looks like "level triggered".
> > > Would you tell me what you mean the parameter "level triggered"?
> > irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW)
> > 
> > include/linux/irq.h
> > IRQ_TYPE_LEVEL_HIGH          - high level triggered
> > IRQ_TYPE_LEVEL_LOW           - low level triggered
> 
> Thanks. You saved my ass.
> 
> Be curious, I found the api changes from 2.6 to 3.7.  In 2.6, there are
> pair of funtions, set_irq_type and set_irq_handle (there is no
> irq_set_irq_type in 2.6).  Problem is, I cannot find something like
> irq_set_irq_handle in 3.7.  Does that mean, in 3.7, when
> irq_set_irq_type is changed, the associated flow handler is also
> changed?  In my case, the interrupt was originally assgined with a edge
> flow handler and set type as edge irq. After I, by invoking
> irq_set_irq_type, change it to level irq, I think the flow handler
> should also be changed to a level handle.  Is that happened
> automatically behind?  I search through the code, but did not find where
> is it.

Make it simple, is it necessary to also change the irq flow handler
after changed a irq type (from edge to level)? Is yes, what's the public
api that let user change flow handler for an irq?

Thanks in advance.

> 
> 
> > > 
> > > Thanks.
> > > 
> > > > >
> > > > >
> > > > > Thanks in advance.
> > > > >
> > > > > --
> > > > > woody
> > > > > I can't go back to yesterday - because I was a different person then.
> > > > >
> > > > > _______________________________________________
> > > > > Kernelnewbies mailing list
> > > > > Kernelnewbies@kernelnewbies.org
> > > > > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> > > 
> > 
> 
> -- 
> woody
> I can't go back to yesterday - because I was a different person then.

-- 
woody
I can't go back to yesterday - because I was a different person then.

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

* How kernel handle interrupts[AX88796B network controller]
@ 2012-12-24 16:07           ` Woody Wu
  0 siblings, 0 replies; 22+ messages in thread
From: Woody Wu @ 2012-12-24 16:07 UTC (permalink / raw)
  To: kernelnewbies

On Mon, Dec 24, 2012 at 10:10:17PM +0800, Woody Wu wrote:
> On Fri, Dec 21, 2012 at 01:33:03PM -0800, anish kumar wrote:
> > On Fri, 2012-12-21 at 23:34 +0800, Woody Wu wrote:
> > > On Thu, Dec 20, 2012 at 10:05:05AM -0800, anish singh wrote:
> > > > On Dec 20, 2012 6:30 AM, "Woody Wu" <narkewoody@gmail.com> wrote:
> > > > >
> > > > > Hi, List
> > > > >
> > > > > Where is the Kernel code that handles external interrupts? I want to
> > > > > have a look at it but haven't found out where it is.
> > > > >
> > > > > Actually, I have some basic questions about interrupt handling in Linux.
> > > > > 1. After Kernel's ISR received an interrupt, I believe it will invoke a
> > > > >    handler defined in a device driver if any. But it should be the
> > > > >    device driver's responsibility or kernel ISR's responsibility to
> > > > >    clear (or acknowledge) the interrupt?
> > > > If the interrupt in question is currently being handled then in
> > > > the case of edge triggered interrupt we just mask the interrupt,set it
> > > > pending and bail out.Once the interrupt handler completes then we check for
> > > > pending interrupt and handle it.In level triggered we don't do that.
> > > > Kerenel ISR -this is mixture of core kernel interrupt handling code + your
> > > > device driver interrupt handler(if this is chip driver which is supposed to
> > > > get one interrupt and is reponsible for calling other interrupt handlers
> > > > based on the chip register status then you do explicit masking unmasking
> > > > yourself).
> > > > If you device driver is a interrupt controller driver then you register
> > > > your driver with kernel interrupt handling code and need to write some
> > > > callbacks such as .mask,.unmask and so on.This callbacks are called at
> > > > appropiate places whenever the interrupt is raised.This interrupt is then
> > > > passed to drivers who has requested for this interrupt by calling
> > > > request_irq.
> > > > >
> > > > > 2. My device, an AX88796B network controller, asserting the interrupt
> > > > >    line in a level-triggered manner. Now I met problem with the device
> > > > that
> > > > >    might caused by the CPU interrupt mode is not set as level-triggered by
> > > > >    edge trigger.  My CPU is Samsung S3C2410, an ARM920T powered one.  Does
> > > > >    anyone know usually where and how should I do this kind of setting?
> > > > Just pass the parameter "level triggered" in request_irq in your device
> > > > driver.
> > > 
> > > Hi Sign,
> > > 
> > > I searched the interrupt.h for the all the defined flags that I can pass
> > > to the request_irq, but there is no a flag looks like "level triggered".
> > > Would you tell me what you mean the parameter "level triggered"?
> > irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW)
> > 
> > include/linux/irq.h
> > IRQ_TYPE_LEVEL_HIGH          - high level triggered
> > IRQ_TYPE_LEVEL_LOW           - low level triggered
> 
> Thanks. You saved my ass.
> 
> Be curious, I found the api changes from 2.6 to 3.7.  In 2.6, there are
> pair of funtions, set_irq_type and set_irq_handle (there is no
> irq_set_irq_type in 2.6).  Problem is, I cannot find something like
> irq_set_irq_handle in 3.7.  Does that mean, in 3.7, when
> irq_set_irq_type is changed, the associated flow handler is also
> changed?  In my case, the interrupt was originally assgined with a edge
> flow handler and set type as edge irq. After I, by invoking
> irq_set_irq_type, change it to level irq, I think the flow handler
> should also be changed to a level handle.  Is that happened
> automatically behind?  I search through the code, but did not find where
> is it.

Make it simple, is it necessary to also change the irq flow handler
after changed a irq type (from edge to level)? Is yes, what's the public
api that let user change flow handler for an irq?

Thanks in advance.

> 
> 
> > > 
> > > Thanks.
> > > 
> > > > >
> > > > >
> > > > > Thanks in advance.
> > > > >
> > > > > --
> > > > > woody
> > > > > I can't go back to yesterday - because I was a different person then.
> > > > >
> > > > > _______________________________________________
> > > > > Kernelnewbies mailing list
> > > > > Kernelnewbies at kernelnewbies.org
> > > > > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> > > 
> > 
> 
> -- 
> woody
> I can't go back to yesterday - because I was a different person then.

-- 
woody
I can't go back to yesterday - because I was a different person then.

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

* Re: How kernel handle interrupts[AX88796B network controller]
  2012-12-24 14:10         ` Woody Wu
@ 2013-01-07 16:22           ` anish kumar
  -1 siblings, 0 replies; 22+ messages in thread
From: anish kumar @ 2013-01-07 16:22 UTC (permalink / raw)
  To: Woody Wu; +Cc: kernelnewbies, linux-kernel

On Mon, 2012-12-24 at 22:10 +0800, Woody Wu wrote:
> On Fri, Dec 21, 2012 at 01:33:03PM -0800, anish kumar wrote:
> > On Fri, 2012-12-21 at 23:34 +0800, Woody Wu wrote:
> > > On Thu, Dec 20, 2012 at 10:05:05AM -0800, anish singh wrote:
> > > > On Dec 20, 2012 6:30 AM, "Woody Wu" <narkewoody@gmail.com> wrote:
> > > > >
> > > > > Hi, List
> > > > >
> > > > > Where is the Kernel code that handles external interrupts? I want to
> > > > > have a look at it but haven't found out where it is.
> > > > >
> > > > > Actually, I have some basic questions about interrupt handling in Linux.
> > > > > 1. After Kernel's ISR received an interrupt, I believe it will invoke a
> > > > >    handler defined in a device driver if any. But it should be the
> > > > >    device driver's responsibility or kernel ISR's responsibility to
> > > > >    clear (or acknowledge) the interrupt?
> > > > If the interrupt in question is currently being handled then in
> > > > the case of edge triggered interrupt we just mask the interrupt,set it
> > > > pending and bail out.Once the interrupt handler completes then we check for
> > > > pending interrupt and handle it.In level triggered we don't do that.
> > > > Kerenel ISR -this is mixture of core kernel interrupt handling code + your
> > > > device driver interrupt handler(if this is chip driver which is supposed to
> > > > get one interrupt and is reponsible for calling other interrupt handlers
> > > > based on the chip register status then you do explicit masking unmasking
> > > > yourself).
> > > > If you device driver is a interrupt controller driver then you register
> > > > your driver with kernel interrupt handling code and need to write some
> > > > callbacks such as .mask,.unmask and so on.This callbacks are called at
> > > > appropiate places whenever the interrupt is raised.This interrupt is then
> > > > passed to drivers who has requested for this interrupt by calling
> > > > request_irq.
> > > > >
> > > > > 2. My device, an AX88796B network controller, asserting the interrupt
> > > > >    line in a level-triggered manner. Now I met problem with the device
> > > > that
> > > > >    might caused by the CPU interrupt mode is not set as level-triggered by
> > > > >    edge trigger.  My CPU is Samsung S3C2410, an ARM920T powered one.  Does
> > > > >    anyone know usually where and how should I do this kind of setting?
> > > > Just pass the parameter "level triggered" in request_irq in your device
> > > > driver.
> > > 
> > > Hi Sign,
> > > 
> > > I searched the interrupt.h for the all the defined flags that I can pass
> > > to the request_irq, but there is no a flag looks like "level triggered".
> > > Would you tell me what you mean the parameter "level triggered"?
> > irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW)
> > 
> > include/linux/irq.h
> > IRQ_TYPE_LEVEL_HIGH          - high level triggered
> > IRQ_TYPE_LEVEL_LOW           - low level triggered
> 
> Thanks. You saved my ass.
> 
> Be curious, I found the api changes from 2.6 to 3.7.  In 2.6, there are
> pair of funtions, set_irq_type and set_irq_handle (there is no
> irq_set_irq_type in 2.6).  Problem is, I cannot find something like
> irq_set_irq_handle in 3.7.  Does that mean, in 3.7, when
> irq_set_irq_type is changed, the associated flow handler is also
> changed?  In my case, the interrupt was originally assgined with a edge
> flow handler and set type as edge irq. After I, by invoking
> irq_set_irq_type, change it to level irq, I think the flow handler
> should also be changed to a level handle.  Is that happened
> automatically behind?  I search through the code, but did not find where
> is it.
Why not try calling irq_set_irq_type and check what happens?
> 
> 
> > > 
> > > Thanks.
> > > 
> > > > >
> > > > >
> > > > > Thanks in advance.
> > > > >
> > > > > --
> > > > > woody
> > > > > I can't go back to yesterday - because I was a different person then.
> > > > >
> > > > > _______________________________________________
> > > > > Kernelnewbies mailing list
> > > > > Kernelnewbies@kernelnewbies.org
> > > > > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> > > 
> > 
> 



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

* How kernel handle interrupts[AX88796B network controller]
@ 2013-01-07 16:22           ` anish kumar
  0 siblings, 0 replies; 22+ messages in thread
From: anish kumar @ 2013-01-07 16:22 UTC (permalink / raw)
  To: kernelnewbies

On Mon, 2012-12-24 at 22:10 +0800, Woody Wu wrote:
> On Fri, Dec 21, 2012 at 01:33:03PM -0800, anish kumar wrote:
> > On Fri, 2012-12-21 at 23:34 +0800, Woody Wu wrote:
> > > On Thu, Dec 20, 2012 at 10:05:05AM -0800, anish singh wrote:
> > > > On Dec 20, 2012 6:30 AM, "Woody Wu" <narkewoody@gmail.com> wrote:
> > > > >
> > > > > Hi, List
> > > > >
> > > > > Where is the Kernel code that handles external interrupts? I want to
> > > > > have a look at it but haven't found out where it is.
> > > > >
> > > > > Actually, I have some basic questions about interrupt handling in Linux.
> > > > > 1. After Kernel's ISR received an interrupt, I believe it will invoke a
> > > > >    handler defined in a device driver if any. But it should be the
> > > > >    device driver's responsibility or kernel ISR's responsibility to
> > > > >    clear (or acknowledge) the interrupt?
> > > > If the interrupt in question is currently being handled then in
> > > > the case of edge triggered interrupt we just mask the interrupt,set it
> > > > pending and bail out.Once the interrupt handler completes then we check for
> > > > pending interrupt and handle it.In level triggered we don't do that.
> > > > Kerenel ISR -this is mixture of core kernel interrupt handling code + your
> > > > device driver interrupt handler(if this is chip driver which is supposed to
> > > > get one interrupt and is reponsible for calling other interrupt handlers
> > > > based on the chip register status then you do explicit masking unmasking
> > > > yourself).
> > > > If you device driver is a interrupt controller driver then you register
> > > > your driver with kernel interrupt handling code and need to write some
> > > > callbacks such as .mask,.unmask and so on.This callbacks are called at
> > > > appropiate places whenever the interrupt is raised.This interrupt is then
> > > > passed to drivers who has requested for this interrupt by calling
> > > > request_irq.
> > > > >
> > > > > 2. My device, an AX88796B network controller, asserting the interrupt
> > > > >    line in a level-triggered manner. Now I met problem with the device
> > > > that
> > > > >    might caused by the CPU interrupt mode is not set as level-triggered by
> > > > >    edge trigger.  My CPU is Samsung S3C2410, an ARM920T powered one.  Does
> > > > >    anyone know usually where and how should I do this kind of setting?
> > > > Just pass the parameter "level triggered" in request_irq in your device
> > > > driver.
> > > 
> > > Hi Sign,
> > > 
> > > I searched the interrupt.h for the all the defined flags that I can pass
> > > to the request_irq, but there is no a flag looks like "level triggered".
> > > Would you tell me what you mean the parameter "level triggered"?
> > irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW)
> > 
> > include/linux/irq.h
> > IRQ_TYPE_LEVEL_HIGH          - high level triggered
> > IRQ_TYPE_LEVEL_LOW           - low level triggered
> 
> Thanks. You saved my ass.
> 
> Be curious, I found the api changes from 2.6 to 3.7.  In 2.6, there are
> pair of funtions, set_irq_type and set_irq_handle (there is no
> irq_set_irq_type in 2.6).  Problem is, I cannot find something like
> irq_set_irq_handle in 3.7.  Does that mean, in 3.7, when
> irq_set_irq_type is changed, the associated flow handler is also
> changed?  In my case, the interrupt was originally assgined with a edge
> flow handler and set type as edge irq. After I, by invoking
> irq_set_irq_type, change it to level irq, I think the flow handler
> should also be changed to a level handle.  Is that happened
> automatically behind?  I search through the code, but did not find where
> is it.
Why not try calling irq_set_irq_type and check what happens?
> 
> 
> > > 
> > > Thanks.
> > > 
> > > > >
> > > > >
> > > > > Thanks in advance.
> > > > >
> > > > > --
> > > > > woody
> > > > > I can't go back to yesterday - because I was a different person then.
> > > > >
> > > > > _______________________________________________
> > > > > Kernelnewbies mailing list
> > > > > Kernelnewbies at kernelnewbies.org
> > > > > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> > > 
> > 
> 

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

* Re: How kernel handle interrupts[AX88796B network controller]
  2012-12-22 15:11         ` Woody Wu
@ 2013-01-07 16:36           ` anish kumar
  -1 siblings, 0 replies; 22+ messages in thread
From: anish kumar @ 2013-01-07 16:36 UTC (permalink / raw)
  To: Woody Wu; +Cc: kernelnewbies, linux-kernel

On Sat, 2012-12-22 at 23:11 +0800, Woody Wu wrote:
> On Fri, Dec 21, 2012 at 01:33:03PM -0800, anish kumar wrote:
> > On Fri, 2012-12-21 at 23:34 +0800, Woody Wu wrote:
> > > On Thu, Dec 20, 2012 at 10:05:05AM -0800, anish singh wrote:
> > > > On Dec 20, 2012 6:30 AM, "Woody Wu" <narkewoody@gmail.com> wrote:
> > > > >
> > > > > Hi, List
> > > > >
> > > > > Where is the Kernel code that handles external interrupts? I want to
> > > > > have a look at it but haven't found out where it is.
> > > > >
> > > > > Actually, I have some basic questions about interrupt handling in Linux.
> > > > > 1. After Kernel's ISR received an interrupt, I believe it will invoke a
> > > > >    handler defined in a device driver if any. But it should be the
> > > > >    device driver's responsibility or kernel ISR's responsibility to
> > > > >    clear (or acknowledge) the interrupt?
> > > > If the interrupt in question is currently being handled then in
> > > > the case of edge triggered interrupt we just mask the interrupt,set it
> > > > pending and bail out.Once the interrupt handler completes then we check for
> > > > pending interrupt and handle it.In level triggered we don't do that.
> > > > Kerenel ISR -this is mixture of core kernel interrupt handling code + your
> > > > device driver interrupt handler(if this is chip driver which is supposed to
> > > > get one interrupt and is reponsible for calling other interrupt handlers
> > > > based on the chip register status then you do explicit masking unmasking
> > > > yourself).
> > > > If you device driver is a interrupt controller driver then you register
> > > > your driver with kernel interrupt handling code and need to write some
> > > > callbacks such as .mask,.unmask and so on.This callbacks are called at
> > > > appropiate places whenever the interrupt is raised.This interrupt is then
> > > > passed to drivers who has requested for this interrupt by calling
> > > > request_irq.
> > > > >
> > > > > 2. My device, an AX88796B network controller, asserting the interrupt
> > > > >    line in a level-triggered manner. Now I met problem with the device
> > > > that
> > > > >    might caused by the CPU interrupt mode is not set as level-triggered by
> > > > >    edge trigger.  My CPU is Samsung S3C2410, an ARM920T powered one.  Does
> > > > >    anyone know usually where and how should I do this kind of setting?
> > > > Just pass the parameter "level triggered" in request_irq in your device
> > > > driver.
> > > 
> > > Hi Sign,
> > > 
> > > I searched the interrupt.h for the all the defined flags that I can pass
> > > to the request_irq, but there is no a flag looks like "level triggered".
> > > Would you tell me what you mean the parameter "level triggered"?
> > irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW)
> > 
> > include/linux/irq.h
> > IRQ_TYPE_LEVEL_HIGH          - high level triggered
> > IRQ_TYPE_LEVEL_LOW           - low level triggered
> 
> Thanks. Now I find the function.
> 
> I searched some code about irq in ARM architecure.  Some other
> people talked about do_IRQ() probabaly is wrong for ARM. There is simply
> no that function in ARM. Maybe the do_IRQ in x86 is replaced by
> handle_IRQ.
arch/arm/kernel/entry-armv.S
__irq_svc is called by the arm processor which in turn calls irq_handler
macro.I think this is the lowest level handler after which linux
interrupt handling takes over.
> 
> For the irq_set_irq_type(), do you think what's the correct place to
> call it? Inside my device driver or outside the device driver (probably
> in the board definition file)? If that should be called inside a device
> driver, should it be the driver probe function or in the open function?
> After or before the invocation of request_irq()?
irq_set_irq_type() should be called by device driver code not by the
board file.It should be called in the probe function AFAIK.
> 
> Sorry for asking too many question.  I found the kernel + device driver
> irq handling part still not clear to me.
You are welcome to ask as many question as you want.
> 
> 
> > > 
> > > Thanks.
> > > 
> > > > >
> > > > >
> > > > > Thanks in advance.
> > > > >
> > > > > --
> > > > > woody
> > > > > I can't go back to yesterday - because I was a different person then.
> > > > >
> > > > > _______________________________________________
> > > > > Kernelnewbies mailing list
> > > > > Kernelnewbies@kernelnewbies.org
> > > > > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> > > 
> > 
> 



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

* How kernel handle interrupts[AX88796B network controller]
@ 2013-01-07 16:36           ` anish kumar
  0 siblings, 0 replies; 22+ messages in thread
From: anish kumar @ 2013-01-07 16:36 UTC (permalink / raw)
  To: kernelnewbies

On Sat, 2012-12-22 at 23:11 +0800, Woody Wu wrote:
> On Fri, Dec 21, 2012 at 01:33:03PM -0800, anish kumar wrote:
> > On Fri, 2012-12-21 at 23:34 +0800, Woody Wu wrote:
> > > On Thu, Dec 20, 2012 at 10:05:05AM -0800, anish singh wrote:
> > > > On Dec 20, 2012 6:30 AM, "Woody Wu" <narkewoody@gmail.com> wrote:
> > > > >
> > > > > Hi, List
> > > > >
> > > > > Where is the Kernel code that handles external interrupts? I want to
> > > > > have a look at it but haven't found out where it is.
> > > > >
> > > > > Actually, I have some basic questions about interrupt handling in Linux.
> > > > > 1. After Kernel's ISR received an interrupt, I believe it will invoke a
> > > > >    handler defined in a device driver if any. But it should be the
> > > > >    device driver's responsibility or kernel ISR's responsibility to
> > > > >    clear (or acknowledge) the interrupt?
> > > > If the interrupt in question is currently being handled then in
> > > > the case of edge triggered interrupt we just mask the interrupt,set it
> > > > pending and bail out.Once the interrupt handler completes then we check for
> > > > pending interrupt and handle it.In level triggered we don't do that.
> > > > Kerenel ISR -this is mixture of core kernel interrupt handling code + your
> > > > device driver interrupt handler(if this is chip driver which is supposed to
> > > > get one interrupt and is reponsible for calling other interrupt handlers
> > > > based on the chip register status then you do explicit masking unmasking
> > > > yourself).
> > > > If you device driver is a interrupt controller driver then you register
> > > > your driver with kernel interrupt handling code and need to write some
> > > > callbacks such as .mask,.unmask and so on.This callbacks are called at
> > > > appropiate places whenever the interrupt is raised.This interrupt is then
> > > > passed to drivers who has requested for this interrupt by calling
> > > > request_irq.
> > > > >
> > > > > 2. My device, an AX88796B network controller, asserting the interrupt
> > > > >    line in a level-triggered manner. Now I met problem with the device
> > > > that
> > > > >    might caused by the CPU interrupt mode is not set as level-triggered by
> > > > >    edge trigger.  My CPU is Samsung S3C2410, an ARM920T powered one.  Does
> > > > >    anyone know usually where and how should I do this kind of setting?
> > > > Just pass the parameter "level triggered" in request_irq in your device
> > > > driver.
> > > 
> > > Hi Sign,
> > > 
> > > I searched the interrupt.h for the all the defined flags that I can pass
> > > to the request_irq, but there is no a flag looks like "level triggered".
> > > Would you tell me what you mean the parameter "level triggered"?
> > irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW)
> > 
> > include/linux/irq.h
> > IRQ_TYPE_LEVEL_HIGH          - high level triggered
> > IRQ_TYPE_LEVEL_LOW           - low level triggered
> 
> Thanks. Now I find the function.
> 
> I searched some code about irq in ARM architecure.  Some other
> people talked about do_IRQ() probabaly is wrong for ARM. There is simply
> no that function in ARM. Maybe the do_IRQ in x86 is replaced by
> handle_IRQ.
arch/arm/kernel/entry-armv.S
__irq_svc is called by the arm processor which in turn calls irq_handler
macro.I think this is the lowest level handler after which linux
interrupt handling takes over.
> 
> For the irq_set_irq_type(), do you think what's the correct place to
> call it? Inside my device driver or outside the device driver (probably
> in the board definition file)? If that should be called inside a device
> driver, should it be the driver probe function or in the open function?
> After or before the invocation of request_irq()?
irq_set_irq_type() should be called by device driver code not by the
board file.It should be called in the probe function AFAIK.
> 
> Sorry for asking too many question.  I found the kernel + device driver
> irq handling part still not clear to me.
You are welcome to ask as many question as you want.
> 
> 
> > > 
> > > Thanks.
> > > 
> > > > >
> > > > >
> > > > > Thanks in advance.
> > > > >
> > > > > --
> > > > > woody
> > > > > I can't go back to yesterday - because I was a different person then.
> > > > >
> > > > > _______________________________________________
> > > > > Kernelnewbies mailing list
> > > > > Kernelnewbies at kernelnewbies.org
> > > > > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> > > 
> > 
> 

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

* Re: How kernel handle interrupts[AX88796B network controller]
  2013-01-07 16:36           ` anish kumar
@ 2013-08-05  3:01             ` Woody Wu
  -1 siblings, 0 replies; 22+ messages in thread
From: Woody Wu @ 2013-08-05  3:01 UTC (permalink / raw)
  To: anish kumar; +Cc: kernelnewbies, linux-kernel

On Mon, Jan 07, 2013 at 10:06:30PM +0530, anish kumar wrote:
> On Sat, 2012-12-22 at 23:11 +0800, Woody Wu wrote:
> > On Fri, Dec 21, 2012 at 01:33:03PM -0800, anish kumar wrote:
> > > On Fri, 2012-12-21 at 23:34 +0800, Woody Wu wrote:
> > > > On Thu, Dec 20, 2012 at 10:05:05AM -0800, anish singh wrote:
> > > > > On Dec 20, 2012 6:30 AM, "Woody Wu" <narkewoody@gmail.com> wrote:
> > > > > >
> > > > > > Hi, List
> > > > > >
> > > > > > Where is the Kernel code that handles external interrupts? I want to
> > > > > > have a look at it but haven't found out where it is.
> > > > > >
> > > > > > Actually, I have some basic questions about interrupt handling in Linux.
> > > > > > 1. After Kernel's ISR received an interrupt, I believe it will invoke a
> > > > > >    handler defined in a device driver if any. But it should be the
> > > > > >    device driver's responsibility or kernel ISR's responsibility to
> > > > > >    clear (or acknowledge) the interrupt?
> > > > > If the interrupt in question is currently being handled then in
> > > > > the case of edge triggered interrupt we just mask the interrupt,set it
> > > > > pending and bail out.Once the interrupt handler completes then we check for
> > > > > pending interrupt and handle it.In level triggered we don't do that.
> > > > > Kerenel ISR -this is mixture of core kernel interrupt handling code + your
> > > > > device driver interrupt handler(if this is chip driver which is supposed to
> > > > > get one interrupt and is reponsible for calling other interrupt handlers
> > > > > based on the chip register status then you do explicit masking unmasking
> > > > > yourself).
> > > > > If you device driver is a interrupt controller driver then you register
> > > > > your driver with kernel interrupt handling code and need to write some
> > > > > callbacks such as .mask,.unmask and so on.This callbacks are called at
> > > > > appropiate places whenever the interrupt is raised.This interrupt is then
> > > > > passed to drivers who has requested for this interrupt by calling
> > > > > request_irq.
> > > > > >
> > > > > > 2. My device, an AX88796B network controller, asserting the interrupt
> > > > > >    line in a level-triggered manner. Now I met problem with the device
> > > > > that
> > > > > >    might caused by the CPU interrupt mode is not set as level-triggered by
> > > > > >    edge trigger.  My CPU is Samsung S3C2410, an ARM920T powered one.  Does
> > > > > >    anyone know usually where and how should I do this kind of setting?
> > > > > Just pass the parameter "level triggered" in request_irq in your device
> > > > > driver.
> > > > 
> > > > Hi Sign,
> > > > 
> > > > I searched the interrupt.h for the all the defined flags that I can pass
> > > > to the request_irq, but there is no a flag looks like "level triggered".
> > > > Would you tell me what you mean the parameter "level triggered"?
> > > irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW)
> > > 
> > > include/linux/irq.h
> > > IRQ_TYPE_LEVEL_HIGH          - high level triggered
> > > IRQ_TYPE_LEVEL_LOW           - low level triggered
> > 
> > Thanks. Now I find the function.
> > 
> > I searched some code about irq in ARM architecure.  Some other
> > people talked about do_IRQ() probabaly is wrong for ARM. There is simply
> > no that function in ARM. Maybe the do_IRQ in x86 is replaced by
> > handle_IRQ.
> arch/arm/kernel/entry-armv.S
> __irq_svc is called by the arm processor which in turn calls irq_handler
> macro.I think this is the lowest level handler after which linux
> interrupt handling takes over.
Only today, I saw this email you replied. Many thanks!

> > 
> > For the irq_set_irq_type(), do you think what's the correct place to
> > call it? Inside my device driver or outside the device driver (probably
> > in the board definition file)? If that should be called inside a device
> > driver, should it be the driver probe function or in the open function?
> > After or before the invocation of request_irq()?
> irq_set_irq_type() should be called by device driver code not by the
> board file.It should be called in the probe function AFAIK.
> > 
> > Sorry for asking too many question.  I found the kernel + device driver
> > irq handling part still not clear to me.
> You are welcome to ask as many question as you want.
> > 
> > 
> > > > 
> > > > Thanks.
> > > > 
> > > > > >
> > > > > >
> > > > > > Thanks in advance.
> > > > > >
> > > > > > --
> > > > > > woody
> > > > > > I can't go back to yesterday - because I was a different person then.
> > > > > >
> > > > > > _______________________________________________
> > > > > > Kernelnewbies mailing list
> > > > > > Kernelnewbies@kernelnewbies.org
> > > > > > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> > > > 
> > > 
> > 
> 

-- 
I can't go back to yesterday - because I was a different person then

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

* How kernel handle interrupts[AX88796B network controller]
@ 2013-08-05  3:01             ` Woody Wu
  0 siblings, 0 replies; 22+ messages in thread
From: Woody Wu @ 2013-08-05  3:01 UTC (permalink / raw)
  To: kernelnewbies

On Mon, Jan 07, 2013 at 10:06:30PM +0530, anish kumar wrote:
> On Sat, 2012-12-22 at 23:11 +0800, Woody Wu wrote:
> > On Fri, Dec 21, 2012 at 01:33:03PM -0800, anish kumar wrote:
> > > On Fri, 2012-12-21 at 23:34 +0800, Woody Wu wrote:
> > > > On Thu, Dec 20, 2012 at 10:05:05AM -0800, anish singh wrote:
> > > > > On Dec 20, 2012 6:30 AM, "Woody Wu" <narkewoody@gmail.com> wrote:
> > > > > >
> > > > > > Hi, List
> > > > > >
> > > > > > Where is the Kernel code that handles external interrupts? I want to
> > > > > > have a look at it but haven't found out where it is.
> > > > > >
> > > > > > Actually, I have some basic questions about interrupt handling in Linux.
> > > > > > 1. After Kernel's ISR received an interrupt, I believe it will invoke a
> > > > > >    handler defined in a device driver if any. But it should be the
> > > > > >    device driver's responsibility or kernel ISR's responsibility to
> > > > > >    clear (or acknowledge) the interrupt?
> > > > > If the interrupt in question is currently being handled then in
> > > > > the case of edge triggered interrupt we just mask the interrupt,set it
> > > > > pending and bail out.Once the interrupt handler completes then we check for
> > > > > pending interrupt and handle it.In level triggered we don't do that.
> > > > > Kerenel ISR -this is mixture of core kernel interrupt handling code + your
> > > > > device driver interrupt handler(if this is chip driver which is supposed to
> > > > > get one interrupt and is reponsible for calling other interrupt handlers
> > > > > based on the chip register status then you do explicit masking unmasking
> > > > > yourself).
> > > > > If you device driver is a interrupt controller driver then you register
> > > > > your driver with kernel interrupt handling code and need to write some
> > > > > callbacks such as .mask,.unmask and so on.This callbacks are called at
> > > > > appropiate places whenever the interrupt is raised.This interrupt is then
> > > > > passed to drivers who has requested for this interrupt by calling
> > > > > request_irq.
> > > > > >
> > > > > > 2. My device, an AX88796B network controller, asserting the interrupt
> > > > > >    line in a level-triggered manner. Now I met problem with the device
> > > > > that
> > > > > >    might caused by the CPU interrupt mode is not set as level-triggered by
> > > > > >    edge trigger.  My CPU is Samsung S3C2410, an ARM920T powered one.  Does
> > > > > >    anyone know usually where and how should I do this kind of setting?
> > > > > Just pass the parameter "level triggered" in request_irq in your device
> > > > > driver.
> > > > 
> > > > Hi Sign,
> > > > 
> > > > I searched the interrupt.h for the all the defined flags that I can pass
> > > > to the request_irq, but there is no a flag looks like "level triggered".
> > > > Would you tell me what you mean the parameter "level triggered"?
> > > irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW)
> > > 
> > > include/linux/irq.h
> > > IRQ_TYPE_LEVEL_HIGH          - high level triggered
> > > IRQ_TYPE_LEVEL_LOW           - low level triggered
> > 
> > Thanks. Now I find the function.
> > 
> > I searched some code about irq in ARM architecure.  Some other
> > people talked about do_IRQ() probabaly is wrong for ARM. There is simply
> > no that function in ARM. Maybe the do_IRQ in x86 is replaced by
> > handle_IRQ.
> arch/arm/kernel/entry-armv.S
> __irq_svc is called by the arm processor which in turn calls irq_handler
> macro.I think this is the lowest level handler after which linux
> interrupt handling takes over.
Only today, I saw this email you replied. Many thanks!

> > 
> > For the irq_set_irq_type(), do you think what's the correct place to
> > call it? Inside my device driver or outside the device driver (probably
> > in the board definition file)? If that should be called inside a device
> > driver, should it be the driver probe function or in the open function?
> > After or before the invocation of request_irq()?
> irq_set_irq_type() should be called by device driver code not by the
> board file.It should be called in the probe function AFAIK.
> > 
> > Sorry for asking too many question.  I found the kernel + device driver
> > irq handling part still not clear to me.
> You are welcome to ask as many question as you want.
> > 
> > 
> > > > 
> > > > Thanks.
> > > > 
> > > > > >
> > > > > >
> > > > > > Thanks in advance.
> > > > > >
> > > > > > --
> > > > > > woody
> > > > > > I can't go back to yesterday - because I was a different person then.
> > > > > >
> > > > > > _______________________________________________
> > > > > > Kernelnewbies mailing list
> > > > > > Kernelnewbies at kernelnewbies.org
> > > > > > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> > > > 
> > > 
> > 
> 

-- 
I can't go back to yesterday - because I was a different person then

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

end of thread, other threads:[~2013-08-05  3:06 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-20 14:27 How kernel handle interrupts Woody Wu
2012-12-20 18:05 ` anish singh
2012-12-21  9:34   ` Woody Wu
2012-12-21 10:53     ` anish kumar
2012-12-21 12:43       ` Woody Wu
2012-12-21 15:34   ` Woody Wu
2012-12-21 21:33     ` How kernel handle interrupts[AX88796B network controller] anish kumar
2012-12-21 21:33       ` anish kumar
2012-12-22 15:11       ` Woody Wu
2012-12-22 15:11         ` Woody Wu
2013-01-07 16:36         ` anish kumar
2013-01-07 16:36           ` anish kumar
2013-08-05  3:01           ` Woody Wu
2013-08-05  3:01             ` Woody Wu
2012-12-24 14:10       ` Woody Wu
2012-12-24 14:10         ` Woody Wu
2012-12-24 16:07         ` Woody Wu
2012-12-24 16:07           ` Woody Wu
2013-01-07 16:22         ` anish kumar
2013-01-07 16:22           ` anish kumar
2012-12-20 18:16 ` How kernel handle interrupts Shahbaz khan
2012-12-21  0:37   ` Woody Wu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.