How kernel handle interrupts
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.
Signature · 2 lines
woody I can't go back to yesterday - because I was a different person then.
Quoted 11 lines · Woody Wu
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.
Quoted 3 lines
2. My device, an AX88796B network controller, asserting the interrupt line in a level-triggered manner. Now I met problem with the device
that
Quoted 3 lines
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.
Quoted 4 lines
Thanks in advance.
Quoted 8 lines
--
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
? 2012-12-21 AM2:05?"anish singh" <[email protected]>???
Quoted 9 lines · Woody Wu
Quoted 6 lines
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.
Quoted 7 lines
Quoted 5 lines
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.
Quoted 1 line
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).
Quoted 1 line
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 !
Quoted 4 lines
Quoted 4 lines
2. My device, an AX88796B network controller, asserting the interrupt line in a level-triggered manner. Now I met problem with the device
that
Quoted 1 line
Quoted 1 line
might caused by the CPU interrupt mode is not set as level-triggered
by
Quoted 1 line
Quoted 1 line
edge trigger. My CPU is Samsung S3C2410, an ARM920T powered one.
Does
Quoted 2 lines
Quoted 1 line
anyone know usually where and how should I do this kind of setting?
Just pass the parameter "level triggered" in
request_irqin your device
driver.
Quoted 5 lines
Quoted 5 lines
Thanks in advance.
Quoted 8 lines
Quoted 8 lines
--
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
Quoted 38 lines · Woody Wu
? 2012-12-21 AM2:05?"anish singh" <[email protected]>? ??
Quoted 7 lines · Woody Wu
Quoted 4 lines
Hi, List
Where is the Kernel code that handles external interrupts? I want
to
Quoted 3 lines
Quoted 3 lines
have a look at it but haven't found out where it is.
Actually, I have some basic questions about interrupt handling in
Linux.
Quoted 1 line
Quoted 1 line
1. After Kernel's ISR received an interrupt, I believe it will
invoke a
Quoted 2 lines
Quoted 2 lines
handler defined in a device driver if any. But it should be the device driver's responsibility or kernel ISR's responsibility
to
Quoted 3 lines
Quoted 1 line
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.
Quoted 1 line
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).
Quoted 1 line
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.
Quoted 4 lines
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.
Quoted 3 lines
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.
Quoted 3 lines
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)
Quoted 2 lines
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 :)?
Quoted 2 lines
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.
Quoted 33 lines
Thanks in advance !
Quoted 3 lines
Quoted 3 lines
2. My device, an AX88796B network controller, asserting the
interrupt
Quoted 1 line
Quoted 1 line
line in a level-triggered manner. Now I met problem with the
device that
Quoted 1 line
Quoted 1 line
might caused by the CPU interrupt mode is not set as
level-triggered by
Quoted 1 line
Quoted 1 line
edge trigger. My CPU is Samsung S3C2410, an ARM920T powered
one. Does
Quoted 1 line
Quoted 1 line
anyone know usually where and how should I do this kind of
setting?
Quoted 1 line
Just pass the parameter "level triggered" in
request_irqin yourdevice driver.
Quoted 8 lines
Quoted 8 lines
Thanks in advance.
--
woody
I can't go back to yesterday - because I was a different personthen.
Quoted 5 lines
Quoted 5 lines
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
? 2012-12-21 PM6:53?"anish kumar" <[email protected]>???
Quoted 48 lines · Woody Wu
Quoted 38 lines
? 2012-12-21 AM2:05?"anish singh" <[email protected]>? ??
Quoted 7 lines · Woody Wu
Quoted 4 lines
Hi, List
Where is the Kernel code that handles external interrupts? I want
to
Quoted 3 lines
Quoted 3 lines
have a look at it but haven't found out where it is.
Actually, I have some basic questions about interrupt handling in
Linux.
Quoted 1 line
Quoted 1 line
1. After Kernel's ISR received an interrupt, I believe it will
invoke a
Quoted 2 lines
Quoted 2 lines
handler defined in a device driver if any. But it should be the device driver's responsibility or kernel ISR's responsibility
to
Quoted 3 lines
Quoted 1 line
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.
Quoted 1 line
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).
Quoted 1 line
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.Quoted 4 lines
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.
Quoted 3 lines
If my driver needs to do the mask and unmask job, what's the kernel API I should call?
Quoted 8 lines
You don't need to worry about mask and unmask job AFAIK.
Quoted 3 lines
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?
Quoted 4 lines
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.
Quoted 10 lines
Quoted 2 lines
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 :)?
Quoted 2 lines
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 tohandle_edge_irqcall 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!
Quoted 25 lines
Quoted 25 lines
Thanks in advance !
Quoted 3 lines
Quoted 3 lines
2. My device, an AX88796B network controller, asserting the
interrupt
Quoted 1 line
Quoted 1 line
line in a level-triggered manner. Now I met problem with the
device that
Quoted 1 line
Quoted 1 line
might caused by the CPU interrupt mode is not set as
level-triggered by
Quoted 1 line
Quoted 1 line
edge trigger. My CPU is Samsung S3C2410, an ARM920T powered
one. Does
Quoted 1 line
Quoted 1 line
anyone know usually where and how should I do this kind of
setting?
Quoted 1 line
Just pass the parameter "level triggered" in
request_irqin yourdevice driver.
Quoted 8 lines
Quoted 8 lines
Thanks in advance.
--
woody
I can't go back to yesterday - because I was a different person
Quoted 10 lines
Quoted 8 lines
then.
Quoted 5 lines
Quoted 5 lines
_______________________________________________
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
Quoted 28 lines · anish singh
Quoted 11 lines · Woody Wu
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 callingrequest_irq.Quoted 1 line
Quoted 8 lines
Quoted 2 lines
2. My device, an AX88796B network controller, asserting the interrupt line in a level-triggered manner. Now I met problem with the device
that
Quoted 3 lines
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_irqin 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.
Quoted 12 lines
Quoted 12 lines
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
Signature · 2 lines
woody I can't go back to yesterday - because I was a different person then.
Re: How kernel handle interrupts[AX88796B network controller]
Quoted 35 lines · Woody Wu
Quoted 34 lines · anish singh
Quoted 11 lines · Woody Wu
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 callingrequest_irq.Quoted 3 lines
2. My device, an AX88796B network controller, asserting the interrupt line in a level-triggered manner. Now I met problem with the device
that
Quoted 3 lines
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?
Quoted 8 lines
Quoted 2 lines
Just pass the parameter "level triggered" in
request_irqin your device driver.Hi Sign,
I searched the
interrupt.hfor the all the defined flags that I can pass to therequest_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.hIRQ_TYPE_LEVEL_HIGH - high level triggeredIRQ_TYPE_LEVEL_LOW - low level triggered
Quoted 16 lines
Thanks.
Quoted 12 lines
Quoted 12 lines
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
Re: How kernel handle interrupts[AX88796B network controller]
Quoted 41 lines · anish kumar
Quoted 40 lines · Woody Wu
Quoted 28 lines · anish singh
Quoted 11 lines · Woody Wu
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 callingrequest_irq.Quoted 1 line
Quoted 8 lines
Quoted 2 lines
2. My device, an AX88796B network controller, asserting the interrupt line in a level-triggered manner. Now I met problem with the device
that
Quoted 3 lines
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_irqin your device driver.Hi Sign,
Quoted 8 lines
Quoted 3 lines
I searched the
interrupt.hfor the all the defined flags that I can pass to therequest_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.hIRQ_TYPE_LEVEL_HIGH- high level triggeredIRQ_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.
Quoted 17 lines
Quoted 16 lines
Thanks.
Quoted 12 lines
Quoted 12 lines
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
Signature · 2 lines
woody I can't go back to yesterday - because I was a different person then.
Re: How kernel handle interrupts[AX88796B network controller]
Quoted 51 lines · Woody Wu
Quoted 41 lines · anish kumar
Quoted 40 lines · Woody Wu
Quoted 28 lines · anish singh
Quoted 11 lines · Woody Wu
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 callingrequest_irq.Quoted 1 line
Quoted 8 lines
Quoted 2 lines
2. My device, an AX88796B network controller, asserting the interrupt line in a level-triggered manner. Now I met problem with the device
that
Quoted 3 lines
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_irqin your device driver.Hi Sign,
Quoted 8 lines
Quoted 3 lines
I searched the
interrupt.hfor the all the defined flags that I can pass to therequest_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.hIRQ_TYPE_LEVEL_HIGH- high level triggeredIRQ_TYPE_LEVEL_LOW- low level triggered
Quoted 6 lines
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 thedo_IRQin x86 is replaced byhandle_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.
Quoted 6 lines
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 ofrequest_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.
Quoted 3 lines
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.
Quoted 20 lines
Quoted 19 lines
Quoted 18 lines
Thanks.
Quoted 12 lines
Quoted 12 lines
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
Re: How kernel handle interrupts[AX88796B network controller]
Quoted 54 lines · anish kumar
Quoted 53 lines · Woody Wu
Quoted 41 lines · anish kumar
Quoted 40 lines · Woody Wu
Quoted 28 lines · anish singh
Quoted 11 lines · Woody Wu
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 callingrequest_irq.Quoted 1 line
Quoted 8 lines
Quoted 2 lines
2. My device, an AX88796B network controller, asserting the interrupt line in a level-triggered manner. Now I met problem with the device
that
Quoted 3 lines
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_irqin your device driver.Hi Sign,
Quoted 8 lines
Quoted 3 lines
I searched the
interrupt.hfor the all the defined flags that I can pass to therequest_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.hIRQ_TYPE_LEVEL_HIGH- high level triggeredIRQ_TYPE_LEVEL_LOW- low level triggeredThanks. Now I find the function.
Quoted 8 lines
Quoted 4 lines
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 thedo_IRQin x86 is replaced byhandle_IRQ.
arch/arm/kernel/entry-armv.S__irq_svcis called by the arm processor which in turn callsirq_handlermacro.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!
Quoted 33 lines
Quoted 6 lines
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 ofrequest_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.Quoted 3 lines
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.
Quoted 20 lines
Quoted 19 lines
Quoted 18 lines
Thanks.
Quoted 12 lines
Quoted 12 lines
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
Signature · 1 line
I can't go back to yesterday - because I was a different person then
Re: How kernel handle interrupts[AX88796B network controller]
In reply to anish kumarQuoted 41 lines · anish kumar
Quoted 40 lines · Woody Wu
Quoted 28 lines · anish singh
Quoted 11 lines · Woody Wu
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 callingrequest_irq.Quoted 1 line
Quoted 8 lines
Quoted 2 lines
2. My device, an AX88796B network controller, asserting the interrupt line in a level-triggered manner. Now I met problem with the device
that
Quoted 3 lines
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_irqin your device driver.Hi Sign,
Quoted 8 lines
Quoted 3 lines
I searched the
interrupt.hfor the all the defined flags that I can pass to therequest_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.hIRQ_TYPE_LEVEL_HIGH- high level triggeredIRQ_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.
Quoted 17 lines
Quoted 16 lines
Thanks.
Quoted 12 lines
Quoted 12 lines
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
Signature · 2 lines
woody I can't go back to yesterday - because I was a different person then.
Re: How kernel handle interrupts[AX88796B network controller]
Quoted 53 lines · Woody Wu
Quoted 41 lines · anish kumar
Quoted 40 lines · Woody Wu
Quoted 28 lines · anish singh
Quoted 11 lines · Woody Wu
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 callingrequest_irq.Quoted 1 line
Quoted 8 lines
Quoted 2 lines
2. My device, an AX88796B network controller, asserting the interrupt line in a level-triggered manner. Now I met problem with the device
that
Quoted 3 lines
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_irqin your device driver.Hi Sign,
Quoted 8 lines
Quoted 3 lines
I searched the
interrupt.hfor the all the defined flags that I can pass to therequest_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.hIRQ_TYPE_LEVEL_HIGH- high level triggeredIRQ_TYPE_LEVEL_LOW- low level triggeredThanks. You saved my ass.
Quoted 11 lines
Be curious, I found the api changes from 2.6 to 3.7. In 2.6, there are pair of funtions,
set_irq_typeandset_irq_handle(there is noirq_set_irq_typein 2.6). Problem is, I cannot find something likeirq_set_irq_handlein 3.7. Does that mean, in 3.7, whenirq_set_irq_typeis 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 invokingirq_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.
Quoted 23 lines
Quoted 19 lines
Quoted 18 lines
Thanks.
Quoted 12 lines
Quoted 12 lines
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/kernelnewbiesSignature · 2 lines
woody I can't go back to yesterday - because I was a different person then.
Signature · 2 lines
woody I can't go back to yesterday - because I was a different person then.
Re: How kernel handle interrupts[AX88796B network controller]
In reply to Woody WuQuoted 53 lines · Woody Wu
Quoted 41 lines · anish kumar
Quoted 40 lines · Woody Wu
Quoted 28 lines · anish singh
Quoted 11 lines · Woody Wu
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 callingrequest_irq.Quoted 1 line
Quoted 8 lines
Quoted 2 lines
2. My device, an AX88796B network controller, asserting the interrupt line in a level-triggered manner. Now I met problem with the device
that
Quoted 3 lines
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_irqin your device driver.Hi Sign,
Quoted 8 lines
Quoted 3 lines
I searched the
interrupt.hfor the all the defined flags that I can pass to therequest_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.hIRQ_TYPE_LEVEL_HIGH- high level triggeredIRQ_TYPE_LEVEL_LOW- low level triggeredThanks. You saved my ass.
Quoted 11 lines
Be curious, I found the api changes from 2.6 to 3.7. In 2.6, there are pair of funtions,
set_irq_typeandset_irq_handle(there is noirq_set_irq_typein 2.6). Problem is, I cannot find something likeirq_set_irq_handlein 3.7. Does that mean, in 3.7, whenirq_set_irq_typeis 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 invokingirq_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?
Quoted 20 lines
Quoted 19 lines
Quoted 18 lines
Thanks.
Quoted 12 lines
Quoted 12 lines
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
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
Quoted 29 lines · Woody Wu
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
Signature · 4 lines
Shahbaz Khan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20121220/bbc8a3f0/attachment.html
Quoted 6 lines · Shahbaz khan
Hi Woody,
Check "
do_IRQ()" inarch/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.
Quoted 41 lines
Hope this helps.
BR,
Shahbaz KhanQuoted 29 lines · Woody Wu
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/kernelnewbiesSignature · 1 line
Shahbaz Khan
Signature · 2 lines
woody I can't go back to yesterday - because I was a different person then.