For a shared interrupt line how do I find which interrupt handler to use?












5















For a shared interrupt line,I can have several interrupt handlers. The kernel will sequentially invoke all the handlers for that particular shared line.
As far as I know, each handler, when invoked informs the kernel whether it was the correct handler to be invoked or not.



My questions is how is this determined,is there a way it checks a memory mapped register that tells status of a particular device or is there some other hardware mechanism ? How does the handler know that the corresponding device is indeed the one that issued the interrupt or not ?



Is this information relayed through the interrupt controller that is between the devices and the processor interrupt line ??










share|improve this question




















  • 1





    unix.stackexchange.com/questions/47306/…

    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Oct 31 '15 at 9:40











  • See also section "Shared Handlers" on page 119 (chapter 7) in Robert Love's "Linux Kernel Development, 3rd edition".

    – Guy Avraham
    Nov 26 '18 at 17:18
















5















For a shared interrupt line,I can have several interrupt handlers. The kernel will sequentially invoke all the handlers for that particular shared line.
As far as I know, each handler, when invoked informs the kernel whether it was the correct handler to be invoked or not.



My questions is how is this determined,is there a way it checks a memory mapped register that tells status of a particular device or is there some other hardware mechanism ? How does the handler know that the corresponding device is indeed the one that issued the interrupt or not ?



Is this information relayed through the interrupt controller that is between the devices and the processor interrupt line ??










share|improve this question




















  • 1





    unix.stackexchange.com/questions/47306/…

    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Oct 31 '15 at 9:40











  • See also section "Shared Handlers" on page 119 (chapter 7) in Robert Love's "Linux Kernel Development, 3rd edition".

    – Guy Avraham
    Nov 26 '18 at 17:18














5












5








5


2






For a shared interrupt line,I can have several interrupt handlers. The kernel will sequentially invoke all the handlers for that particular shared line.
As far as I know, each handler, when invoked informs the kernel whether it was the correct handler to be invoked or not.



My questions is how is this determined,is there a way it checks a memory mapped register that tells status of a particular device or is there some other hardware mechanism ? How does the handler know that the corresponding device is indeed the one that issued the interrupt or not ?



Is this information relayed through the interrupt controller that is between the devices and the processor interrupt line ??










share|improve this question
















For a shared interrupt line,I can have several interrupt handlers. The kernel will sequentially invoke all the handlers for that particular shared line.
As far as I know, each handler, when invoked informs the kernel whether it was the correct handler to be invoked or not.



My questions is how is this determined,is there a way it checks a memory mapped register that tells status of a particular device or is there some other hardware mechanism ? How does the handler know that the corresponding device is indeed the one that issued the interrupt or not ?



Is this information relayed through the interrupt controller that is between the devices and the processor interrupt line ??







linux-kernel linux-device-driver device-driver irq






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 27 '18 at 6:28









Guy Avraham

1,55022031




1,55022031










asked Jan 17 '13 at 2:57









hit.at.rohit.at.ro

6619




6619








  • 1





    unix.stackexchange.com/questions/47306/…

    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Oct 31 '15 at 9:40











  • See also section "Shared Handlers" on page 119 (chapter 7) in Robert Love's "Linux Kernel Development, 3rd edition".

    – Guy Avraham
    Nov 26 '18 at 17:18














  • 1





    unix.stackexchange.com/questions/47306/…

    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Oct 31 '15 at 9:40











  • See also section "Shared Handlers" on page 119 (chapter 7) in Robert Love's "Linux Kernel Development, 3rd edition".

    – Guy Avraham
    Nov 26 '18 at 17:18








1




1





unix.stackexchange.com/questions/47306/…

– Ciro Santilli 新疆改造中心 六四事件 法轮功
Oct 31 '15 at 9:40





unix.stackexchange.com/questions/47306/…

– Ciro Santilli 新疆改造中心 六四事件 法轮功
Oct 31 '15 at 9:40













