]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
KVM: VMX: Use named operands in inline asm
authorJosh Poimboeuf <jpoimboe@kernel.org>
Mon, 3 Mar 2025 01:20:59 +0000 (17:20 -0800)
committerIngo Molnar <mingo@kernel.org>
Tue, 4 Mar 2025 10:21:39 +0000 (11:21 +0100)
Convert the non-asm-goto version of the inline asm in __vmcs_readl() to
use named operands, similar to its asm-goto version.

Do this in preparation of changing the ASM_CALL_CONSTRAINT primitive.

Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Sean Christopherson <seanjc@google.com>
Cc: linux-kernel@vger.kernel.org
arch/x86/kvm/vmx/vmx_ops.h

index 633c87e2fd92eea282fde81e2d5c8dc3efbff242..96677576c836d5cf00820e11d125baea8f9fc7a0 100644 (file)
@@ -118,7 +118,7 @@ do_exception:
 
 #else /* !CONFIG_CC_HAS_ASM_GOTO_OUTPUT */
 
-       asm volatile("1: vmread %2, %1\n\t"
+       asm volatile("1: vmread %[field], %[output]\n\t"
                     ".byte 0x3e\n\t" /* branch taken hint */
                     "ja 3f\n\t"
 
@@ -127,24 +127,26 @@ do_exception:
                      * @field, and bounce through the trampoline to preserve
                      * volatile registers.
                      */
-                    "xorl %k1, %k1\n\t"
+                    "xorl %k[output], %k[output]\n\t"
                     "2:\n\t"
-                    "push %1\n\t"
-                    "push %2\n\t"
+                    "push %[output]\n\t"
+                    "push %[field]\n\t"
                     "call vmread_error_trampoline\n\t"
 
                     /*
                      * Unwind the stack.  Note, the trampoline zeros out the
                      * memory for @fault so that the result is '0' on error.
                      */
-                    "pop %2\n\t"
-                    "pop %1\n\t"
+                    "pop %[field]\n\t"
+                    "pop %[output]\n\t"
                     "3:\n\t"
 
                     /* VMREAD faulted.  As above, except push '1' for @fault. */
-                    _ASM_EXTABLE_TYPE_REG(1b, 2b, EX_TYPE_ONE_REG, %1)
+                    _ASM_EXTABLE_TYPE_REG(1b, 2b, EX_TYPE_ONE_REG, %[output])
 
-                    : ASM_CALL_CONSTRAINT, "=&r"(value) : "r"(field) : "cc");
+                    : ASM_CALL_CONSTRAINT, [output] "=&r" (value)
+                    : [field] "r" (field)
+                    : "cc");
        return value;
 
 #endif /* CONFIG_CC_HAS_ASM_GOTO_OUTPUT */