x86/speculation: Make "seccomp" the default mode for Speculative Store Bypass
[linux-block.git] / arch / x86 / include / asm / spec-ctrl.h
CommitLineData
28a27752
TG
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_X86_SPECCTRL_H_
3#define _ASM_X86_SPECCTRL_H_
4
885f82bf 5#include <linux/thread_info.h>
28a27752
TG
6#include <asm/nospec-branch.h>
7
8/*
9 * On VMENTER we must preserve whatever view of the SPEC_CTRL MSR
10 * the guest has, while on VMEXIT we restore the host view. This
11 * would be easier if SPEC_CTRL were architecturally maskable or
12 * shadowable for guests but this is not (currently) the case.
13 * Takes the guest view of SPEC_CTRL MSR as a parameter.
14 */
15extern void x86_spec_ctrl_set_guest(u64);
16extern void x86_spec_ctrl_restore_host(u64);
17
18/* AMD specific Speculative Store Bypass MSR data */
19extern u64 x86_amd_ls_cfg_base;
20extern u64 x86_amd_ls_cfg_rds_mask;
21
885f82bf
TG
22/* The Intel SPEC CTRL MSR base value cache */
23extern u64 x86_spec_ctrl_base;
24
25static inline u64 rds_tif_to_spec_ctrl(u64 tifn)
26{
27 BUILD_BUG_ON(TIF_RDS < SPEC_CTRL_RDS_SHIFT);
28 return (tifn & _TIF_RDS) >> (TIF_RDS - SPEC_CTRL_RDS_SHIFT);
29}
30
31static inline u64 rds_tif_to_amd_ls_cfg(u64 tifn)
32{
33 return (tifn & _TIF_RDS) ? x86_amd_ls_cfg_rds_mask : 0ULL;
34}
35
36extern void speculative_store_bypass_update(void);
37
28a27752 38#endif