112 | | The actual interrupt routing is defined during the PIC device initialization, by the architecture specific PIC driver. The PIC device is the first device initialized by the kernel_init() function. |
| 112 | The actual interrupt routing is defined during the PIC device initialization, by the architecture specific PIC driver, as defined below. |
| 113 | |
| 114 | === TSAR_MIPS32 architecture === |
| 115 | |
| 116 | The IOPIC external controller provides two services: |
| 117 | 1. It translate each IRQ identified by its '''irq_id''' to a write transactions to a specific mailbox contained in a local LAPIC controller, for a given core in a given cluster. as explained below. |
| 118 | 1. It allows the kernel to selectively enable/disable any external IRQ identified by its '''irq_id''' index. |
| 119 | |
| 120 | The LAPIC controller (called XCU) is replicated in all clusters containing at least one core. It handle three types of IRQs: The '''HWI''' (HardWare Interrupts) are generated by local internal peripherals, and connected to the local XCU, to be routed to a given local core. The '''WTI''' ( Write Triggered Interrupts) are actually mailboxes implemented in the local XCU. They are used to implement both software IPIs (Inter-Processor-Interrupts), |
| 121 | or to register the external IRQs (write transactions) generated by the IOPIC controller. Finally the '''PTI''' (Programmable Timer Interrupts) are actually timers contained contained in the LAPIC,programmed by the kernel, |
| 122 | and routed to a local core to implement context switches (TICK event). The numbers of interrupts of each type in a given cluster are defined in the XCU_CONFIG register of the XCU component, and cannot be larger than the |
| 123 | SOCLIB_MAX_HWI, SOCLIB_MAX_WTI, SOCLIB_MAX_PTI constants defined in the '' soclib_pic.h'' file. |
| 124 | |
| 125 | The actual IRQ routing policy implemented by the SOCLIB_PIC driver depends on the IRQ type. For the external IRQs, the routing is done by the soclib_pic_bind_irq() function. |
| 126 | |
| 127 | * ''Local Hardware Interrupt''' : There is only two local peripherals. The MMC device is the L2 cache configuration |
| 128 | * '''PTI''' : There is one PTI per local core, and the PTI index is equal to the core local index. |
| 129 | * '''IPI''' : There is one IPI per local core. Each IPI is implemented as a WTI mailbox. |
| 130 | * '''External Hardware Interrupt''' : each external IRQ is translated to a WTI event, |
| 131 | |
| 132 | The LAPIC controller provides three main services: |
| 133 | 1. It allows the kernel to selectively enable/disable any IRQ (identified by its type and index) for a given core. It is the kernel responsibility to enable a given IRQ for a single core as a given IRQ event should be handled by only one core. |
| 134 | * 2) It makes a global OR between all enabled IRQs for a given core, to interrupt |
| 135 | * the core when at least one enabled IRQ is active. |
| 136 | * 3) It is capable to return the highest priority active IRQ of each type. |
| 137 | * For each type, the lowest index have the highest priority. |
| 138 | |
| 139 | === X86_64 architecture === |
| 140 | |