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

4 views
Skip to first unread message

Thomas Hellström (VMware)

unread,
Oct 18, 2019, 9:41:09 AM10/18/19
to linux-...@vger.kernel.org, Thomas Hellstrom, Sami Tolvanen, clang-bu...@googlegroups.com, H. Peter Anvin, Ingo Molnar, Thomas Gleixner, x86-ml, Borislav Petkov
From: Thomas Hellstrom <thell...@vmware.com>

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 <samito...@google.com>
Signed-off-by: Thomas Hellstrom <thell...@vmware.com>
Cc: clang-bu...@googlegroups.com
Cc: "H. Peter Anvin" <h...@zytor.com>
Cc: Ingo Molnar <mi...@redhat.com>
Cc: Thomas Gleixner <tg...@linutronix.de>
Cc: x86-ml <x...@kernel.org>
Cc: Borislav Petkov <b...@suse.de>
---
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", \
"vmcall", X86_FEATURE_VMCALL, \
"vmmcall", X86_FEATURE_VMW_VMMCALL)

--
2.21.0

Nick Desaulniers

unread,
Oct 18, 2019, 12:29:11 PM10/18/19
to Thomas Hellström (VMware), LKML, Thomas Hellstrom, Sami Tolvanen, clang-built-linux, H. Peter Anvin, Ingo Molnar, Thomas Gleixner, x86-ml, Borislav Petkov
On Fri, Oct 18, 2019 at 6:41 AM Thomas Hellström (VMware)
<thom...@shipmail.org> wrote:
>
> From: Thomas Hellstrom <thell...@vmware.com>
>
> 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 <samito...@google.com>
> Signed-off-by: Thomas Hellstrom <thell...@vmware.com>

Thank you for the patch.
Reviewed-by: Nick Desaulniers <ndesau...@google.com>

> Cc: clang-bu...@googlegroups.com
> Cc: "H. Peter Anvin" <h...@zytor.com>
> Cc: Ingo Molnar <mi...@redhat.com>
> Cc: Thomas Gleixner <tg...@linutronix.de>
> Cc: x86-ml <x...@kernel.org>
> Cc: Borislav Petkov <b...@suse.de>
> ---
> 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", \
> "vmcall", X86_FEATURE_VMCALL, \
> "vmmcall", X86_FEATURE_VMW_VMMCALL)
>
> --
> 2.21.0
>
> --
> You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-li...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20191018134052.3023-2-thomas_os%40shipmail.org.



--
Thanks,
~Nick Desaulniers

Sean Christopherson

unread,
Oct 18, 2019, 12:33:27 PM10/18/19
to Thomas Hellström (VMware), linux-...@vger.kernel.org, Thomas Hellstrom, Sami Tolvanen, clang-bu...@googlegroups.com, H. Peter Anvin, Ingo Molnar, Thomas Gleixner, x86-ml, Borislav Petkov
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", \

Thomas Hellström (VMware)

unread,
Oct 21, 2019, 1:24:19 PM10/21/19
to linux-...@vger.kernel.org, Sean Christopherson, Thomas Hellstrom, clang-bu...@googlegroups.com, H. Peter Anvin, Ingo Molnar, Thomas Gleixner, x86-ml, Borislav Petkov, Sami Tolvanen, Nick Desaulniers
From: Thomas Hellstrom <thell...@vmware.com>

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.

Cc: clang-bu...@googlegroups.com
Cc: "H. Peter Anvin" <h...@zytor.com>
Cc: Ingo Molnar <mi...@redhat.com>
Cc: Thomas Gleixner <tg...@linutronix.de>
Cc: x86-ml <x...@kernel.org>
Cc: Borislav Petkov <b...@suse.de>
Fixes: b4dd4f6e3648 ("Add a header file for hypercall definitions")
Suggested-by: Sami Tolvanen <samito...@google.com>
Signed-off-by: Thomas Hellstrom <thell...@vmware.com>
Reviewed-by: Nick Desaulniers <ndesau...@google.com>
---
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..3caac90f9761 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", \

tip-bot2 for Thomas Hellstrom

unread,
Oct 21, 2019, 6:56:41 PM10/21/19
to linux-ti...@vger.kernel.org, Sami Tolvanen, Thomas Hellstrom, Nick Desaulniers, Borislav Petkov, H. Peter Anvin, Linus Torvalds, Peter Zijlstra, Sean Christopherson, Thomas Gleixner, clang-bu...@googlegroups.com, Ingo Molnar, Borislav Petkov, linux-...@vger.kernel.org
The following commit has been merged into the x86/urgent branch of tip:

Commit-ID: db633a4e0e6eda69b6065e3e106f9ea13a0676c3
Gitweb: https://git.kernel.org/tip/db633a4e0e6eda69b6065e3e106f9ea13a0676c3
Author: Thomas Hellstrom <thell...@vmware.com>
AuthorDate: Mon, 21 Oct 2019 19:24:02 +02:00
Committer: Ingo Molnar <mi...@kernel.org>
CommitterDate: Tue, 22 Oct 2019 00:51:44 +02:00

x86/cpu/vmware: Use the full form of INL in VMWARE_HYPERCALL, for clang/llvm

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.

Suggested-by: Sami Tolvanen <samito...@google.com>
Signed-off-by: Thomas Hellstrom <thell...@vmware.com>
Reviewed-by: Nick Desaulniers <ndesau...@google.com>
Cc: Borislav Petkov <b...@suse.de>
Cc: H. Peter Anvin <h...@zytor.com>
Cc: Linus Torvalds <torv...@linux-foundation.org>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Sean Christopherson <sean.j.chr...@intel.com>
Cc: Thomas Gleixner <tg...@linutronix.de>
Cc: clang-bu...@googlegroups.com
Fixes: b4dd4f6e3648 ("Add a header file for hypercall definitions")
Link: https://lkml.kernel.org/r/20191021172403....@shipmail.org
Signed-off-by: Ingo Molnar <mi...@kernel.org>
---
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 e00c9e8..3caac90 100644
Reply all
Reply to author
Forward
0 new messages