Re: [PATCH 1/2] x86/cpu/vmware: Use the full form of INL in VMWARE_HYPERCALL

From: Sean Christopherson
Date: Fri Oct 18 2019 - 12:33:36 EST


On Fri, Oct 18, 2019 at 03:40:51PM +0200, Thomas Hellström (VMware) wrote:
> From: Thomas Hellstrom <thellstrom@xxxxxxxxxx>
>
> LLVM's assembler doesn't accept the short form INL instruction:
>
> inl (%%dx)
>
> but instead insists on the output register to be explicitly specified.
>
> This was previously fixed for the VMWARE_PORT macro. Fix it also for
> the VMWARE_HYPERCALL macro.
>
> Fixes: b4dd4f6e3648 ("Add a header file for hypercall definitions")
> Suggested-by: Sami Tolvanen <samitolvanen@xxxxxxxxxx>
> Signed-off-by: Thomas Hellstrom <thellstrom@xxxxxxxxxx>
> Cc: clang-built-linux@xxxxxxxxxxxxxxxx
> Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Cc: x86-ml <x86@xxxxxxxxxx>
> Cc: Borislav Petkov <bp@xxxxxxx>
> ---
> arch/x86/include/asm/vmware.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/include/asm/vmware.h b/arch/x86/include/asm/vmware.h
> index e00c9e875933..f5fbe3778aef 100644
> --- a/arch/x86/include/asm/vmware.h
> +++ b/arch/x86/include/asm/vmware.h
> @@ -29,7 +29,8 @@
>
> /* The low bandwidth call. The low word of edx is presumed clear. */
> #define VMWARE_HYPERCALL \
> - ALTERNATIVE_2("movw $" VMWARE_HYPERVISOR_PORT ", %%dx; inl (%%dx)", \
> + ALTERNATIVE_2("movw $" VMWARE_HYPERVISOR_PORT \
> + ", %%dx; inl (%%dx), %%eax", \

Why wrap in the middle of movw? Wrapping between instructions or letting
the line poke out is more readable IMO, e.g.

ALTERNATIVE_2("movw $" VMWARE_HYPERVISOR_PORT ", %%dx; " \
"inl (%%dx), %%eax", \

or

ALTERNATIVE_2("movw $" VMWARE_HYPERVISOR_PORT ", %%dx; inl (%%dx), %%eax", \

> "vmcall", X86_FEATURE_VMCALL, \
> "vmmcall", X86_FEATURE_VMW_VMMCALL)
>
> --
> 2.21.0
>