18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Common place for both 32- and 64-bit entry routines.
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#include <linux/linkage.h>
78c2ecf20Sopenharmony_ci#include <asm/export.h>
88c2ecf20Sopenharmony_ci#include <asm/msr-index.h>
98c2ecf20Sopenharmony_ci#include <asm/unwind_hints.h>
108c2ecf20Sopenharmony_ci#include <asm/segment.h>
118c2ecf20Sopenharmony_ci#include <asm/cache.h>
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci.pushsection .noinstr.text, "ax"
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciSYM_FUNC_START(entry_ibpb)
168c2ecf20Sopenharmony_ci	movl	$MSR_IA32_PRED_CMD, %ecx
178c2ecf20Sopenharmony_ci	movl	$PRED_CMD_IBPB, %eax
188c2ecf20Sopenharmony_ci	xorl	%edx, %edx
198c2ecf20Sopenharmony_ci	wrmsr
208c2ecf20Sopenharmony_ci	RET
218c2ecf20Sopenharmony_ciSYM_FUNC_END(entry_ibpb)
228c2ecf20Sopenharmony_ci/* For KVM */
238c2ecf20Sopenharmony_ciEXPORT_SYMBOL_GPL(entry_ibpb);
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci.popsection
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci/*
288c2ecf20Sopenharmony_ci * Define the VERW operand that is disguised as entry code so that
298c2ecf20Sopenharmony_ci * it can be referenced with KPTI enabled. This ensure VERW can be
308c2ecf20Sopenharmony_ci * used late in exit-to-user path after page tables are switched.
318c2ecf20Sopenharmony_ci */
328c2ecf20Sopenharmony_ci.pushsection .entry.text, "ax"
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci.align L1_CACHE_BYTES, 0xcc
358c2ecf20Sopenharmony_ciSYM_CODE_START_NOALIGN(mds_verw_sel)
368c2ecf20Sopenharmony_ci	UNWIND_HINT_EMPTY
378c2ecf20Sopenharmony_ci	ANNOTATE_NOENDBR
388c2ecf20Sopenharmony_ci	.word __KERNEL_DS
398c2ecf20Sopenharmony_ci.align L1_CACHE_BYTES, 0xcc
408c2ecf20Sopenharmony_ciSYM_CODE_END(mds_verw_sel);
418c2ecf20Sopenharmony_ci/* For KVM */
428c2ecf20Sopenharmony_ciEXPORT_SYMBOL_GPL(mds_verw_sel);
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci.popsection
458c2ecf20Sopenharmony_ci
46