Skip to contentSkip to conversation

x86/cpu/vmware: use the full form of inl in VMWARE_PORT

PATCH Applied Sami Tolvanen 6 participants 10 messages Oct 7, 2019 – Oct 8, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/cpu/vmware: use the full form of inl in VMWARE_PORT

LLVM's assembler doesn't accept the short form inl (%%dx) instruction, but instead insists on the output register to be explicitly specified:

<inline asm>:1:7: error: invalid operand for instruction

          inl (%dx)
             ^

LLVM ERROR: Error parsing inline asm

Use the full form of the instruction to fix the build.

---
 arch/x86/kernel/cpu/vmware.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/vmware.c +1 -1
index 9735139cfdf8..46d732696c1c 100644
@@ -49,7 +49,7 @@
 #define VMWARE_CMD_VCPU_RESERVED 31
 
 #define VMWARE_PORT(cmd, eax, ebx, ecx, edx)				\
-	__asm__("inl (%%dx)" :						\
+	__asm__("inl (%%dx), %%eax" :					\
 		"=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) :		\
 		"a"(VMWARE_HYPERVISOR_MAGIC),				\
 		"c"(VMWARE_CMD_##cmd),					\
Signature · 1 line
2.23.0.581.g78d2f28ef7-goog
Acked-by Thomas Hellstrom on v1 1/1
#1 lore raw
Quoted 11 lines · Sami Tolvanen

LLVM's assembler doesn't accept the short form inl (%%dx) instruction, but instead insists on the output register to be explicitly specified:

<inline asm>:1:7: error: invalid operand for instruction

          inl (%dx)
             ^

LLVM ERROR: Error parsing inline asm

Use the full form of the instruction to fix the build.

Quoted 17 lines
---
 arch/x86/kernel/cpu/vmware.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/vmware.c +1 -1
index 9735139cfdf8..46d732696c1c 100644
@@ -49,7 +49,7 @@
 #define VMWARE_CMD_VCPU_RESERVED 31
 
 #define VMWARE_PORT(cmd, eax, ebx, ecx, edx)				\
-	__asm__("inl (%%dx)" :						\
+	__asm__("inl (%%dx), %%eax" :					\
 		"=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) :		\
 		"a"(VMWARE_HYPERVISOR_MAGIC),				\
 		"c"(VMWARE_CMD_##cmd),					\
Acked-by on v1 1/1
#2 lore raw
In reply to Sami Tolvanen
Quoted 11 lines · Sami Tolvanen

LLVM's assembler doesn't accept the short form inl (%%dx) instruction, but instead insists on the output register to be explicitly specified:

<inline asm>:1:7: error: invalid operand for instruction

          inl (%dx)
             ^

LLVM ERROR: Error parsing inline asm

Use the full form of the instruction to fix the build.

Quoted 17 lines
---
 arch/x86/kernel/cpu/vmware.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/vmware.c +1 -1
index 9735139cfdf8..46d732696c1c 100644
@@ -49,7 +49,7 @@
 #define VMWARE_CMD_VCPU_RESERVED 31
 
 #define VMWARE_PORT(cmd, eax, ebx, ecx, edx)				\
-	__asm__("inl (%%dx)" :						\
+	__asm__("inl (%%dx), %%eax" :					\
 		"=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) :		\
 		"a"(VMWARE_HYPERVISOR_MAGIC),				\
 		"c"(VMWARE_CMD_##cmd),					\
Reviewed-by Nick Desaulniers on v1 1/1
#3 lore raw
In reply to Sami Tolvanen
Quoted 4 lines · Sami Tolvanen' via Clang Built Linux

LLVM's assembler doesn't accept the short form inl (%%dx) instruction, but instead insists on the output register to be explicitly specified:

Quoted 8 lines

<inline asm>:1:7: error: invalid operand for instruction

          inl (%dx)
             ^

LLVM ERROR: Error parsing inline asm

Use the full form of the instruction to fix the build.

Thanks Sami, this looks like it addresses:

Looks like GAS' testsuite has some cases where the second operand is indeed implicitly %eax if unspecified. (This should still be fixed in Clang).
Just to triple check that they're equivalent:

$ cat inl.s
  inl (%dx)
  inl (%dx), %eax
$ as inl.s
$ objdump -d a.out

a.out: file format elf64-x86-64

Disassembly of section .text:

0000000000000000 <.text>:

   0: ed                    in     (%dx),%eax
   1: ed                    in     (%dx),%eax
Quoted 17 lines
---
 arch/x86/kernel/cpu/vmware.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/vmware.c +1 -1
index 9735139cfdf8..46d732696c1c 100644
@@ -49,7 +49,7 @@
 #define VMWARE_CMD_VCPU_RESERVED 31
 
 #define VMWARE_PORT(cmd, eax, ebx, ecx, edx)                           \
-       __asm__("inl (%%dx)" :                                          \
+       __asm__("inl (%%dx), %%eax" :                                   \
                "=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) :            \
                "a"(VMWARE_HYPERVISOR_MAGIC),                           \
                "c"(VMWARE_CMD_##cmd),                                  \
Signature · 2 lines
Thanks,
~Nick Desaulniers
Reviewed-by on v1 1/1
#4 lore raw
In reply to Sami Tolvanen
Quoted 4 lines · Sami Tolvanen' via Clang Built Linux

LLVM's assembler doesn't accept the short form inl (%%dx) instruction, but instead insists on the output register to be explicitly specified:

Quoted 8 lines

<inline asm>:1:7: error: invalid operand for instruction

          inl (%dx)
             ^

LLVM ERROR: Error parsing inline asm

Use the full form of the instruction to fix the build.

Thanks Sami, this looks like it addresses:

Looks like GAS' testsuite has some cases where the second operand is indeed implicitly %eax if unspecified. (This should still be fixed in Clang).
Just to triple check that they're equivalent:

$ cat inl.s
  inl (%dx)
  inl (%dx), %eax
$ as inl.s
$ objdump -d a.out

a.out: file format elf64-x86-64

Disassembly of section .text:

0000000000000000 <.text>:

   0: ed                    in     (%dx),%eax
   1: ed                    in     (%dx),%eax
Quoted 17 lines
---
 arch/x86/kernel/cpu/vmware.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/vmware.c +1 -1
index 9735139cfdf8..46d732696c1c 100644
@@ -49,7 +49,7 @@
 #define VMWARE_CMD_VCPU_RESERVED 31
 
 #define VMWARE_PORT(cmd, eax, ebx, ecx, edx)                           \
-       __asm__("inl (%%dx)" :                                          \
+       __asm__("inl (%%dx), %%eax" :                                   \
                "=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) :            \
                "a"(VMWARE_HYPERVISOR_MAGIC),                           \
                "c"(VMWARE_CMD_##cmd),                                  \
Signature · 2 lines
Thanks,
~Nick Desaulniers
Reviewed-by on v1 1/1
#5 lore raw
In reply to Sami Tolvanen
Quoted 11 lines · Sami Tolvanen

LLVM's assembler doesn't accept the short form inl (%%dx) instruction, but instead insists on the output register to be explicitly specified:

<inline asm>:1:7: error: invalid operand for instruction

          inl (%dx)
             ^

LLVM ERROR: Error parsing inline asm

Use the full form of the instruction to fix the build.

-Kees

Quoted 20 lines
---
 arch/x86/kernel/cpu/vmware.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/vmware.c +1 -1
index 9735139cfdf8..46d732696c1c 100644
@@ -49,7 +49,7 @@
 #define VMWARE_CMD_VCPU_RESERVED 31
 
 #define VMWARE_PORT(cmd, eax, ebx, ecx, edx)				\
-	__asm__("inl (%%dx)" :						\
+	__asm__("inl (%%dx), %%eax" :					\
 		"=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) :		\
 		"a"(VMWARE_HYPERVISOR_MAGIC),				\
 		"c"(VMWARE_CMD_##cmd),					\
Signature · 1 line
2.23.0.581.g78d2f28ef7-goog
Signature · 1 line
Kees Cook
merge bot Applied
#6 lore raw

[tip: x86/urgent] x86/cpu/vmware: Use the full form of inl in VMWARE_PORT

In reply to Sami Tolvanen
The following commit has been merged into the x86/urgent branch of tip:

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     b547c1fa97b030ac50586e8b187571b4a83d154c
Gitweb:        https://git.kernel.org/tip/b547c1fa97b030ac50586e8b187571b4a83d154c
Author:        Sami Tolvanen <[email protected]>
AuthorDate:    Mon, 07 Oct 2019 12:21:29 -07:00
Committer:     Borislav Petkov <[email protected]>
CommitterDate: Tue, 08 Oct 2019 11:52:35 +02:00

x86/cpu/vmware: Use the full form of inl in VMWARE_PORT

LLVM's assembler doesn't accept the short form

inl (%%dx)

instruction, but instead insists on the output register to be explicitly specified:

<inline asm>:1:7: error: invalid operand for instruction

          inl (%dx)
             ^

LLVM ERROR: Error parsing inline asm

Use the full form of the instruction to fix the build.

---
 arch/x86/kernel/cpu/vmware.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/vmware.c +1 -1
index 9735139..46d7326 100644
@@ -49,7 +49,7 @@
 #define VMWARE_CMD_VCPU_RESERVED 31
 
 #define VMWARE_PORT(cmd, eax, ebx, ecx, edx)				\
-	__asm__("inl (%%dx)" :						\
+	__asm__("inl (%%dx), %%eax" :					\
 		"=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) :		\
 		"a"(VMWARE_HYPERVISOR_MAGIC),				\
 		"c"(VMWARE_CMD_##cmd),					\
merge bot Applied
#7 lore raw

[tip: x86/urgent] x86/cpu/vmware: Use the full form of inl in VMWARE_PORT

In reply to Sami Tolvanen
The following commit has been merged into the x86/urgent branch of tip:

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     b547c1fa97b030ac50586e8b187571b4a83d154c
Gitweb:        https://git.kernel.org/tip/b547c1fa97b030ac50586e8b187571b4a83d154c
Author:        Sami Tolvanen <[email protected]>
AuthorDate:    Mon, 07 Oct 2019 12:21:29 -07:00
Committer:     Borislav Petkov <[email protected]>
CommitterDate: Tue, 08 Oct 2019 11:52:35 +02:00

x86/cpu/vmware: Use the full form of inl in VMWARE_PORT

LLVM's assembler doesn't accept the short form

inl (%%dx)

instruction, but instead insists on the output register to be explicitly specified:

<inline asm>:1:7: error: invalid operand for instruction

          inl (%dx)
             ^

LLVM ERROR: Error parsing inline asm

Use the full form of the instruction to fix the build.

---
 arch/x86/kernel/cpu/vmware.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/vmware.c +1 -1
index 9735139..46d7326 100644
@@ -49,7 +49,7 @@
 #define VMWARE_CMD_VCPU_RESERVED 31
 
 #define VMWARE_PORT(cmd, eax, ebx, ecx, edx)				\
-	__asm__("inl (%%dx)" :						\
+	__asm__("inl (%%dx), %%eax" :					\
 		"=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) :		\
 		"a"(VMWARE_HYPERVISOR_MAGIC),				\
 		"c"(VMWARE_CMD_##cmd),					\
merge bot Applied
#8 lore raw

[tip: x86/urgent] x86/cpu/vmware: Use the full form of INL in VMWARE_PORT

In reply to Sami Tolvanen
The following commit has been merged into the x86/urgent branch of tip:

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     fbcfb8f0270bf24fe348393540b17a7f2ba577d7
Gitweb:        https://git.kernel.org/tip/fbcfb8f0270bf24fe348393540b17a7f2ba577d7
Author:        Sami Tolvanen <[email protected]>
AuthorDate:    Mon, 07 Oct 2019 12:21:29 -07:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Tue, 08 Oct 2019 13:26:42 +02:00

x86/cpu/vmware: Use the full form of INL in VMWARE_PORT

LLVM's assembler doesn't accept the short form INL instruction:

inl (%%dx)

but instead insists on the output register to be explicitly specified:

<inline asm>:1:7: error: invalid operand for instruction

          inl (%dx)
             ^

LLVM ERROR: Error parsing inline asm

Use the full form of the instruction to fix the build.

---
 arch/x86/kernel/cpu/vmware.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/vmware.c +1 -1
index 9735139..46d7326 100644
@@ -49,7 +49,7 @@
 #define VMWARE_CMD_VCPU_RESERVED 31
 
 #define VMWARE_PORT(cmd, eax, ebx, ecx, edx)				\
-	__asm__("inl (%%dx)" :						\
+	__asm__("inl (%%dx), %%eax" :					\
 		"=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) :		\
 		"a"(VMWARE_HYPERVISOR_MAGIC),				\
 		"c"(VMWARE_CMD_##cmd),					\
merge bot Applied
#9 lore raw

[tip: x86/urgent] x86/cpu/vmware: Use the full form of INL in VMWARE_PORT

In reply to Sami Tolvanen
The following commit has been merged into the x86/urgent branch of tip:

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     fbcfb8f0270bf24fe348393540b17a7f2ba577d7
Gitweb:        https://git.kernel.org/tip/fbcfb8f0270bf24fe348393540b17a7f2ba577d7
Author:        Sami Tolvanen <[email protected]>
AuthorDate:    Mon, 07 Oct 2019 12:21:29 -07:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Tue, 08 Oct 2019 13:26:42 +02:00

x86/cpu/vmware: Use the full form of INL in VMWARE_PORT

LLVM's assembler doesn't accept the short form INL instruction:

inl (%%dx)

but instead insists on the output register to be explicitly specified:

<inline asm>:1:7: error: invalid operand for instruction

          inl (%dx)
             ^

LLVM ERROR: Error parsing inline asm

Use the full form of the instruction to fix the build.

---
 arch/x86/kernel/cpu/vmware.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/vmware.c +1 -1
index 9735139..46d7326 100644
@@ -49,7 +49,7 @@
 #define VMWARE_CMD_VCPU_RESERVED 31
 
 #define VMWARE_PORT(cmd, eax, ebx, ecx, edx)				\
-	__asm__("inl (%%dx)" :						\
+	__asm__("inl (%%dx), %%eax" :					\
 		"=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) :		\
 		"a"(VMWARE_HYPERVISOR_MAGIC),				\
 		"c"(VMWARE_CMD_##cmd),					\