202202.endm
203203
204204/*
205- * Macro to execute VERW instruction that mitigate transient data sampling
206- * attacks such as MDS. On affected systems a microcode update overloaded VERW
207- * instruction to also clear the CPU buffers. VERW clobbers CFLAGS.ZF.
208- *
205+ * Macro to execute VERW insns that mitigate transient data sampling
206+ * attacks such as MDS or TSA . On affected systems a microcode update
207+ * overloaded VERW insns to also clear the CPU buffers. VERW clobbers
208+ * CFLAGS.ZF.
209209 * Note: Only the memory operand variant of VERW clears the CPU buffers.
210210 */
211211.macro CLEAR_CPU_BUFFERS
212212 ALTERNATIVE "jmp .Lskip_verw_\@" , "" , X86_FEATURE_CLEAR_CPU_BUF
213213#ifdef CONFIG_X86_64
214- verw mds_verw_sel (%rip )
214+ verw x86_verw_sel (%rip )
215215#else
216216 /*
217217 * In 32bit mode, the memory operand must be a %cs reference. The data
218218 * segments may not be usable (vm86 mode), and the stack segment may not
219219 * be flat (ESPFIX32).
220220 */
221- verw %cs :mds_verw_sel
221+ verw %cs :x86_verw_sel
222222#endif
223223.Lskip_verw_ \@:
224224.endm
@@ -427,24 +427,24 @@ DECLARE_STATIC_KEY_FALSE(switch_to_cond_stibp);
427427DECLARE_STATIC_KEY_FALSE (switch_mm_cond_ibpb );
428428DECLARE_STATIC_KEY_FALSE (switch_mm_always_ibpb );
429429
430- DECLARE_STATIC_KEY_FALSE (mds_idle_clear );
430+ DECLARE_STATIC_KEY_FALSE (cpu_buf_idle_clear );
431431
432432DECLARE_STATIC_KEY_FALSE (switch_mm_cond_l1d_flush );
433433
434434DECLARE_STATIC_KEY_FALSE (mmio_stale_data_clear );
435435
436- extern u16 mds_verw_sel ;
436+ extern u16 x86_verw_sel ;
437437
438438#include <asm/segment.h>
439439
440440/**
441- * mds_clear_cpu_buffers - Mitigation for MDS and TAA vulnerability
441+ * x86_clear_cpu_buffers - Buffer clearing support for different x86 CPU vulns
442442 *
443443 * This uses the otherwise unused and obsolete VERW instruction in
444444 * combination with microcode which triggers a CPU buffer flush when the
445445 * instruction is executed.
446446 */
447- static __always_inline void mds_clear_cpu_buffers (void )
447+ static __always_inline void x86_clear_cpu_buffers (void )
448448{
449449 static const u16 ds = __KERNEL_DS ;
450450
@@ -461,14 +461,15 @@ static __always_inline void mds_clear_cpu_buffers(void)
461461}
462462
463463/**
464- * mds_idle_clear_cpu_buffers - Mitigation for MDS vulnerability
464+ * x86_idle_clear_cpu_buffers - Buffer clearing support in idle for the MDS
465+ * vulnerability
465466 *
466467 * Clear CPU buffers if the corresponding static key is enabled
467468 */
468- static inline void mds_idle_clear_cpu_buffers (void )
469+ static __always_inline void x86_idle_clear_cpu_buffers (void )
469470{
470- if (static_branch_likely (& mds_idle_clear ))
471- mds_clear_cpu_buffers ();
471+ if (static_branch_likely (& cpu_buf_idle_clear ))
472+ x86_clear_cpu_buffers ();
472473}
473474
474475#endif /* __ASSEMBLY__ */
0 commit comments