Version 3 (modified by 10 years ago) (diff) | ,
---|
GIET-VM / Interrupt Handler functions
The irq_handler.c and irq_handler.h files define the kernel data structure and functions that are used to handle interrupts. They are prefixed by _ to remind that they can only be executed by a processor in kernel mode.
There is three interrupt vectors per processor (stored in each processor's scheduler) for the three HWI, PTI, and WTI interrupts types. Each interrupt vector entry contains three bits fields:
isr_id | bits[15:0] | defines the type of ISR to be executed |
channel_id | bits[30:16] | defines the channel for multi-channels peripherals |
valid | bit [31] | valid interrupt vector entry |
If the peripheral is replicated in clusters, the channel_id is a global index : channel_id = cluster_xy * NB_CHANNELS_MAX + loc_id
void _irq_demux()
This function access the ICU or XCU component (Interrupt Controler Unit) to get the interrupt vector entry. There is one ICU or XICU component per cluster, and these components support several output IRQs (one output IRQ per processor in a given cluster). It uses the _xcu_get_index() or _icu_get_index() functions to get the IRQ type (HWI / PTI / WTI), and the index in the corresponding interrupt vector. Any index value larger than 31 means "no active interrupt", and the default ISR is executed.
All ISRs (but the default ISR) must have the same three arguments :
- unsigned int irq_type,
- unsigned int irq_id,
- unsigned int channel
As most ISRs (Interrupt Service Routine) are associated to a specific peripheral, these ISR are defined in the drivers?. But the following ISRs are defined in the irq_handler.c file:
void _isr_wakup( unsigned int irq_type, unsigned int irq_id, unsigned int channel )
This ISR can only be executed after a WTI (IPI) awake an idle processor, or to force a context switch on a remote processor. The context switch is only executed if the current task is the IDLE_TASK, or if the value written in the mailbox is non zero.
void _isr_tick( unsigned int irq_type, unsigned int irq_id, unsigned int channel )
This ISR is in charge of context switch, and handles the IRQs generated by the "system" timers. It can be PTI in case of XCU, or it can be HWI generated by an external timer in case of ICU. The ISR acknowledges the IRQ, and calls the _ctx_switch() function.
void _isr_default()
This default ISR is called when the interrupt handler is called, and there is no active IRQ. It simply displays a warning message on the kernel TTY[0].