315315.endm
316316
317317/*
318- * Macro to execute VERW instruction that mitigate transient data sampling
319- * attacks such as MDS. On affected systems a microcode update overloaded VERW
320- * instruction to also clear the CPU buffers. VERW clobbers CFLAGS.ZF.
321- *
318+ * Macro to execute VERW insns that mitigate transient data sampling
319+ * attacks such as MDS or TSA . On affected systems a microcode update
320+ * overloaded VERW insns to also clear the CPU buffers. VERW clobbers
321+ * CFLAGS.ZF.
322322 * Note: Only the memory operand variant of VERW clears the CPU buffers.
323323 */
324324.macro CLEAR_CPU_BUFFERS
325325#ifdef CONFIG_X86_64
326- ALTERNATIVE "", "verw mds_verw_sel (%rip)" , X86_FEATURE_CLEAR_CPU_BUF
326+ ALTERNATIVE "", "verw x86_verw_sel (%rip)" , X86_FEATURE_CLEAR_CPU_BUF
327327#else
328328 /*
329329 * In 32bit mode, the memory operand must be a %cs reference. The data
330330 * segments may not be usable (vm86 mode), and the stack segment may not
331331 * be flat (ESPFIX32).
332332 */
333- ALTERNATIVE "" , "verw %cs:mds_verw_sel " , X86_FEATURE_CLEAR_CPU_BUF
333+ ALTERNATIVE "" , "verw %cs:x86_verw_sel " , X86_FEATURE_CLEAR_CPU_BUF
334334#endif
335335.endm
336336
@@ -582,24 +582,24 @@ DECLARE_STATIC_KEY_FALSE(switch_to_cond_stibp);
582582DECLARE_STATIC_KEY_FALSE (switch_mm_cond_ibpb );
583583DECLARE_STATIC_KEY_FALSE (switch_mm_always_ibpb );
584584
585- DECLARE_STATIC_KEY_FALSE (mds_idle_clear );
585+ DECLARE_STATIC_KEY_FALSE (cpu_buf_idle_clear );
586586
587587DECLARE_STATIC_KEY_FALSE (switch_mm_cond_l1d_flush );
588588
589589DECLARE_STATIC_KEY_FALSE (mmio_stale_data_clear );
590590
591- extern u16 mds_verw_sel ;
591+ extern u16 x86_verw_sel ;
592592
593593#include <asm/segment.h>
594594
595595/**
596- * mds_clear_cpu_buffers - Mitigation for MDS and TAA vulnerability
596+ * x86_clear_cpu_buffers - Buffer clearing support for different x86 CPU vulns
597597 *
598598 * This uses the otherwise unused and obsolete VERW instruction in
599599 * combination with microcode which triggers a CPU buffer flush when the
600600 * instruction is executed.
601601 */
602- static __always_inline void mds_clear_cpu_buffers (void )
602+ static __always_inline void x86_clear_cpu_buffers (void )
603603{
604604 static const u16 ds = __KERNEL_DS ;
605605
@@ -616,14 +616,15 @@ static __always_inline void mds_clear_cpu_buffers(void)
616616}
617617
618618/**
619- * mds_idle_clear_cpu_buffers - Mitigation for MDS vulnerability
619+ * x86_idle_clear_cpu_buffers - Buffer clearing support in idle for the MDS
620+ * vulnerability
620621 *
621622 * Clear CPU buffers if the corresponding static key is enabled
622623 */
623- static __always_inline void mds_idle_clear_cpu_buffers (void )
624+ static __always_inline void x86_idle_clear_cpu_buffers (void )
624625{
625- if (static_branch_likely (& mds_idle_clear ))
626- mds_clear_cpu_buffers ();
626+ if (static_branch_likely (& cpu_buf_idle_clear ))
627+ x86_clear_cpu_buffers ();
627628}
628629
629630#endif /* __ASSEMBLY__ */
0 commit comments