Currently, use hypercall instruction in guest cpl3 would just skip the instruction, however, that behaviour could trigger a exception in Linux host. It is reasonable for hypervisor to inject a exception, especially in nested guest, L1 guest could behaviour like host. As for hypercall instruction emulation, hypervisor would replace the wrong instruction with the right instruction instead of the real instruction emulation. It's guest's responsibility to use the right instruction, hypervisor could emulate it but shouldn't modify it without guest's request. At present, Linux guest could use alternative to choose right instruction, and hyperv guest could use hypercall to modify instruction. So just do the real instruction emualtion job for em_hypercall(). Hou Wenlong (3): kvm: x86: Introduce hypercall x86 ops for handling hypercall not in cpl0 kvm: x86: Refactor kvm_emulate_hypercall() to no skip instruction kvm: x86: Emulate hypercall instead of fixing hypercall instruction arch/x86/include/asm/kvm-x86-ops.h | 1 + arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/emulate.c | 20 +++++------ arch/x86/kvm/kvm_emulate.h | 2 +- arch/x86/kvm/svm/svm.c | 5 +++ arch/x86/kvm/vmx/vmx.c | 9 +++++ arch/x86/kvm/x86.c | 55 +++++++++++++++++------------- 7 files changed, 58 insertions(+), 35 deletions(-) -- 2.31.1