See also section "Shared Handlers" on page 119 (chapter 7) in Robert Love's "Linux Kernel Development, 3rd edition".

– Guy Avraham
Nov 26 '18 at 17:18





See also section "Shared Handlers" on page 119 (chapter 7) in Robert Love's "Linux Kernel Development, 3rd edition".

– Guy Avraham
Nov 26 '18 at 17:18












1 Answer
1






active

oldest

votes


















3














The kernel will sequentially invoke all the handlers for that particular shared line.



Exactly. Say Dev1 and Dev2 shares the IRQ10. When an interrupt is generated for IRQ10, all ISRs registered with this line will be invoked one by one.



In our scenario, say Dev2 was the one that generated the interrupt. If Dev1's ISR is registered first, than its ISR (i.e Dev1's ISR) only called first. In that ISR, the interrupt status register will be verified for interrupt. If no interrupt bit is set (which is the case, cause Dev2 raised the interrupt) then we can confirm that interrupt was not generated by Dev1 - so Dev1's ISR should return to the kernel IRQ_NONE - which means:"I did not handled that interrupt", so on the kernel continues to the next ISR (i.e Dev2's ISR), which in turn, will indeed verify that its corresponding device generated the interrupt, thus, this handler should handle it and eventually return IRQ_HANDLED - which means:"I handled this one".



See the return values IRQ_NONE/IRQ_HANDLED for more information.



How does the handler know that the corresponding device issued the interrupt or not ?



By reading the Interrupt status register only.



Is this information relayed through the interrupt controller that is between the devices and the processor interrupt line ??



I'm not sure about this. But the OS will take care of calling ISRs based on the return values from ISR.






share|improve this answer


























  • Hi Jeyram, if dev1 and dev2 are of the same device type but different devices(for example dev1 is a regular mouse,say dev2 is a gaming mouse). Then it might know the device type but how will the interrupt handler for dev1 confirm that it is not the correct handler in its return value?

    – hit.at.ro
    Jan 17 '13 at 6:20













  • same device type ... u mean same driver for both the devices???

    – Jeyaram
    Jan 17 '13 at 6:44











  • return value of ISR used by OS. Not the ISR of next device. Based on return value only, OS will decide whether call or do not call next ISR registered for that IRQ line.

    – Jeyaram
    Jan 17 '13 at 6:47











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f14371513%2ffor-a-shared-interrupt-line-how-do-i-find-which-interrupt-handler-to-use%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














The kernel will sequentially invoke all the handlers for that particular shared line.



Exactly. Say Dev1 and Dev2 shares the IRQ10. When an interrupt is generated for IRQ10, all ISRs registered with this line will be invoked one by one.



In our scenario, say Dev2 was the one that generated the interrupt. If Dev1's ISR is registered first, than its ISR (i.e Dev1's ISR) only called first. In that ISR, the interrupt status register will be verified for interrupt. If no interrupt bit is set (which is the case, cause Dev2 raised the interrupt) then we can confirm that interrupt was not generated by Dev1 - so Dev1's ISR should return to the kernel IRQ_NONE - which means:"I did not handled that interrupt", so on the kernel continues to the next ISR (i.e Dev2's ISR), which in turn, will indeed verify that its corresponding device generated the interrupt, thus, this handler should handle it and eventually return IRQ_HANDLED - which means:"I handled this one".



See the return values IRQ_NONE/IRQ_HANDLED for more information.



How does the handler know that the corresponding device issued the interrupt or not ?



By reading the Interrupt status register only.



Is this information relayed through the interrupt controller that is between the devices and the processor interrupt line ??



I'm not sure about this. But the OS will take care of calling ISRs based on the return values from ISR.






