Re: [PING PATCH v4 00/29] Add KVM LoongArch support

From: Paolo Bonzini
Date: Tue Mar 28 2023 - 10:17:52 EST


On 3/28/23 14:30, Tianrui Zhao wrote:
Ping patch series, please help for reviewing the loongarch kvm patch
set. Thanks very much.

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.
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.

Please check Documentation/virtual/kvm/api.rst and document the loongarch-specific parts of the API, in particular ioctls that have architecture-specific semantics (KVM_GET/SET_ONE_REG, KVM_INTERRUPT) and vcpu->run fields.

Code-wise what I could understand looked okay, I only made a suggestion on the handling of idle; thanks for going through the previous review carefully.

Paolo