History

Merge tag 'loongarch-kvm-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson into HEAD

LoongArch KVM changes for v6.7 Add LoongArch's KVM support. Loongson 3A5000/3A6000 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 IPI, irqchips, pci devices etc.

Paolo Bonzini committed 3 years ago

Commit ef12ea62 parents ffc2532 2c10cda27 files · +4902 −14Browse files

Showing the changes to include/uapi (1 of 27 files). Show all

Unified · Split

include/uapi/linux/kvm.h+9−0
@@ -264,6 +264,7 @@ struct kvm_xen_exit { · 263 unmodified lines
264#define KVM_EXIT_RISCV_SBI 35264#define KVM_EXIT_RISCV_SBI 35
265#define KVM_EXIT_RISCV_CSR 36265#define KVM_EXIT_RISCV_CSR 36
266#define KVM_EXIT_NOTIFY 37266#define KVM_EXIT_NOTIFY 37
267#define KVM_EXIT_LOONGARCH_IOCSR 38
267 268
268/* For KVM_EXIT_INTERNAL_ERROR */269/* For KVM_EXIT_INTERNAL_ERROR */
269/* Emulate instruction failed. */270/* Emulate instruction failed. */
@@ -336,6 +337,13 @@ struct kvm_run { · 66 unmodified lines
336 __u32 len;337 __u32 len;
337 __u8 is_write;338 __u8 is_write;
338 } mmio;339 } mmio;
340 /* KVM_EXIT_LOONGARCH_IOCSR */
341 struct {
342 __u64 phys_addr;
343 __u8 data[8];
344 __u32 len;
345 __u8 is_write;
346 } iocsr_io;
339 /* KVM_EXIT_HYPERCALL */347 /* KVM_EXIT_HYPERCALL */
340 struct {348 struct {
341 __u64 nr;349 __u64 nr;
@@ -1362,6 +1370,7 @@ struct kvm_dirty_tlb { · 1020 unmodified lines
1362#define KVM_REG_ARM64 0x6000000000000000ULL1370#define KVM_REG_ARM64 0x6000000000000000ULL
1363#define KVM_REG_MIPS 0x7000000000000000ULL1371#define KVM_REG_MIPS 0x7000000000000000ULL
1364#define KVM_REG_RISCV 0x8000000000000000ULL1372#define KVM_REG_RISCV 0x8000000000000000ULL
1373#define KVM_REG_LOONGARCH 0x9000000000000000ULL
1365 1374
1366#define KVM_REG_SIZE_SHIFT 521375#define KVM_REG_SIZE_SHIFT 52
1367#define KVM_REG_SIZE_MASK 0x00f0000000000000ULL1376#define KVM_REG_SIZE_MASK 0x00f0000000000000ULL

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t