Re: Devices, IRQs and handlers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2006-01-08 at 23:03 -0800, Rajaram Suryanarayanan wrote:
> Hi,
>  
> I am confused about the mapping between devices, IRQs and the
> handlers. I am following Robert Love's "Linux Kernel Development"
> book.
>  
> 1. I see that different handlers can share the same IRQ with SA_SHIRQ
> flag. So does it mean there can be different interrupt handlers for
> the same device...? 

No...

> As I think each device has a unique IRQ ( strict 1-to-1 mapping
> between device and its IRQ ).


> 2. Related to the first question, can different devices share the same
> IRQ ?

... because the answer to this is yes.
Shared irq means that multiple physical devices can share the same irq
number, and the cpu cannot distinguish which of the devices caused the
irq when the irq arrives, so the kernel has to call all known handlers
for that specific IRQ number to be safe.

For example, a serial card and a IDE controller both share IRQ number
11. When IRQ number 11 comes in, the cpu can't know if the irq came from
the serial card or the IDE controller. The core kernel thus can't know
either, so to be sure the kernel will call both the serial drivers irq
handler AND the IDE controller IRQ handler.

To deal with this in your IRQ handler, you need to first test if the IRQ
was actually for you, by asking your device if there was an event. (how
to do that is different for each device, otherwise the kernel could have
done it ;)


> 


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux