← Documents Documentation/arch/loongarch/irq-chip-model.rst GitHub 원문 ↗

Linux 6.18.37 · Architecture

IRQ Chip Model of LoongArch

LoongArch/LS7A의 legacy, extended, virtual, advanced IRQ controller hierarchy와 ACPI MADT 정의를 설명합니다.

Source pathDocumentation/arch/loongarch/irq-chip-model.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약과 해설

irq-chip-model.rst:1-256

네 원문 ASCII hierarchy를 각각 같은 routing 의미의 flow로 다시 그렸습니다. 차이는 device interrupt를 `HTVECINTC`, `EIOINTC`, `V-EIOINTC`, `AVECINTC` 중 어디에서 모아 `CPUINTC`로 전달하는지입니다.

Legacy IRQ model
DevicesPCH-LPC/PCH-PIC/PCH-MSIHTVECINTCLIOINTCCPUINTC
UARTsLIOINTCCPUINTC
IPI/TimerCPUINTC

HTVECINTC와 LIOINTC를 연속으로 통과합니다.

Extended IRQ model
DevicesPCH-LPC/PCH-PIC/PCH-MSIEIOINTCCPUINTC
UARTsLIOINTCCPUINTC
IPI/TimerCPUINTC

EIOINTC가 CPUINTC로 직접 전달합니다.

Virtual Extended IRQ model
Devices/UARTsPCH-PIC/PCH-MSIV-EIOINTCCPUINTC 0..255 vCPU
IPI/TimerCPUINTC

V-EIOINTC가 최대 256 vCPU로 route합니다.

Advanced Extended IRQ model
PCH-MSIAVECINTCCPUINTC
DevicesPCH-LPC/PCH-PICEIOINTCCPUINTC
UARTsLIOINTCCPUINTC
IPI/TimerCPUINTC

