summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/vmx/vmx_ops.h
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2021-11-10 11:01:17 +0100
committerPeter Zijlstra <peterz@infradead.org>2021-12-11 09:09:49 +0100
commit3e8ea7803a1dedf19120a2fef12c590e90e4b469 (patch)
treed86c7c76ff6f4b4ca0c39352c059259d8f250d00 /arch/x86/kvm/vmx/vmx_ops.h
parentc9a34c3f4ece192f6d804039fe6aac9618f0d236 (diff)
downloadlinux-stable-3e8ea7803a1dedf19120a2fef12c590e90e4b469.tar.gz
linux-stable-3e8ea7803a1dedf19120a2fef12c590e90e4b469.tar.bz2
linux-stable-3e8ea7803a1dedf19120a2fef12c590e90e4b469.zip
x86/vmx: Remove .fixup usage
In the vmread exceptin path, use the, thus far, unused output register to push the @fault argument onto the stack. This, in turn, enables the exception handler to not do pushes and only modify that register when an exception does occur. As noted by Sean the input constraint needs to be changed to "=&r" to avoid the value and field occupying the same register. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com> Link: https://lore.kernel.org/r/20211110101325.781308550@infradead.org
Diffstat (limited to 'arch/x86/kvm/vmx/vmx_ops.h')
-rw-r--r--arch/x86/kvm/vmx/vmx_ops.h16
1 files changed, 7 insertions, 9 deletions
diff --git a/arch/x86/kvm/vmx/vmx_ops.h b/arch/x86/kvm/vmx/vmx_ops.h
index 9e9ef47e988c..35d9324c2f2a 100644
--- a/arch/x86/kvm/vmx/vmx_ops.h
+++ b/arch/x86/kvm/vmx/vmx_ops.h
@@ -80,9 +80,11 @@ static __always_inline unsigned long __vmcs_readl(unsigned long field)
* @field, and bounce through the trampoline to preserve
* volatile registers.
*/
- "push $0\n\t"
+ "xorl %k1, %k1\n\t"
+ "2:\n\t"
+ "push %1\n\t"
"push %2\n\t"
- "2:call vmread_error_trampoline\n\t"
+ "call vmread_error_trampoline\n\t"
/*
* Unwind the stack. Note, the trampoline zeros out the
@@ -93,13 +95,9 @@ static __always_inline unsigned long __vmcs_readl(unsigned long field)
"3:\n\t"
/* VMREAD faulted. As above, except push '1' for @fault. */
- ".pushsection .fixup, \"ax\"\n\t"
- "4: push $1\n\t"
- "push %2\n\t"
- "jmp 2b\n\t"
- ".popsection\n\t"
- _ASM_EXTABLE(1b, 4b)
- : ASM_CALL_CONSTRAINT, "=r"(value) : "r"(field) : "cc");
+ _ASM_EXTABLE_TYPE_REG(1b, 2b, EX_TYPE_ONE_REG, %1)
+
+ : ASM_CALL_CONSTRAINT, "=&r"(value) : "r"(field) : "cc");
return value;
}