Re: [PATCH v3 06/12] KVM: x86: Forward VMware hypercalls to userspace

From: Jim Mattson

Date: Thu Nov 12 2026 - 14:19:48 EST


On Tue, Nov 10, 2026 at 10:05 PM Zack Rusin <zack.rusin@xxxxxxxxxxxx> wrote:
>
> Add KVM_VMWARE_ENABLE_HYPERCALL. When it is enabled, exit to userspace
> with KVM_EXIT_VMWARE when an L1 vCPU executes VMCALL or VMMCALL with
> VMware's magic value in EAX, and let userspace complete the call by
> updating the guest's registers or by having KVM inject #UD, #GP or #PF.

It's not clear to me if this paragraph implies that VMCALL and VMMCALL
are supported cross-vendor. If so, it may not be true.

In arch/x86/kvm/emulate.c, group7_rm0[1] (VMCALL) has the Priv flag
set. When an AMD guest executes VMCALL at CPL > 0, x86_emulate_insn()
sees Priv && cpl > 0 and injects #GP(0) before ever reaching
em_hypercall(). The other direction should be fine, since
group7_rm3[3] (VMMCALL) does not have the Priv flag set.

In any case, if cross-vendor hypercall instructions are supposed to be
supported, you should add them to the selftests.