share|improve this answer


























  • Hi Jeyram, if dev1 and dev2 are of the same device type but different devices(for example dev1 is a regular mouse,say dev2 is a gaming mouse). Then it might know the device type but how will the interrupt handler for dev1 confirm that it is not the correct handler in its return value?

    – hit.at.ro
    Jan 17 '13 at 6:20













  • same device type ... u mean same driver for both the devices???

    – Jeyaram
    Jan 17 '13 at 6:44











  • return value of ISR used by OS. Not the ISR of next device. Based on return value only, OS will decide whether call or do not call next ISR registered for that IRQ line.

    – Jeyaram
    Jan 17 '13 at 6:47
















3














The kernel will sequentially invoke all the handlers for that particular shared line.



Exactly. Say Dev1 and Dev2 shares the IRQ10. When an interrupt is generated for IRQ10, all ISRs registered with this line will be invoked one by one.



In our scenario, say Dev2 was the one that generated the interrupt. If Dev1's ISR is registered first, than its ISR (i.e Dev1's ISR) only called first. In that ISR, the interrupt status register will be verified for interrupt. If no interrupt bit is set (which is the case, cause Dev2 raised the interrupt) then we can confirm that interrupt was not generated by Dev1 - so Dev1's ISR should return to the kernel IRQ_NONE - which means:"I did not handled that interrupt", so on the kernel continues to the next ISR (i.e Dev2's ISR), which in turn, will indeed verify that its corresponding device generated the interrupt, thus, this handler should handle it and eventually return IRQ_HANDLED - which means:"I handled this one".



See the return values IRQ_NONE/IRQ_HANDLED for more information.



How does the handler know that the corresponding device issued the interrupt or not ?



By reading the Interrupt status register only.



Is this information relayed through the interrupt controller that is between the devices and the processor interrupt line ??



I'm not sure about this. But the OS will take care of calling ISRs based on the return values from ISR.






share|improve this answer


























  • Hi Jeyram, if dev1 and dev2 are of the same device type but different devices(for example dev1 is a regular mouse,say dev2 is a gaming mouse). Then it might know the device type but how will the interrupt handler for dev1 confirm that it is not the correct handler in its return value?

    – hit.at.ro
    Jan 17 '13 at 6:20













  • same device type ... u mean same driver for both the devices???

    – Jeyaram
    Jan 17 '13 at 6:44











  • return value of ISR used by OS. Not the ISR of next device. Based on return value only, OS will decide whether call or do not call next ISR registered for that IRQ line.

    – Jeyaram
    Jan 17 '13 at 6:47














3












3








3







The kernel will sequentially invoke all the handlers for that particular shared line.



Exactly. Say Dev1 and Dev2 shares the IRQ10. When an interrupt is generated for IRQ10, all ISRs registered with this line will be invoked one by one.



In our scenario, say Dev2 was the one that generated the interrupt. If Dev1's ISR is registered first, than its ISR (i.e Dev1's ISR) only called first. In that ISR, the interrupt status register will be verified for interrupt. If no interrupt bit is set (which is the case, cause Dev2 raised the interrupt) then we can confirm that interrupt was not generated by Dev1 - so Dev1's ISR should return to the kernel IRQ_NONE - which means:"I did not handled that interrupt", so on the kernel continues to the next ISR (i.e Dev2's ISR), which in turn, will indeed verify that its corresponding device generated the interrupt, thus, this handler should handle it and eventually return IRQ_HANDLED - which means:"I handled this one".



See the return values IRQ_NONE/IRQ_HANDLED for more information.



How does the handler know that the corresponding device issued the interrupt or not ?



By reading the Interrupt status register only.



Is this information relayed through the interrupt controller that is between the devices and the processor interrupt line ??



I'm not sure about this. But the OS will take care of calling ISRs based on the return values from ISR.






share|improve this answer















The kernel will sequentially invoke all the handlers for that particular shared line.



Exactly. Say Dev1 and Dev2 shares the IRQ10. When an interrupt is generated for IRQ10, all ISRs registered with this line will be invoked one by one.



