302302.endm
303303
304304/*
305- * Macro to execute VERW instruction that mitigate transient data sampling
306- * attacks such as MDS. On affected systems a microcode update overloaded VERW
307- * instruction to also clear the CPU buffers. VERW clobbers CFLAGS.ZF.
308- *
305+ * Macro to execute VERW insns that mitigate transient data sampling
306+ * attacks such as MDS or TSA . On affected systems a microcode update
307+ * overloaded VERW insns to also clear the CPU buffers. VERW clobbers
308+ * CFLAGS.ZF.
309309 * Note: Only the memory operand variant of VERW clears the CPU buffers.
310310 */
311311.macro CLEAR_CPU_BUFFERS
312312#ifdef CONFIG_X86_64
313- ALTERNATIVE "", "verw mds_verw_sel (%rip)" , X86_FEATURE_CLEAR_CPU_BUF
313+ ALTERNATIVE "", "verw x86_verw_sel (%rip)" , X86_FEATURE_CLEAR_CPU_BUF
314314#else
315315 /*
316316 * In 32bit mode, the memory operand must be a %cs reference. The data
317317 * segments may not be usable (vm86 mode), and the stack segment may not
318318 * be flat (ESPFIX32).
319319 */
320- ALTERNATIVE "" , "verw %cs:mds_verw_sel " , X86_FEATURE_CLEAR_CPU_BUF
320+ ALTERNATIVE "" , "verw %cs:x86_verw_sel " , X86_FEATURE_CLEAR_CPU_BUF
321321#endif
322322.endm
323323
@@ -567,24 +567,24 @@ DECLARE_STATIC_KEY_FALSE(switch_mm_always_ibpb);
567567
568568DECLARE_STATIC_KEY_FALSE (switch_vcpu_ibpb );
569569
570- DECLARE_STATIC_KEY_FALSE (mds_idle_clear );
570+ DECLARE_STATIC_KEY_FALSE (cpu_buf_idle_clear );
571571
572572DECLARE_STATIC_KEY_FALSE (switch_mm_cond_l1d_flush );
573573
574574DECLARE_STATIC_KEY_FALSE (mmio_stale_data_clear );
575575
576- extern u16 mds_verw_sel ;
576+ extern u16 x86_verw_sel ;
577577
578578#include <asm/segment.h>
579579
580580/**
581- * mds_clear_cpu_buffers - Mitigation for MDS and TAA vulnerability
581+ * x86_clear_cpu_buffers - Buffer clearing support for different x86 CPU vulns
582582 *
583583 * This uses the otherwise unused and obsolete VERW instruction in
584584 * combination with microcode which triggers a CPU buffer flush when the
585585 * instruction is executed.
586586 */
587- static __always_inline void mds_clear_cpu_buffers (void )
587+ static __always_inline void x86_clear_cpu_buffers (void )
588588{
589589 static const u16 ds = __KERNEL_DS ;
590590
@@ -601,14 +601,15 @@ static __always_inline void mds_clear_cpu_buffers(void)
601601}
602602
603603/**
604- * mds_idle_clear_cpu_buffers - Mitigation for MDS vulnerability
604+ * x86_idle_clear_cpu_buffers - Buffer clearing support in idle for the MDS
605+ * vulnerability
605606 *
606607 * Clear CPU buffers if the corresponding static key is enabled
607608 */
608- static __always_inline void mds_idle_clear_cpu_buffers (void )
609+ static __always_inline void x86_idle_clear_cpu_buffers (void )
609610{
610- if (static_branch_likely (& mds_idle_clear ))
611- mds_clear_cpu_buffers ();
611+ if (static_branch_likely (& cpu_buf_idle_clear ))
612+ x86_clear_cpu_buffers ();
612613}
613614
614615#endif /* __ASSEMBLER__ */
0 commit comments