MSI를 AVECINTC 전용 경로로 분리합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 =======================================
4 IRQ chip model (hierarchy) of LoongArch
5 =======================================
6
7 Currently, LoongArch based processors (e.g. Loongson-3A5000) can only work together
8 with LS7A chipsets. The irq chips in LoongArch computers include CPUINTC (CPU Core
9 Interrupt Controller), LIOINTC (Legacy I/O Interrupt Controller), EIOINTC (Extended
10 I/O Interrupt Controller), HTVECINTC (Hyper-Transport Vector Interrupt Controller),
11 PCH-PIC (Main Interrupt Controller in LS7A chipset), PCH-LPC (LPC Interrupt Controller
12 in LS7A chipset) and PCH-MSI (MSI Interrupt Controller).
13
14 CPUINTC is a per-core controller (in CPU), LIOINTC/EIOINTC/HTVECINTC are per-package
15 controllers (in CPU), while PCH-PIC/PCH-LPC/PCH-MSI are controllers out of CPU (i.e.,
16 in chipsets). These controllers (in other words, irqchips) are linked in a hierarchy,
17 and there are two models of hierarchy (legacy model and extended model).
18
19 Legacy IRQ model
20 ================
21
22 In this model, IPI (Inter-Processor Interrupt) and CPU Local Timer interrupt go
23 to CPUINTC directly, CPU UARTS interrupts go to LIOINTC, while all other devices
24 interrupts go to PCH-PIC/PCH-LPC/PCH-MSI and gathered by HTVECINTC, and then go
25 to LIOINTC, and then CPUINTC::
26
27 +-----+ +---------+ +-------+
28 | IPI | --> | CPUINTC | <-- | Timer |
29 +-----+ +---------+ +-------+
30 ^
31 |
32 +---------+ +-------+
33 | LIOINTC | <-- | UARTs |
34 +---------+ +-------+
35 ^
36 |
37 +-----------+
38 | HTVECINTC |
39 +-----------+
40 ^ ^
41 | |
42 +---------+ +---------+
43 | PCH-PIC | | PCH-MSI |
44 +---------+ +---------+
45 ^ ^ ^
46 | | |
47 +---------+ +---------+ +---------+
48 | PCH-LPC | | Devices | | Devices |
49 +---------+ +---------+ +---------+
50 ^
51 |
52 +---------+
53 | Devices |
54 +---------+
55
56 Extended IRQ model
57 ==================
58
59 In this model, IPI (Inter-Processor Interrupt) and CPU Local Timer interrupt go
60 to CPUINTC directly, CPU UARTS interrupts go to LIOINTC, while all other devices
61 interrupts go to PCH-PIC/PCH-LPC/PCH-MSI and gathered by EIOINTC, and then go to
62 to CPUINTC directly::
63
64 +-----+ +---------+ +-------+
65 | IPI | --> | CPUINTC | <-- | Timer |
66 +-----+ +---------+ +-------+
67 ^ ^
68 | |
69 +---------+ +---------+ +-------+
70 | EIOINTC | | LIOINTC | <-- | UARTs |
71 +---------+ +---------+ +-------+
72 ^ ^
73 | |
74 +---------+ +---------+
75 | PCH-PIC | | PCH-MSI |
76 +---------+ +---------+
77 ^ ^ ^
78 | | |
79 +---------+ +---------+ +---------+
80 | PCH-LPC | | Devices | | Devices |
81 +---------+ +---------+ +---------+
82 ^
83 |
84 +---------+
85 | Devices |
86 +---------+
87
88 Virtual Extended IRQ model
89 ==========================
90
91 In this model, IPI (Inter-Processor Interrupt) and CPU Local Timer interrupt
92 go to CPUINTC directly, CPU UARTS interrupts go to PCH-PIC, while all other
93 devices interrupts go to PCH-PIC/PCH-MSI and gathered by V-EIOINTC (Virtual
94 Extended I/O Interrupt Controller), and then go to CPUINTC directly::
95
96 +-----+ +-------------------+ +-------+
97 | IPI |--> | CPUINTC(0-255vcpu)| <-- | Timer |
98 +-----+ +-------------------+ +-------+
99 ^
100 |
101 +-----------+
102 | V-EIOINTC |
103 +-----------+
104 ^ ^
105 | |
106 +---------+ +---------+
107 | PCH-PIC | | PCH-MSI |
108 +---------+ +---------+
109 ^ ^ ^
110 | | |
111 +--------+ +---------+ +---------+
112 | UARTs | | Devices | | Devices |
113 +--------+ +---------+ +---------+
114
115
116 Description
117 -----------
118 V-EIOINTC (Virtual Extended I/O Interrupt Controller) is an extension of
119 EIOINTC, it only works in VM mode which runs in KVM hypervisor. Interrupts can
120 be routed to up to four vCPUs via standard EIOINTC, however with V-EIOINTC
121 interrupts can be routed to up to 256 virtual cpus.
122
123 With standard EIOINTC, interrupt routing setting includes two parts: eight
124 bits for CPU selection and four bits for CPU IP (Interrupt Pin) selection.
125 For CPU selection there is four bits for EIOINTC node selection, four bits
126 for EIOINTC CPU selection. Bitmap method is used for CPU selection and
127 CPU IP selection, so interrupt can only route to CPU0 - CPU3 and IP0-IP3 in
128 one EIOINTC node.
129
130 With V-EIOINTC it supports to route more CPUs and CPU IP (Interrupt Pin),
131 there are two newly added registers with V-EIOINTC.
132
133 EXTIOI_VIRT_FEATURES
134 --------------------
135 This register is read-only register, which indicates supported features with
136 V-EIOINTC. Feature EXTIOI_HAS_INT_ENCODE and EXTIOI_HAS_CPU_ENCODE is added.
137
138 Feature EXTIOI_HAS_INT_ENCODE is part of standard EIOINTC. If it is 1, it
139 indicates that CPU Interrupt Pin selection can be normal method rather than
140 bitmap method, so interrupt can be routed to IP0 - IP15.
141
142 Feature EXTIOI_HAS_CPU_ENCODE is extension of V-EIOINTC. If it is 1, it
143 indicates that CPU selection can be normal method rather than bitmap method,
144 so interrupt can be routed to CPU0 - CPU255.
145
146 EXTIOI_VIRT_CONFIG
147 ------------------
148 This register is read-write register, for compatibility interrupt routed uses
149 the default method which is the same with standard EIOINTC. If the bit is set
150 with 1, it indicated HW to use normal method rather than bitmap method.
151
152 Advanced Extended IRQ model
153 ===========================
154
155 In this model, IPI (Inter-Processor Interrupt) and CPU Local Timer interrupt go
156 to CPUINTC directly, CPU UARTS interrupts go to LIOINTC, PCH-MSI interrupts go
157 to AVECINTC, and then go to CPUINTC directly, while all other devices interrupts
158 go to PCH-PIC/PCH-LPC and gathered by EIOINTC, and then go to CPUINTC directly::
159
160 +-----+ +-----------------------+ +-------+
161 | IPI | --> | CPUINTC | <-- | Timer |
162 +-----+ +-----------------------+ +-------+
163 ^ ^ ^
164 | | |
165 +---------+ +----------+ +---------+ +-------+
166 | EIOINTC | | AVECINTC | | LIOINTC | <-- | UARTs |
167 +---------+ +----------+ +---------+ +-------+
168 ^ ^
169 | |
170 +---------+ +---------+
171 | PCH-PIC | | PCH-MSI |
172 +---------+ +---------+
173 ^ ^ ^
174 | | |
175 +---------+ +---------+ +---------+
176 | Devices | | PCH-LPC | | Devices |
177 +---------+ +---------+ +---------+
178 ^
179 |
180 +---------+
181 | Devices |
182 +---------+
183
184 ACPI-related definitions
185 ========================
186
187 CPUINTC::
188
189 ACPI_MADT_TYPE_CORE_PIC;
190 struct acpi_madt_core_pic;
191 enum acpi_madt_core_pic_version;
192
193 LIOINTC::
194
195 ACPI_MADT_TYPE_LIO_PIC;
196 struct acpi_madt_lio_pic;
197 enum acpi_madt_lio_pic_version;
198
199 EIOINTC::
200
201 ACPI_MADT_TYPE_EIO_PIC;
202 struct acpi_madt_eio_pic;
203 enum acpi_madt_eio_pic_version;
204
205 HTVECINTC::
206
207 ACPI_MADT_TYPE_HT_PIC;
208 struct acpi_madt_ht_pic;
209 enum acpi_madt_ht_pic_version;
210
211 PCH-PIC::
212
213 ACPI_MADT_TYPE_BIO_PIC;
214 struct acpi_madt_bio_pic;
215 enum acpi_madt_bio_pic_version;
216
217 PCH-MSI::
218
219 ACPI_MADT_TYPE_MSI_PIC;
220 struct acpi_madt_msi_pic;
221 enum acpi_madt_msi_pic_version;
222
223 PCH-LPC::
224
225 ACPI_MADT_TYPE_LPC_PIC;
226 struct acpi_madt_lpc_pic;
227 enum acpi_madt_lpc_pic_version;
228
229 References
230 ==========
231
232 Documentation of Loongson-3A5000:
233
234 https://github.com/loongson/LoongArch-Documentation/releases/latest/download/Loongson-3A5000-usermanual-1.02-CN.pdf (in Chinese)
235
236 https://github.com/loongson/LoongArch-Documentation/releases/latest/download/Loongson-3A5000-usermanual-1.02-EN.pdf (in English)
237
238 Documentation of Loongson's LS7A chipset:
239
240 https://github.com/loongson/LoongArch-Documentation/releases/latest/download/Loongson-7A1000-usermanual-2.00-CN.pdf (in Chinese)
241
242 https://github.com/loongson/LoongArch-Documentation/releases/latest/download/Loongson-7A1000-usermanual-2.00-EN.pdf (in English)
243
244 .. Note::
245 - CPUINTC is CSR.ECFG/CSR.ESTAT and its interrupt controller described
246 in Section 7.4 of "LoongArch Reference Manual, Vol 1";
247 - LIOINTC is "Legacy I/OInterrupts" described in Section 11.1 of
248 "Loongson 3A5000 Processor Reference Manual";
249 - EIOINTC is "Extended I/O Interrupts" described in Section 11.2 of
250 "Loongson 3A5000 Processor Reference Manual";
251 - HTVECINTC is "HyperTransport Interrupts" described in Section 14.3 of
252 "Loongson 3A5000 Processor Reference Manual";
253 - PCH-PIC/PCH-MSI is "Interrupt Controller" described in Section 5 of
254 "Loongson 7A1000 Bridge User Manual";
255 - PCH-LPC is "LPC Interrupts" described in Section 24.3 of
256 "Loongson 7A1000 Bridge User Manual".
257

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

