Commit 20cb891e authored by David Woodhouse's avatar David Woodhouse Committed by Kleber Sacilotto de Souza

UBUNTU: SAUCE: x86/speculation: Expose indirect_branch_prediction_barrier()

BugLink: https://bugs.launchpad.net/bugs/1791080

Expose indirect_branch_prediction_barrier() for use in subsequent patches.
Our approach for IBRS/IBPB is still based on the Intel v4 patchset and I
did not want to completely switch that in this upstream stable set. For
that reason I skipped most changes from "x86/speculation: Add basic IBPB
(Indirect Branch Prediction Barrier) support" from the 4.4.144 update.

Only indirect_branch_prediction_barrier() I picked up because it will
later be used for an update to "x86/speculation: Use Indirect Branch
Prediction Barrier in context switch".
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 47d113b3
......@@ -239,6 +239,19 @@ void alternative_msr_write(unsigned int msr, u64 val, unsigned int feature)
: "memory");
}
static inline void indirect_branch_prediction_barrier(void)
{
asm volatile(ALTERNATIVE("",
"movl %[msr], %%ecx\n\t"
"movl %[val], %%eax\n\t"
"movl $0, %%edx\n\t"
"wrmsr",
X86_FEATURE_USE_IBPB)
: : [msr] "i" (MSR_IA32_PRED_CMD),
[val] "i" (PRED_CMD_IBPB)
: "eax", "ecx", "edx", "memory");
}
#endif /* __ASSEMBLY__ */
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment