Re: [PATCH v2 2/4] x86/vmware: Add a header file for hypercall definitions
From: Borislav Petkov
Date: Tue Aug 27 2019 - 15:54:59 EST
On Tue, Aug 27, 2019 at 09:19:03PM +0200, Thomas HellstrÃm (VMware) wrote:
> It should be correct. The flags VMWARE_HYPERVISOR_HB and
> VMWARE_HYPERVISOR_OUT are only valid for the vmcall / vmmcall versions.
> For the legacy version, the direction is toggled by the instruction (in vs
> out) and LB vs HB is toggled by the port number (0x5658 vs 0x5659)
> So in essence the low word definition of %edx is different in the two
> versions. I've chosen to use the new vmcall/vmmcall definition in the driver
Ah, ok, I see what you mean. The old method would overwrite the low word
of %edx but the new one would have the flags already prepared and *not*
overwrite them so all good.
Can you please document that more explicitly in the comment in
arch/x86/include/asm/vmware.h? Something like:
"... The new vmcall interface instead uses a set of flags to select
bandwidth mode and transfer direction. The set of flags is already
loaded into %edx by the macros which use VMWARE_HYPERCALL* and only when
the guest must use the old VMWARE_HYPERVISOR_PORT* method, the low word
is overwritten by the respective port number."
Anyway, something along those lines. We want to have the alternatives
code as clear and as transparent as possible because, well, of obvious
Good mailing practices for 400: avoid top-posting and trim the reply.