[PATCH v2 7/8] x86: Do not use dynamic IBRS if retpoline is enabled

From: Tim Chen
Date: Fri Jan 05 2018 - 21:33:37 EST


Don't use dynamic IBRS that toggle IBRS on entry/exit
to kernel code if retpoline is used.

Signed-off-by: Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx>
---
arch/x86/kernel/cpu/spec_ctrl.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/cpu/spec_ctrl.c b/arch/x86/kernel/cpu/spec_ctrl.c
index 28107a2..076c470 100644
--- a/arch/x86/kernel/cpu/spec_ctrl.c
+++ b/arch/x86/kernel/cpu/spec_ctrl.c
@@ -26,10 +26,12 @@ DEFINE_MUTEX(spec_ctrl_mutex);

static inline void set_ibrs_feature(void)
{
+#if !defined(RETPOLINE)
if (!ibrs_admin_disabled) {
dynamic_ibrs = 1;
ibrs_enabled = IBRS_ENABLED;
}
+#endif
}

void scan_spec_ctrl_feature(struct cpuinfo_x86 *c)
--
2.9.4