]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
x86/hyperv: Use named operands in inline asm
authorJosh Poimboeuf <jpoimboe@kernel.org>
Mon, 3 Mar 2025 01:21:00 +0000 (17:21 -0800)
committerIngo Molnar <mingo@kernel.org>
Tue, 4 Mar 2025 10:21:39 +0000 (11:21 +0100)
Use named operands in inline asm to make it easier to change the
constraint order.

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: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: linux-kernel@vger.kernel.org
arch/x86/include/asm/mshyperv.h

index f91ab1e75f9ffc456f08241550b865b93c5f34ef..5e6193dbc97e33dadb7d808b15622a56b543afa4 100644 (file)
@@ -77,11 +77,11 @@ static inline u64 hv_do_hypercall(u64 control, void *input, void *output)
                return hv_tdx_hypercall(control, input_address, output_address);
 
        if (hv_isolation_type_snp() && !hyperv_paravisor_present) {
-               __asm__ __volatile__("mov %4, %%r8\n"
+               __asm__ __volatile__("mov %[output_address], %%r8\n"
                                     "vmmcall"
                                     : "=a" (hv_status), ASM_CALL_CONSTRAINT,
                                       "+c" (control), "+d" (input_address)
-                                    :  "r" (output_address)
+                                    : [output_address] "r" (output_address)
                                     : "cc", "memory", "r8", "r9", "r10", "r11");
                return hv_status;
        }
@@ -89,12 +89,12 @@ static inline u64 hv_do_hypercall(u64 control, void *input, void *output)
        if (!hv_hypercall_pg)
                return U64_MAX;
 
-       __asm__ __volatile__("mov %4, %%r8\n"
+       __asm__ __volatile__("mov %[output_address], %%r8\n"
                             CALL_NOSPEC
                             : "=a" (hv_status), ASM_CALL_CONSTRAINT,
                               "+c" (control), "+d" (input_address)
-                            :  "r" (output_address),
-                               THUNK_TARGET(hv_hypercall_pg)
+                            : [output_address] "r" (output_address),
+                              THUNK_TARGET(hv_hypercall_pg)
                             : "cc", "memory", "r8", "r9", "r10", "r11");
 #else
        u32 input_address_hi = upper_32_bits(input_address);
@@ -187,18 +187,18 @@ static inline u64 _hv_do_fast_hypercall16(u64 control, u64 input1, u64 input2)
                return hv_tdx_hypercall(control, input1, input2);
 
        if (hv_isolation_type_snp() && !hyperv_paravisor_present) {
-               __asm__ __volatile__("mov %4, %%r8\n"
+               __asm__ __volatile__("mov %[input2], %%r8\n"
                                     "vmmcall"
                                     : "=a" (hv_status), ASM_CALL_CONSTRAINT,
                                       "+c" (control), "+d" (input1)
-                                    : "r" (input2)
+                                    : [input2] "r" (input2)
                                     : "cc", "r8", "r9", "r10", "r11");
        } else {
-               __asm__ __volatile__("mov %4, %%r8\n"
+               __asm__ __volatile__("mov %[input2], %%r8\n"
                                     CALL_NOSPEC
                                     : "=a" (hv_status), ASM_CALL_CONSTRAINT,
                                       "+c" (control), "+d" (input1)
-                                    : "r" (input2),
+                                    : [input2] "r" (input2),
                                       THUNK_TARGET(hv_hypercall_pg)
                                     : "cc", "r8", "r9", "r10", "r11");
        }