IRQ controller 계층

1-18

현재 Loongson-3A5000 같은 LoongArch processor는 LS7A chipset과 함께 사용됩니다. IRQ chip에는 `CPUINTC`, `LIOINTC`, `EIOINTC`, `HTVECINTC`, `PCH-PIC`, `PCH-LPC`, `PCH-MSI`가 있습니다.

ControllerFull nameScope
`CPUINTC`CPU Core Interrupt ControllerPer-core, CPU 내부
`LIOINTC`Legacy I/O Interrupt ControllerPer-package, CPU 내부
`EIOINTC`Extended I/O Interrupt ControllerPer-package, CPU 내부
`HTVECINTC`Hyper-Transport Vector Interrupt ControllerPer-package, CPU 내부
`PCH-PIC`LS7A Main Interrupt ControllerChipset
`PCH-LPC`LS7A LPC Interrupt ControllerChipset
`PCH-MSI`MSI Interrupt ControllerChipset

Controller들은 hierarchy로 연결되며 legacy, extended, virtual extended, advanced extended model을 구성합니다.

Legacy IRQ model

19-55

`IPI`와 CPU local timer는 `CPUINTC`로 직접 갑니다. CPU UART는 `LIOINTC`, 나머지 device는 `PCH-PIC/PCH-LPC/PCH-MSI`에서 `HTVECINTC`로 모인 뒤 `LIOINTC`와 `CPUINTC`를 차례로 통과합니다. 원문 ASCII hierarchy는 요약의 Legacy flow로 구조화했습니다.