In our scenario, say Dev2 was the one that generated the interrupt. If Dev1's ISR is registered first, than its ISR (i.e Dev1's ISR) only called first. In that ISR, the interrupt status register will be verified for interrupt. If no interrupt bit is set (which is the case, cause Dev2 raised the interrupt) then we can confirm that interrupt was not generated by Dev1 - so Dev1's ISR should return to the kernel IRQ_NONE - which means:"I did not handled that interrupt", so on the kernel continues to the next ISR (i.e Dev2's ISR), which in turn, will indeed verify that its corresponding device generated the interrupt, thus, this handler should handle it and eventually return IRQ_HANDLED - which means:"I handled this one".



See the return values IRQ_NONE/IRQ_HANDLED for more information.



How does the handler know that the corresponding device issued the interrupt or not ?



By reading the Interrupt status register only.



Is this information relayed through the interrupt controller that is between the devices and the processor interrupt line ??



I'm not sure about this. But the OS will take care of calling ISRs based on the return values from ISR.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 26 '18 at 17:08









Guy Avraham

1,55022031




1,55022031










answered Jan 17 '13 at 5:45









JeyaramJeyaram

6,71942950




6,71942950













  • Hi Jeyram, if dev1 and dev2 are of the same device type but different devices(for example dev1 is a regular mouse,say dev2 is a gaming mouse). Then it might know the device type but how will the interrupt handler for dev1 confirm that it is not the correct handler in its return value?

    – hit.at.ro
    Jan 17 '13 at 6:20













  • same device type ... u mean same driver for both the devices???

    – Jeyaram
    Jan 17 '13 at 6:44











  • return value of ISR used by OS. Not the ISR of next device. Based on return value only, OS will decide whether call or do not call next ISR registered for that IRQ line.

    – Jeyaram
    Jan 17 '13 at 6:47



















  • Hi Jeyram, if dev1 and dev2 are of the same device type but different devices(for example dev1 is a regular mouse,say dev2 is a gaming mouse). Then it might know the device type but how will the interrupt handler for dev1 confirm that it is not the correct handler in its return value?

    – hit.at.ro
    Jan 17 '13 at 6:20













  • same device type ... u mean same driver for both the devices???

    – Jeyaram
    Jan 17 '13 at 6:44











  • return value of ISR used by OS. Not the ISR of next device. Based on return value only, OS will decide whether call or do not call next ISR registered for that IRQ line.

    – Jeyaram
    Jan 17 '13 at 6:47

















Hi Jeyram, if dev1 and dev2 are of the same device type but different devices(for example dev1 is a regular mouse,say dev2 is a gaming mouse). Then it might know the device type but how will the interrupt handler for dev1 confirm that it is not the correct handler in its return value?

– hit.at.ro
Jan 17 '13 at 6:20







Hi Jeyram, if dev1 and dev2 are of the same device type but different devices(for example dev1 is a regular mouse,say dev2 is a gaming mouse). Then it might know the device type but how will the interrupt handler for dev1 confirm that it is not the correct handler in its return value?

– hit.at.ro
Jan 17 '13 at 6:20















same device type ... u mean same driver for both the devices???

– Jeyaram
Jan 17 '13 at 6:44





same device type ... u mean same driver for both the devices???

– Jeyaram
Jan 17 '13 at 6:44













return value of ISR used by OS. Not the ISR of next device. Based on return value only, OS will decide whether call or do not call next ISR registered for that IRQ line.

– Jeyaram
Jan 17 '13 at 6:47





return value of ISR used by OS. Not the ISR of next device. Based on return value only, OS will decide whether call or do not call next ISR registered for that IRQ line.

– Jeyaram
Jan 17 '13 at 6:47




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f14371513%2ffor-a-shared-interrupt-line-how-do-i-find-which-interrupt-handler-to-use%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Contact image not getting when fetch all contact list from iPhone by CNContact

count number of partitions of a set with n elements into k subsets

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks