LoongArch CPU Support Merged For Linux 5.19 - But It Won't Work For A Booting System Yet

Written by Michael Larabel in Linux Kernel on 3 June 2022 at 07:27 PM EDT. 6 Comments
LINUX KERNEL
Following a mad dash this week to get the LoongArch CPU architecture support readied for Linux 5.19, Linus Torvalds successfully merged this MIPS64-inspired Chinese architecture code today into the mainline kernel. However, due to some of the code not yet passing review, while the CPU architecture code is in place some crucial drivers have yet to land and thus Linux 5.19 cannot boot on said hardware.

In case you missed all my prior articles on LoongArch, this is a CPU architecture developed by Loongson that has long been known for their MIPS64-based systems. But with the MIPS64 architecture upstream being effectively dead, the Chinese company set out to develop their own ISA. LoongArch is described as being inspired by MIPS64 and RISC-V and some of the LoongArch kernel code is in fact re-using or closely duplicating existing MIPS code.


Earlier this year LoongArch was added to GCC 12 as the main system compiler. Current generation Loongson 3A5000 CPU performance isn't too enticing at this stage compared to other Arm or RISC-V designs. We'll see though how this Chinese domestic CPU architecture evolves in the years to come.

As written about earlier this week, there was pressure to get LoongArch into Linux 5.19 even if it meant not being able to boot the system. Developers wanted to get the CPU architecture code mainlined so it frees them up to being able to submit the LoongArch support code for the GNU C Library (Glibc). Mainlining their Glibc target first required having the kernel support settled down with a solid user-space ABI. But due to Glibc 2.38 expected in August, LoongArch needed to be merged for Linux 5.19 to allow sufficient time for that release to happen in July and getting the Glibc LoongArch code over the finish line for that next release.

Getting LoongArch merged now also reduces the maintenance burden for any tree-wide changes that may come in Linux 5.20, etc.

So the majority of the LoongArch code was merged for Linux 5.19 but missing is some of the EFI code needed for booting, the IRQ drivers are shared with Linux's MIPS code but complications there mean that isn't yet ready for use, and the PCI Loongson code needs to be modified and merged through the PCI subsystem area.

The LoongArch merge is 21k lines of new code for the kernel, not counting the yet to land required drivers. Presumably by the time of the Linux 5.20 kernel cycle later this summer the rest of the required driver support will pass review to yield a bootable LoongArch system.

It was just four years ago that prominent Linux kernel developer Arnd Bergmann predicted C-SKY would be "the last new CPU architecture we ever add to the kernel." C-SKY is another Chinese architecture and the thought at the time was all future CPU work would be going RISC-V, but now it turns out LoongArch perhaps will be the last new CPU architecture added to the Linux kernel.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week