vmenter.S (a23e1966932464e1c5226cb9ac4ce1d5fc10ba22) vmenter.S (4440337af4d415c8abf8b9b0e10c79b7518e6e3c)
1/* SPDX-License-Identifier: GPL-2.0 */
2#include <linux/linkage.h>
3#include <asm/asm.h>
4#include <asm/asm-offsets.h>
5#include <asm/bitsperlong.h>
6#include <asm/frame.h>
7#include <asm/kvm_vcpu_regs.h>
8#include <asm/nospec-branch.h>

--- 195 unchanged lines hidden (view full) ---

2045: vmsave %_ASM_AX
2056:
206
207 /* Restores GSBASE among other things, allowing access to percpu data. */
208 pop %_ASM_AX
2097: vmload %_ASM_AX
2108:
211
1/* SPDX-License-Identifier: GPL-2.0 */
2#include <linux/linkage.h>
3#include <asm/asm.h>
4#include <asm/asm-offsets.h>
5#include <asm/bitsperlong.h>
6#include <asm/frame.h>
7#include <asm/kvm_vcpu_regs.h>
8#include <asm/nospec-branch.h>

--- 195 unchanged lines hidden (view full) ---

2045: vmsave %_ASM_AX
2056:
206
207 /* Restores GSBASE among other things, allowing access to percpu data. */
208 pop %_ASM_AX
2097: vmload %_ASM_AX
2108:
211
212#ifdef CONFIG_MITIGATION_RETPOLINE
213 /* IMPORTANT: Stuff the RSB immediately after VM-Exit, before RET! */
212 /* IMPORTANT: Stuff the RSB immediately after VM-Exit, before RET! */
214 FILL_RETURN_BUFFER %_ASM_AX, RSB_CLEAR_LOOPS, X86_FEATURE_RETPOLINE
215#endif
213 FILL_RETURN_BUFFER %_ASM_AX, RSB_CLEAR_LOOPS, X86_FEATURE_RSB_VMEXIT
216
217 /* Clobbers RAX, RCX, RDX. */
218 RESTORE_HOST_SPEC_CTRL
219
220 /*
221 * Mitigate RETBleed for AMD/Hygon Zen uarch. RET should be
222 * untrained as soon as we exit the VM and are back to the
223 * kernel. This should be done before re-enabling interrupts

--- 119 unchanged lines hidden (view full) ---

343
344 /* Enter guest mode */
345 sti
346
3471: vmrun %rax
348
3492: cli
350
214
215 /* Clobbers RAX, RCX, RDX. */
216 RESTORE_HOST_SPEC_CTRL
217
218 /*
219 * Mitigate RETBleed for AMD/Hygon Zen uarch. RET should be
220 * untrained as soon as we exit the VM and are back to the
221 * kernel. This should be done before re-enabling interrupts

--- 119 unchanged lines hidden (view full) ---

341
342 /* Enter guest mode */
343 sti
344
3451: vmrun %rax
346
3472: cli
348
351#ifdef CONFIG_MITIGATION_RETPOLINE
352 /* IMPORTANT: Stuff the RSB immediately after VM-Exit, before RET! */
349 /* IMPORTANT: Stuff the RSB immediately after VM-Exit, before RET! */
353 FILL_RETURN_BUFFER %rax, RSB_CLEAR_LOOPS, X86_FEATURE_RETPOLINE
354#endif
350 FILL_RETURN_BUFFER %rax, RSB_CLEAR_LOOPS, X86_FEATURE_RSB_VMEXIT
355
356 /* Clobbers RAX, RCX, RDX, consumes RDI (@svm) and RSI (@spec_ctrl_intercepted). */
357 RESTORE_HOST_SPEC_CTRL
358
359 /*
360 * Mitigate RETBleed for AMD/Hygon Zen uarch. RET should be
361 * untrained as soon as we exit the VM and are back to the
362 * kernel. This should be done before re-enabling interrupts

--- 19 unchanged lines hidden ---
351
352 /* Clobbers RAX, RCX, RDX, consumes RDI (@svm) and RSI (@spec_ctrl_intercepted). */
353 RESTORE_HOST_SPEC_CTRL
354
355 /*
356 * Mitigate RETBleed for AMD/Hygon Zen uarch. RET should be
357 * untrained as soon as we exit the VM and are back to the
358 * kernel. This should be done before re-enabling interrupts

--- 19 unchanged lines hidden ---