How do Windows and Linux systems implement physical-to-virtual IRQ mapping?
As far as I know, there are 255 virtual IRQs in Windows systems (chipsets only allow 16 physical IRQs), and they all usually use physical IRQs 11. There is also the concept of virtual IRQ in Linux systems.
So, I’m interested in how this mapping is implemented? Source code examples of Linux kernels or algorithms would be appreciated.
The exact implementation of interrupt handling varies by architecture and platform. This answer is mainly for Linux, because the source is available. At least for Linux, there is a common IRQ processing layer against which drivers are written so that drivers can be compatible between architectures without being affected by the underlying interrupt architecture.
Modern platforms may have multiple interrupt controllers, so it is platform-specific code that handles mapping the IRQ number of a
request_irq() request to a specific interrupt controller.
mach-pxa architecture on Linux for the PXAxxx base platform. This platform the irq.c file contains two
struct irq_chip references, Indicates two different interrupt controllers. When
pxa_init_irq() is called, it assigns a virtual interrupt number to the specific interrupt controller. The platform code ensures that each possible interrupt source is assigned a unique interrupt number.
There are a lot of details that are too detailed to publish here, so I recommend getting a copy of the Linux source code and digging deeper. If you’re looking for a map, look specifically at the different
If you do make
htmldocs from the top level, you get a
Documentation/DocBook/index.html that you can peruse. See
the Genericirq section for more details.
Also, Linux Device Drivers, Corbet, Rubini, Kroah-Hartman This book is an excellent source of information.