Extended IRQ model

56-87

`IPI`와 timer는 `CPUINTC`, UART는 `LIOINTC`로 갑니다. 나머지 device interrupt는 PCH controller에서 `EIOINTC`로 모이고 `LIOINTC`를 거치지 않고 `CPUINTC`로 직접 갑니다. 원문 ASCII hierarchy는 Extended flow로 구조화했습니다.

Virtual Extended IRQ model

88-151

Virtual model은 KVM hypervisor의 VM mode에서만 동작하는 `V-EIOINTC`를 사용합니다. `IPI`와 timer는 `CPUINTC`, UART는 `PCH-PIC`, 나머지는 `PCH-PIC/PCH-MSI`에서 `V-EIOINTC`로 모여 `CPUINTC(0-255 vCPU)`로 갑니다.

Standard `EIOINTC`는 최대 4 vCPU, `V-EIOINTC`는 최대 256 virtual CPU로 route할 수 있습니다. Standard routing은 CPU 선택 8 bits(4-bit node + 4-bit CPU)와 CPU IP 선택 4 bits를 bitmap으로 사용하므로 node 안에서 CPU0..CPU3, IP0..IP3만 고를 수 있습니다.

Feature/config의미
`EXTIOI_HAS_INT_ENCODE`CPU Interrupt Pin을 bitmap 대신 normal encoding으로 선택해 IP0..IP15 route
`EXTIOI_HAS_CPU_ENCODE`CPU를 normal encoding으로 선택해 CPU0..CPU255 route

`EXTIOI_VIRT_FEATURES`는 지원 feature를 나타내는 read-only register입니다. `EXTIOI_VIRT_CONFIG`는 read-write이며 compatibility를 위해 기본 bitmap 방식을 사용하고 bit를 1로 설정하면 normal encoding을 선택합니다.

Advanced Extended IRQ model

152-183

`IPI`와 timer는 `CPUINTC`, UART는 `LIOINTC`로 직접 갑니다. `PCH-MSI` interrupt는 `AVECINTC`를 거쳐 `CPUINTC`로 가고, 나머지 device interrupt는 `PCH-PIC/PCH-LPC`에서 `EIOINTC`로 모여 `CPUINTC`로 갑니다. 원문 ASCII hierarchy는 Advanced flow로 구조화했습니다.

ACPI 정의

184-228
ControllerMADT typeStructureVersion enum
`CPUINTC``ACPI_MADT_TYPE_CORE_PIC``struct acpi_madt_core_pic``enum acpi_madt_core_pic_version`
`LIOINTC``ACPI_MADT_TYPE_LIO_PIC``struct acpi_madt_lio_pic``enum acpi_madt_lio_pic_version`
`EIOINTC``ACPI_MADT_TYPE_EIO_PIC``struct acpi_madt_eio_pic``enum acpi_madt_eio_pic_version`
`HTVECINTC``ACPI_MADT_TYPE_HT_PIC``struct acpi_madt_ht_pic``enum acpi_madt_ht_pic_version`
`PCH-PIC``ACPI_MADT_TYPE_BIO_PIC``struct acpi_madt_bio_pic``enum acpi_madt_bio_pic_version`
`PCH-MSI``ACPI_MADT_TYPE_MSI_PIC``struct acpi_madt_msi_pic``enum acpi_madt_msi_pic_version`
`PCH-LPC``ACPI_MADT_TYPE_LPC_PIC``struct acpi_madt_lpc_pic``enum acpi_madt_lpc_pic_version`

참고 자료

229-256
  • `CPUINTC`: LoongArch Reference Manual Vol.1 7.4절의 `CSR.ECFG/CSR.ESTAT`
  • `LIOINTC`: Loongson 3A5000 manual 11.1절 Legacy I/O Interrupts
  • `EIOINTC`: Loongson 3A5000 manual 11.2절 Extended I/O Interrupts
  • `HTVECINTC`: Loongson 3A5000 manual 14.3절 HyperTransport Interrupts
  • `PCH-PIC/PCH-MSI`: Loongson 7A1000 manual 5절 Interrupt Controller
  • `PCH-LPC`: Loongson 7A1000 manual 24.3절 LPC Interrupts