Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Documentation: LoongArch: Add basic documentations

Add some basic documentation for LoongArch. LoongArch is a new RISC ISA,
which is a bit like MIPS or RISC-V. LoongArch includes a reduced 32-bit
version (LA32R), a standard 32-bit version (LA32S) and a 64-bit version
(LA64).

Tested-by: Bagas Sanjaya <bagasdotme@gmail.com>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Co-developed-by: WANG Xuerui <git@xen0n.name>
Signed-off-by: WANG Xuerui <git@xen0n.name>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>

+568
+1
Documentation/arch.rst
··· 13 13 arm/index 14 14 arm64/index 15 15 ia64/index 16 + loongarch/index 16 17 m68k/index 17 18 mips/index 18 19 nios2/index
+3
Documentation/loongarch/features.rst
··· 1 + .. SPDX-License-Identifier: GPL-2.0 2 + 3 + .. kernel-feat:: $srctree/Documentation/features loongarch
+21
Documentation/loongarch/index.rst
··· 1 + .. SPDX-License-Identifier: GPL-2.0 2 + 3 + ====================== 4 + LoongArch Architecture 5 + ====================== 6 + 7 + .. toctree:: 8 + :maxdepth: 2 9 + :numbered: 10 + 11 + introduction 12 + irq-chip-model 13 + 14 + features 15 + 16 + .. only:: subproject and html 17 + 18 + Indices 19 + ======= 20 + 21 + * :ref:`genindex`
+387
Documentation/loongarch/introduction.rst
··· 1 + .. SPDX-License-Identifier: GPL-2.0 2 + 3 + ========================= 4 + Introduction to LoongArch 5 + ========================= 6 + 7 + LoongArch is a new RISC ISA, which is a bit like MIPS or RISC-V. There are 8 + currently 3 variants: a reduced 32-bit version (LA32R), a standard 32-bit 9 + version (LA32S) and a 64-bit version (LA64). There are 4 privilege levels 10 + (PLVs) defined in LoongArch: PLV0~PLV3, from high to low. Kernel runs at PLV0 11 + while applications run at PLV3. This document introduces the registers, basic 12 + instruction set, virtual memory and some other topics of LoongArch. 13 + 14 + Registers 15 + ========= 16 + 17 + LoongArch registers include general purpose registers (GPRs), floating point 18 + registers (FPRs), vector registers (VRs) and control status registers (CSRs) 19 + used in privileged mode (PLV0). 20 + 21 + GPRs 22 + ---- 23 + 24 + LoongArch has 32 GPRs ( ``$r0`` ~ ``$r31`` ); each one is 32-bit wide in LA32 25 + and 64-bit wide in LA64. ``$r0`` is hard-wired to zero, and the other registers 26 + are not architecturally special. (Except ``$r1``, which is hard-wired as the 27 + link register of the BL instruction.) 28 + 29 + The kernel uses a variant of the LoongArch register convention, as described in 30 + the LoongArch ELF psABI spec, in :ref:`References <loongarch-references>`: 31 + 32 + ================= =============== =================== ============ 33 + Name Alias Usage Preserved 34 + across calls 35 + ================= =============== =================== ============ 36 + ``$r0`` ``$zero`` Constant zero Unused 37 + ``$r1`` ``$ra`` Return address No 38 + ``$r2`` ``$tp`` TLS/Thread pointer Unused 39 + ``$r3`` ``$sp`` Stack pointer Yes 40 + ``$r4``-``$r11`` ``$a0``-``$a7`` Argument registers No 41 + ``$r4``-``$r5`` ``$v0``-``$v1`` Return value No 42 + ``$r12``-``$r20`` ``$t0``-``$t8`` Temp registers No 43 + ``$r21`` ``$u0`` Percpu base address Unused 44 + ``$r22`` ``$fp`` Frame pointer Yes 45 + ``$r23``-``$r31`` ``$s0``-``$s8`` Static registers Yes 46 + ================= =============== =================== ============ 47 + 48 + Note: The register ``$r21`` is reserved in the ELF psABI, but used by the Linux 49 + kernel for storing the percpu base address. It normally has no ABI name, but is 50 + called ``$u0`` in the kernel. You may also see ``$v0`` or ``$v1`` in some old code, 51 + however they are deprecated aliases of ``$a0`` and ``$a1`` respectively. 52 + 53 + FPRs 54 + ---- 55 + 56 + LoongArch has 32 FPRs ( ``$f0`` ~ ``$f31`` ) when FPU is present. Each one is 57 + 64-bit wide on the LA64 cores. 58 + 59 + The floating-point register convention is the same as described in the 60 + LoongArch ELF psABI spec: 61 + 62 + ================= ================== =================== ============ 63 + Name Alias Usage Preserved 64 + across calls 65 + ================= ================== =================== ============ 66 + ``$f0``-``$f7`` ``$fa0``-``$fa7`` Argument registers No 67 + ``$f0``-``$f1`` ``$fv0``-``$fv1`` Return value No 68 + ``$f8``-``$f23`` ``$ft0``-``$ft15`` Temp registers No 69 + ``$f24``-``$f31`` ``$fs0``-``$fs7`` Static registers Yes 70 + ================= ================== =================== ============ 71 + 72 + Note: You may see ``$fv0`` or ``$fv1`` in some old code, however they are deprecated 73 + aliases of ``$fa0`` and ``$fa1`` respectively. 74 + 75 + VRs 76 + ---- 77 + 78 + There are currently 2 vector extensions to LoongArch: 79 + 80 + - LSX (Loongson SIMD eXtension) with 128-bit vectors, 81 + - LASX (Loongson Advanced SIMD eXtension) with 256-bit vectors. 82 + 83 + LSX brings ``$v0`` ~ ``$v31`` while LASX brings ``$x0`` ~ ``$x31`` as the vector 84 + registers. 85 + 86 + The VRs overlap with FPRs: for example, on a core implementing LSX and LASX, 87 + the lower 128 bits of ``$x0`` is shared with ``$v0``, and the lower 64 bits of 88 + ``$v0`` is shared with ``$f0``; same with all other VRs. 89 + 90 + CSRs 91 + ---- 92 + 93 + CSRs can only be accessed from privileged mode (PLV0): 94 + 95 + ================= ===================================== ============== 96 + Address Full Name Abbrev Name 97 + ================= ===================================== ============== 98 + 0x0 Current Mode Information CRMD 99 + 0x1 Pre-exception Mode Information PRMD 100 + 0x2 Extension Unit Enable EUEN 101 + 0x3 Miscellaneous Control MISC 102 + 0x4 Exception Configuration ECFG 103 + 0x5 Exception Status ESTAT 104 + 0x6 Exception Return Address ERA 105 + 0x7 Bad (Faulting) Virtual Address BADV 106 + 0x8 Bad (Faulting) Instruction Word BADI 107 + 0xC Exception Entrypoint Address EENTRY 108 + 0x10 TLB Index TLBIDX 109 + 0x11 TLB Entry High-order Bits TLBEHI 110 + 0x12 TLB Entry Low-order Bits 0 TLBELO0 111 + 0x13 TLB Entry Low-order Bits 1 TLBELO1 112 + 0x18 Address Space Identifier ASID 113 + 0x19 Page Global Directory Address for PGDL 114 + Lower-half Address Space 115 + 0x1A Page Global Directory Address for PGDH 116 + Higher-half Address Space 117 + 0x1B Page Global Directory Address PGD 118 + 0x1C Page Walk Control for Lower- PWCL 119 + half Address Space 120 + 0x1D Page Walk Control for Higher- PWCH 121 + half Address Space 122 + 0x1E STLB Page Size STLBPS 123 + 0x1F Reduced Virtual Address Configuration RVACFG 124 + 0x20 CPU Identifier CPUID 125 + 0x21 Privileged Resource Configuration 1 PRCFG1 126 + 0x22 Privileged Resource Configuration 2 PRCFG2 127 + 0x23 Privileged Resource Configuration 3 PRCFG3 128 + 0x30+n (0≤n≤15) Saved Data register SAVEn 129 + 0x40 Timer Identifier TID 130 + 0x41 Timer Configuration TCFG 131 + 0x42 Timer Value TVAL 132 + 0x43 Compensation of Timer Count CNTC 133 + 0x44 Timer Interrupt Clearing TICLR 134 + 0x60 LLBit Control LLBCTL 135 + 0x80 Implementation-specific Control 1 IMPCTL1 136 + 0x81 Implementation-specific Control 2 IMPCTL2 137 + 0x88 TLB Refill Exception Entrypoint TLBRENTRY 138 + Address 139 + 0x89 TLB Refill Exception BAD (Faulting) TLBRBADV 140 + Virtual Address 141 + 0x8A TLB Refill Exception Return Address TLBRERA 142 + 0x8B TLB Refill Exception Saved Data TLBRSAVE 143 + Register 144 + 0x8C TLB Refill Exception Entry Low-order TLBRELO0 145 + Bits 0 146 + 0x8D TLB Refill Exception Entry Low-order TLBRELO1 147 + Bits 1 148 + 0x8E TLB Refill Exception Entry High-order TLBEHI 149 + Bits 150 + 0x8F TLB Refill Exception Pre-exception TLBRPRMD 151 + Mode Information 152 + 0x90 Machine Error Control MERRCTL 153 + 0x91 Machine Error Information 1 MERRINFO1 154 + 0x92 Machine Error Information 2 MERRINFO2 155 + 0x93 Machine Error Exception Entrypoint MERRENTRY 156 + Address 157 + 0x94 Machine Error Exception Return MERRERA 158 + Address 159 + 0x95 Machine Error Exception Saved Data MERRSAVE 160 + Register 161 + 0x98 Cache TAGs CTAG 162 + 0x180+n (0≤n≤3) Direct Mapping Configuration Window n DMWn 163 + 0x200+2n (0≤n≤31) Performance Monitor Configuration n PMCFGn 164 + 0x201+2n (0≤n≤31) Performance Monitor Overall Counter n PMCNTn 165 + 0x300 Memory Load/Store WatchPoint MWPC 166 + Overall Control 167 + 0x301 Memory Load/Store WatchPoint MWPS 168 + Overall Status 169 + 0x310+8n (0≤n≤7) Memory Load/Store WatchPoint n MWPnCFG1 170 + Configuration 1 171 + 0x311+8n (0≤n≤7) Memory Load/Store WatchPoint n MWPnCFG2 172 + Configuration 2 173 + 0x312+8n (0≤n≤7) Memory Load/Store WatchPoint n MWPnCFG3 174 + Configuration 3 175 + 0x313+8n (0≤n≤7) Memory Load/Store WatchPoint n MWPnCFG4 176 + Configuration 4 177 + 0x380 Instruction Fetch WatchPoint FWPC 178 + Overall Control 179 + 0x381 Instruction Fetch WatchPoint FWPS 180 + Overall Status 181 + 0x390+8n (0≤n≤7) Instruction Fetch WatchPoint n FWPnCFG1 182 + Configuration 1 183 + 0x391+8n (0≤n≤7) Instruction Fetch WatchPoint n FWPnCFG2 184 + Configuration 2 185 + 0x392+8n (0≤n≤7) Instruction Fetch WatchPoint n FWPnCFG3 186 + Configuration 3 187 + 0x393+8n (0≤n≤7) Instruction Fetch WatchPoint n FWPnCFG4 188 + Configuration 4 189 + 0x500 Debug Register DBG 190 + 0x501 Debug Exception Return Address DERA 191 + 0x502 Debug Exception Saved Data Register DSAVE 192 + ================= ===================================== ============== 193 + 194 + ERA, TLBRERA, MERRERA and DERA are sometimes also known as EPC, TLBREPC, MERREPC 195 + and DEPC respectively. 196 + 197 + Basic Instruction Set 198 + ===================== 199 + 200 + Instruction formats 201 + ------------------- 202 + 203 + LoongArch instructions are 32 bits wide, belonging to 9 basic instruction 204 + formats (and variants of them): 205 + 206 + =========== ========================== 207 + Format name Composition 208 + =========== ========================== 209 + 2R Opcode + Rj + Rd 210 + 3R Opcode + Rk + Rj + Rd 211 + 4R Opcode + Ra + Rk + Rj + Rd 212 + 2RI8 Opcode + I8 + Rj + Rd 213 + 2RI12 Opcode + I12 + Rj + Rd 214 + 2RI14 Opcode + I14 + Rj + Rd 215 + 2RI16 Opcode + I16 + Rj + Rd 216 + 1RI21 Opcode + I21L + Rj + I21H 217 + I26 Opcode + I26L + I26H 218 + =========== ========================== 219 + 220 + Rd is the destination register operand, while Rj, Rk and Ra ("a" stands for 221 + "additional") are the source register operands. I8/I12/I16/I21/I26 are 222 + immediate operands of respective width. The longer I21 and I26 are stored 223 + in separate higher and lower parts in the instruction word, denoted by the "L" 224 + and "H" suffixes. 225 + 226 + List of Instructions 227 + -------------------- 228 + 229 + For brevity, only instruction names (mnemonics) are listed here; please see the 230 + :ref:`References <loongarch-references>` for details. 231 + 232 + 233 + 1. Arithmetic Instructions:: 234 + 235 + ADD.W SUB.W ADDI.W ADD.D SUB.D ADDI.D 236 + SLT SLTU SLTI SLTUI 237 + AND OR NOR XOR ANDN ORN ANDI ORI XORI 238 + MUL.W MULH.W MULH.WU DIV.W DIV.WU MOD.W MOD.WU 239 + MUL.D MULH.D MULH.DU DIV.D DIV.DU MOD.D MOD.DU 240 + PCADDI PCADDU12I PCADDU18I 241 + LU12I.W LU32I.D LU52I.D ADDU16I.D 242 + 243 + 2. Bit-shift Instructions:: 244 + 245 + SLL.W SRL.W SRA.W ROTR.W SLLI.W SRLI.W SRAI.W ROTRI.W 246 + SLL.D SRL.D SRA.D ROTR.D SLLI.D SRLI.D SRAI.D ROTRI.D 247 + 248 + 3. Bit-manipulation Instructions:: 249 + 250 + EXT.W.B EXT.W.H CLO.W CLO.D SLZ.W CLZ.D CTO.W CTO.D CTZ.W CTZ.D 251 + BYTEPICK.W BYTEPICK.D BSTRINS.W BSTRINS.D BSTRPICK.W BSTRPICK.D 252 + REVB.2H REVB.4H REVB.2W REVB.D REVH.2W REVH.D BITREV.4B BITREV.8B BITREV.W BITREV.D 253 + MASKEQZ MASKNEZ 254 + 255 + 4. Branch Instructions:: 256 + 257 + BEQ BNE BLT BGE BLTU BGEU BEQZ BNEZ B BL JIRL 258 + 259 + 5. Load/Store Instructions:: 260 + 261 + LD.B LD.BU LD.H LD.HU LD.W LD.WU LD.D ST.B ST.H ST.W ST.D 262 + LDX.B LDX.BU LDX.H LDX.HU LDX.W LDX.WU LDX.D STX.B STX.H STX.W STX.D 263 + LDPTR.W LDPTR.D STPTR.W STPTR.D 264 + PRELD PRELDX 265 + 266 + 6. Atomic Operation Instructions:: 267 + 268 + LL.W SC.W LL.D SC.D 269 + AMSWAP.W AMSWAP.D AMADD.W AMADD.D AMAND.W AMAND.D AMOR.W AMOR.D AMXOR.W AMXOR.D 270 + AMMAX.W AMMAX.D AMMIN.W AMMIN.D 271 + 272 + 7. Barrier Instructions:: 273 + 274 + IBAR DBAR 275 + 276 + 8. Special Instructions:: 277 + 278 + SYSCALL BREAK CPUCFG NOP IDLE ERTN(ERET) DBCL(DBGCALL) RDTIMEL.W RDTIMEH.W RDTIME.D 279 + ASRTLE.D ASRTGT.D 280 + 281 + 9. Privileged Instructions:: 282 + 283 + CSRRD CSRWR CSRXCHG 284 + IOCSRRD.B IOCSRRD.H IOCSRRD.W IOCSRRD.D IOCSRWR.B IOCSRWR.H IOCSRWR.W IOCSRWR.D 285 + CACOP TLBP(TLBSRCH) TLBRD TLBWR TLBFILL TLBCLR TLBFLUSH INVTLB LDDIR LDPTE 286 + 287 + Virtual Memory 288 + ============== 289 + 290 + LoongArch supports direct-mapped virtual memory and page-mapped virtual memory. 291 + 292 + Direct-mapped virtual memory is configured by CSR.DMWn (n=0~3), it has a simple 293 + relationship between virtual address (VA) and physical address (PA):: 294 + 295 + VA = PA + FixedOffset 296 + 297 + Page-mapped virtual memory has arbitrary relationship between VA and PA, which 298 + is recorded in TLB and page tables. LoongArch's TLB includes a fully-associative 299 + MTLB (Multiple Page Size TLB) and set-associative STLB (Single Page Size TLB). 300 + 301 + By default, the whole virtual address space of LA32 is configured like this: 302 + 303 + ============ =========================== ============================= 304 + Name Address Range Attributes 305 + ============ =========================== ============================= 306 + ``UVRANGE`` ``0x00000000 - 0x7FFFFFFF`` Page-mapped, Cached, PLV0~3 307 + ``KPRANGE0`` ``0x80000000 - 0x9FFFFFFF`` Direct-mapped, Uncached, PLV0 308 + ``KPRANGE1`` ``0xA0000000 - 0xBFFFFFFF`` Direct-mapped, Cached, PLV0 309 + ``KVRANGE`` ``0xC0000000 - 0xFFFFFFFF`` Page-mapped, Cached, PLV0 310 + ============ =========================== ============================= 311 + 312 + User mode (PLV3) can only access UVRANGE. For direct-mapped KPRANGE0 and 313 + KPRANGE1, PA is equal to VA with bit30~31 cleared. For example, the uncached 314 + direct-mapped VA of 0x00001000 is 0x80001000, and the cached direct-mapped 315 + VA of 0x00001000 is 0xA0001000. 316 + 317 + By default, the whole virtual address space of LA64 is configured like this: 318 + 319 + ============ ====================== ====================================== 320 + Name Address Range Attributes 321 + ============ ====================== ====================================== 322 + ``XUVRANGE`` ``0x0000000000000000 - Page-mapped, Cached, PLV0~3 323 + 0x3FFFFFFFFFFFFFFF`` 324 + ``XSPRANGE`` ``0x4000000000000000 - Direct-mapped, Cached / Uncached, PLV0 325 + 0x7FFFFFFFFFFFFFFF`` 326 + ``XKPRANGE`` ``0x8000000000000000 - Direct-mapped, Cached / Uncached, PLV0 327 + 0xBFFFFFFFFFFFFFFF`` 328 + ``XKVRANGE`` ``0xC000000000000000 - Page-mapped, Cached, PLV0 329 + 0xFFFFFFFFFFFFFFFF`` 330 + ============ ====================== ====================================== 331 + 332 + User mode (PLV3) can only access XUVRANGE. For direct-mapped XSPRANGE and 333 + XKPRANGE, PA is equal to VA with bits 60~63 cleared, and the cache attribute 334 + is configured by bits 60~61 in VA: 0 is for strongly-ordered uncached, 1 is 335 + for coherent cached, and 2 is for weakly-ordered uncached. 336 + 337 + Currently we only use XKPRANGE for direct mapping and XSPRANGE is reserved. 338 + 339 + To put this in action: the strongly-ordered uncached direct-mapped VA (in 340 + XKPRANGE) of 0x00000000_00001000 is 0x80000000_00001000, the coherent cached 341 + direct-mapped VA (in XKPRANGE) of 0x00000000_00001000 is 0x90000000_00001000, 342 + and the weakly-ordered uncached direct-mapped VA (in XKPRANGE) of 0x00000000 343 + _00001000 is 0xA0000000_00001000. 344 + 345 + Relationship of Loongson and LoongArch 346 + ====================================== 347 + 348 + LoongArch is a RISC ISA which is different from any other existing ones, while 349 + Loongson is a family of processors. Loongson includes 3 series: Loongson-1 is 350 + the 32-bit processor series, Loongson-2 is the low-end 64-bit processor series, 351 + and Loongson-3 is the high-end 64-bit processor series. Old Loongson is based on 352 + MIPS, while New Loongson is based on LoongArch. Take Loongson-3 as an example: 353 + Loongson-3A1000/3B1500/3A2000/3A3000/3A4000 are MIPS-compatible, while Loongson- 354 + 3A5000 (and future revisions) are all based on LoongArch. 355 + 356 + .. _loongarch-references: 357 + 358 + References 359 + ========== 360 + 361 + Official web site of Loongson Technology Corp. Ltd.: 362 + 363 + http://www.loongson.cn/ 364 + 365 + Developer web site of Loongson and LoongArch (Software and Documentation): 366 + 367 + http://www.loongnix.cn/ 368 + 369 + https://github.com/loongson/ 370 + 371 + https://loongson.github.io/LoongArch-Documentation/ 372 + 373 + Documentation of LoongArch ISA: 374 + 375 + https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-Vol1-v1.00-CN.pdf (in Chinese) 376 + 377 + https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-Vol1-v1.00-EN.pdf (in English) 378 + 379 + Documentation of LoongArch ELF psABI: 380 + 381 + https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-ELF-ABI-v1.00-CN.pdf (in Chinese) 382 + 383 + https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-ELF-ABI-v1.00-EN.pdf (in English) 384 + 385 + Linux kernel repository of Loongson and LoongArch: 386 + 387 + https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson.git
+156
Documentation/loongarch/irq-chip-model.rst
··· 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 + ACPI-related definitions 89 + ======================== 90 + 91 + CPUINTC:: 92 + 93 + ACPI_MADT_TYPE_CORE_PIC; 94 + struct acpi_madt_core_pic; 95 + enum acpi_madt_core_pic_version; 96 + 97 + LIOINTC:: 98 + 99 + ACPI_MADT_TYPE_LIO_PIC; 100 + struct acpi_madt_lio_pic; 101 + enum acpi_madt_lio_pic_version; 102 + 103 + EIOINTC:: 104 + 105 + ACPI_MADT_TYPE_EIO_PIC; 106 + struct acpi_madt_eio_pic; 107 + enum acpi_madt_eio_pic_version; 108 + 109 + HTVECINTC:: 110 + 111 + ACPI_MADT_TYPE_HT_PIC; 112 + struct acpi_madt_ht_pic; 113 + enum acpi_madt_ht_pic_version; 114 + 115 + PCH-PIC:: 116 + 117 + ACPI_MADT_TYPE_BIO_PIC; 118 + struct acpi_madt_bio_pic; 119 + enum acpi_madt_bio_pic_version; 120 + 121 + PCH-MSI:: 122 + 123 + ACPI_MADT_TYPE_MSI_PIC; 124 + struct acpi_madt_msi_pic; 125 + enum acpi_madt_msi_pic_version; 126 + 127 + PCH-LPC:: 128 + 129 + ACPI_MADT_TYPE_LPC_PIC; 130 + struct acpi_madt_lpc_pic; 131 + enum acpi_madt_lpc_pic_version; 132 + 133 + References 134 + ========== 135 + 136 + Documentation of Loongson-3A5000: 137 + 138 + https://github.com/loongson/LoongArch-Documentation/releases/latest/download/Loongson-3A5000-usermanual-1.02-CN.pdf (in Chinese) 139 + 140 + https://github.com/loongson/LoongArch-Documentation/releases/latest/download/Loongson-3A5000-usermanual-1.02-EN.pdf (in English) 141 + 142 + Documentation of Loongson's LS7A chipset: 143 + 144 + https://github.com/loongson/LoongArch-Documentation/releases/latest/download/Loongson-7A1000-usermanual-2.00-CN.pdf (in Chinese) 145 + 146 + https://github.com/loongson/LoongArch-Documentation/releases/latest/download/Loongson-7A1000-usermanual-2.00-EN.pdf (in English) 147 + 148 + Note: CPUINTC is CSR.ECFG/CSR.ESTAT and its interrupt controller described 149 + in Section 7.4 of "LoongArch Reference Manual, Vol 1"; LIOINTC is "Legacy I/O 150 + Interrupts" described in Section 11.1 of "Loongson 3A5000 Processor Reference 151 + Manual"; EIOINTC is "Extended I/O Interrupts" described in Section 11.2 of 152 + "Loongson 3A5000 Processor Reference Manual"; HTVECINTC is "HyperTransport 153 + Interrupts" described in Section 14.3 of "Loongson 3A5000 Processor Reference 154 + Manual"; PCH-PIC/PCH-MSI is "Interrupt Controller" described in Section 5 of 155 + "Loongson 7A1000 Bridge User Manual"; PCH-LPC is "LPC Interrupts" described in 156 + Section 24.3 of "Loongson 7A1000 Bridge User Manual".