@@ -9,7 +9,7 @@
#include <asm/alternative.h>
#include <asm/cpufeatures.h>
-#include <asm/msr-index.h>
+#include <asm/msr.h>
#include <asm/unwind_hints.h>
#include <asm/percpu.h>
#include <asm/current.h>
@@ -488,6 +488,16 @@ DECLARE_PER_CPU(u64, x86_spec_ctrl_current);
extern void update_spec_ctrl_cond(u64 val);
extern u64 spec_ctrl_current(void);
+/*
+ * This can be used in noinstr function & should only be called in bare
+ * metal context.
+ */
+static __always_inline void __update_spec_ctrl(u64 val)
+{
+ __this_cpu_write(x86_spec_ctrl_current, val);
+ native_wrmsrl(MSR_IA32_SPEC_CTRL, val);
+}
+
/*
* With retpoline, we must use IBRS to restrict branch prediction
* before calling into firmware.