]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
KVM: VMX: Do not declare vmread_error() asmlinkage
authorUros Bizjak <ubizjak@gmail.com>
Wed, 17 Aug 2022 14:40:45 +0000 (16:40 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 26 Sep 2022 16:02:35 +0000 (12:02 -0400)
There is no need to declare vmread_error() asmlinkage, its arguments
can be passed via registers for both 32-bit and 64-bit targets.
Function argument registers are considered call-clobbered registers,
they are saved in the trampoline just before the function call and
restored afterwards.

Dropping "asmlinkage" patch unifies trampoline function argument handling
between 32-bit and 64-bit targets and improves generated code for 32-bit
targets.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Sean Christopherson <seanjc@google.com>
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Link: https://lore.kernel.org/r/20220817144045.3206-1-ubizjak@gmail.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/vmenter.S
arch/x86/kvm/vmx/vmx.c
arch/x86/kvm/vmx/vmx_ops.h

index 5355e1a34d337c4a368509b9dd32780f9c3f0b2c..8477d8bdd69c262c8feeb79569f6a68f0ea65833 100644 (file)
@@ -292,22 +292,13 @@ SYM_FUNC_START(vmread_error_trampoline)
        push %r10
        push %r11
 #endif
-#ifdef CONFIG_X86_64
+
        /* Load @field and @fault to arg1 and arg2 respectively. */
-       mov 3*WORD_SIZE(%rbp), %_ASM_ARG2
-       mov 2*WORD_SIZE(%rbp), %_ASM_ARG1
-#else
-       /* Parameters are passed on the stack for 32-bit (see asmlinkage). */
-       push 3*WORD_SIZE(%ebp)
-       push 2*WORD_SIZE(%ebp)
-#endif
+       mov 3*WORD_SIZE(%_ASM_BP), %_ASM_ARG2
+       mov 2*WORD_SIZE(%_ASM_BP), %_ASM_ARG1
 
        call vmread_error
 
-#ifndef CONFIG_X86_64
-       add $8, %esp
-#endif
-
        /* Zero out @fault, which will be popped into the result register. */
        _ASM_MOV $0, 3*WORD_SIZE(%_ASM_BP)
 
index 3eae410864166cf54e45fe53030e452f22c8f649..e243a96d59b4e1f4af4c7dc914eda5f39a8055bf 100644 (file)
@@ -439,7 +439,7 @@ do {                                        \
        pr_warn_ratelimited(fmt);       \
 } while (0)
 
-asmlinkage void vmread_error(unsigned long field, bool fault)
+void vmread_error(unsigned long field, bool fault)
 {
        if (fault)
                kvm_spurious_fault();
index 5cfc49ddb1b442801bf058779e86f0102a7536ec..ec268df83ed67988f76a007ad65e9d77aa5d7a3f 100644 (file)
@@ -10,7 +10,7 @@
 #include "vmcs.h"
 #include "../x86.h"
 
-asmlinkage void vmread_error(unsigned long field, bool fault);
+void vmread_error(unsigned long field, bool fault);
 __attribute__((regparm(0))) void vmread_error_trampoline(unsigned long field,
                                                         bool fault);
 void vmwrite_error(unsigned long field, unsigned long value);