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

From: Zack Rusin

Date: Tue Nov 17 2026 - 16:45:04 EST


On Thu, Nov 12, 2026 at 1:53 PM Jim Mattson <jmattson@xxxxxxxxxx> wrote:
>
> 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.

I meant the native instruction only. When the hypercall backdoor is
enabled, we advertise VMCALL to Intel guests and VMMCALL to AMD guests
in CPUID leaf 0x40000010, ECX. You're right about #GP(0) for VMCALL
at CPL > 0 on AMD. I'll clarify the commit message and API docs.

z

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature