LoongArch Linux Patches Enable KVM Virtualization
While LoongArch merged for Linux 5.19 last year, that initial kernel port to the Chinese CPU architecture wasn't entirely complete and some Loongson 3A5000 features are still being enabled for the mainline kernel. The latest feature work being carried out by Loongson engineers is for supporting hardware virtualization on the 3A5000 processors with KVM.
Sent out on Tuesday were the initial 24 patches for getting KVM LoongArch support started. Loongson engineer Tianrui Zhao explained in the patch series:
"This series adds KVM LoongArch support. Loongson 3A5000 supports hardware assisted virtualization. With cpu virtualization, there are separate hw-supported user mode and kernel mode in guest mode. With memory virtualization, there are two-level hw mmu table for guest mode and host mode. Also there is separate hw cpu timer with consant frequency in guest mode, so that vm can migrate between hosts with different freq. Currently, we are able to boot LoongArch Linux Guests.
Few key aspects of KVM LoongArch added by this series are:
1. Enable kvm hardware function when kvm module is loaded.
2. Implement VM and vcpu related ioctl interface such as vcpu create, vcpu run etc. GET_ONE_REG/SET_ONE_REG ioctl commands are use to get general registers one by one; KVM_GET_CSRS can be used to get system registers with batch mode similar with KVM_GET_MSRS in x86.
3. Hardware access about MMU, timer and csr are emulated in kernel.
4. Hardwares such as mmio and iocsr device are emulated in user space such as APIC, IPI, pci devices etc."
Along with these LoongArch KVM patches now under review, Loongson is also maintaining a fork of QEMU for the moment with their LoongArch support there as well as a modified TianoCore UEFI BIOS for booting.
More details on the LoongArch KVM support via the v1 patch series.
Add A Comment