LoongArch: KVM: Add hypercall instruction emulation
authorBibo Mao <maobibo@loongson.cn>
Mon, 6 May 2024 14:00:46 +0000 (22:00 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Mon, 6 May 2024 14:00:46 +0000 (22:00 +0800)
commit372631bb62d3791f0122a67f5a3e959a4d99bebd
treeaca3159d80eacf27edfd3745fae958f22a292821
parent316863cb62fe7aaea30e7ef8e6481f1ba414b044
LoongArch: KVM: Add hypercall instruction emulation

On LoongArch system, there is a hypercall instruction special for
virtualization. When system executes this instruction on host side,
there is an illegal instruction exception reported, however it will
trap into host when it is executed in VM mode.

When hypercall is emulated, A0 register is set with value
KVM_HCALL_INVALID_CODE, rather than inject EXCCODE_INE invalid
instruction exception. So VM can continue to executing the next code.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/include/asm/Kbuild
arch/loongarch/include/asm/kvm_para.h [new file with mode: 0644]
arch/loongarch/kvm/exit.c