LoongArch: KVM: Add hypercall service support for usermode VMM

Some VMMs provides special hypercall service in usermode, KVM should not
handle the usermode hypercall service, thus pass it to usermode, let the
usermode VMM handle it.

Here a new code KVM_HCALL_CODE_USER_SERVICE is added for the user-mode
hypercall service, KVM lets all six registers visible to usermode VMM.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
This commit is contained in:
Bibo Mao
2025-01-13 21:37:17 +08:00
committed by Huacai Chen
parent 4d38d0416e
commit 2737dee106
6 changed files with 42 additions and 1 deletions

View File

@@ -1732,9 +1732,14 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
vcpu->mmio_needed = 0;
}
if (run->exit_reason == KVM_EXIT_LOONGARCH_IOCSR) {
switch (run->exit_reason) {
case KVM_EXIT_HYPERCALL:
kvm_complete_user_service(vcpu, run);
break;
case KVM_EXIT_LOONGARCH_IOCSR:
if (!run->iocsr_io.is_write)
kvm_complete_iocsr_read(vcpu, run);
break;
}
if (!vcpu->wants_to_run)