summaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/spec-ctrl.h
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2018-05-10 20:42:48 +0200
committerThomas Gleixner <tglx@linutronix.de>2018-05-17 17:09:21 +0200
commit47c61b3955cf712cadfc25635bf9bc174af030ea (patch)
treed25d09aa3b84755bd8296a9e0e6a32c3884cd5ac /arch/x86/include/asm/spec-ctrl.h
parentbe6fcb5478e95bb1c91f489121238deb3abca46a (diff)
downloadlinux-0-day-47c61b3955cf712cadfc25635bf9bc174af030ea.tar.gz
linux-0-day-47c61b3955cf712cadfc25635bf9bc174af030ea.tar.xz
x86/speculation, KVM: Implement support for VIRT_SPEC_CTRL/LS_CFG
Add the necessary logic for supporting the emulated VIRT_SPEC_CTRL MSR to x86_virt_spec_ctrl(). If either X86_FEATURE_LS_CFG_SSBD or X86_FEATURE_VIRT_SPEC_CTRL is set then use the new guest_virt_spec_ctrl argument to check whether the state must be modified on the host. The update reuses speculative_store_bypass_update() so the ZEN-specific sibling coordination can be reused. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/include/asm/spec-ctrl.h')
-rw-r--r--arch/x86/include/asm/spec-ctrl.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/include/asm/spec-ctrl.h b/arch/x86/include/asm/spec-ctrl.h
index 763d49710329d..ae7c2c5cd7f0e 100644
--- a/arch/x86/include/asm/spec-ctrl.h
+++ b/arch/x86/include/asm/spec-ctrl.h
@@ -53,6 +53,12 @@ static inline u64 ssbd_tif_to_spec_ctrl(u64 tifn)
return (tifn & _TIF_SSBD) >> (TIF_SSBD - SPEC_CTRL_SSBD_SHIFT);
}
+static inline unsigned long ssbd_spec_ctrl_to_tif(u64 spec_ctrl)
+{
+ BUILD_BUG_ON(TIF_SSBD < SPEC_CTRL_SSBD_SHIFT);
+ return (spec_ctrl & SPEC_CTRL_SSBD) << (TIF_SSBD - SPEC_CTRL_SSBD_SHIFT);
+}
+
static inline u64 ssbd_tif_to_amd_ls_cfg(u64 tifn)
{
return (tifn & _TIF_SSBD) ? x86_amd_ls_cfg_ssbd_mask : 0ULL;