Skip to content

Commit 9f65fb2

Browse files
konradwilkKAGA-KOKO
authored andcommitted
x86/bugs: Rename _RDS to _SSBD
Intel collateral will reference the SSB mitigation bit in IA32_SPEC_CTL[2] as SSBD (Speculative Store Bypass Disable). Hence changing it. It is unclear yet what the MSR_IA32_ARCH_CAPABILITIES (0x10a) Bit(4) name is going to be. Following the rename it would be SSBD_NO but that rolls out to Speculative Store Bypass Disable No. Also fixed the missing space in X86_FEATURE_AMD_SSBD. [ tglx: Fixup x86_amd_rds_enable() and rds_tif_to_amd_ls_cfg() as well ] Signed-off-by: Konrad Rzeszutek Wilk <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]>
1 parent f21b53b commit 9f65fb2

File tree

11 files changed

+51
-51
lines changed

11 files changed

+51
-51
lines changed

arch/x86/include/asm/cpufeatures.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@
215215
#define X86_FEATURE_USE_IBPB ( 7*32+21) /* "" Indirect Branch Prediction Barrier enabled */
216216
#define X86_FEATURE_USE_IBRS_FW ( 7*32+22) /* "" Use IBRS during runtime firmware calls */
217217
#define X86_FEATURE_SPEC_STORE_BYPASS_DISABLE ( 7*32+23) /* "" Disable Speculative Store Bypass. */
218-
#define X86_FEATURE_AMD_RDS (7*32+24) /* "" AMD RDS implementation */
218+
#define X86_FEATURE_AMD_SSBD ( 7*32+24) /* "" AMD SSBD implementation */
219219

220220
/* Virtualization flags: Linux defined, word 8 */
221221
#define X86_FEATURE_TPR_SHADOW ( 8*32+ 0) /* Intel TPR Shadow */
@@ -336,7 +336,7 @@
336336
#define X86_FEATURE_SPEC_CTRL (18*32+26) /* "" Speculation Control (IBRS + IBPB) */
337337
#define X86_FEATURE_INTEL_STIBP (18*32+27) /* "" Single Thread Indirect Branch Predictors */
338338
#define X86_FEATURE_ARCH_CAPABILITIES (18*32+29) /* IA32_ARCH_CAPABILITIES MSR (Intel) */
339-
#define X86_FEATURE_RDS (18*32+31) /* Reduced Data Speculation */
339+
#define X86_FEATURE_SSBD (18*32+31) /* Speculative Store Bypass Disable */
340340

341341
/*
342342
* BUG word(s)

arch/x86/include/asm/msr-index.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
#define MSR_IA32_SPEC_CTRL 0x00000048 /* Speculation Control */
4343
#define SPEC_CTRL_IBRS (1 << 0) /* Indirect Branch Restricted Speculation */
4444
#define SPEC_CTRL_STIBP (1 << 1) /* Single Thread Indirect Branch Predictors */
45-
#define SPEC_CTRL_RDS_SHIFT 2 /* Reduced Data Speculation bit */
46-
#define SPEC_CTRL_RDS (1 << SPEC_CTRL_RDS_SHIFT) /* Reduced Data Speculation */
45+
#define SPEC_CTRL_SSBD_SHIFT 2 /* Speculative Store Bypass Disable bit */
46+
#define SPEC_CTRL_SSBD (1 << SPEC_CTRL_SSBD_SHIFT) /* Speculative Store Bypass Disable */
4747

4848
#define MSR_IA32_PRED_CMD 0x00000049 /* Prediction Command */
4949
#define PRED_CMD_IBPB (1 << 0) /* Indirect Branch Prediction Barrier */
@@ -70,10 +70,10 @@
7070
#define MSR_IA32_ARCH_CAPABILITIES 0x0000010a
7171
#define ARCH_CAP_RDCL_NO (1 << 0) /* Not susceptible to Meltdown */
7272
#define ARCH_CAP_IBRS_ALL (1 << 1) /* Enhanced IBRS support */
73-
#define ARCH_CAP_RDS_NO (1 << 4) /*
73+
#define ARCH_CAP_SSBD_NO (1 << 4) /*
7474
* Not susceptible to Speculative Store Bypass
75-
* attack, so no Reduced Data Speculation control
76-
* required.
75+
* attack, so no Speculative Store Bypass
76+
* control required.
7777
*/
7878

7979
#define MSR_IA32_BBL_CR_CTL 0x00000119

arch/x86/include/asm/spec-ctrl.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@ extern void x86_spec_ctrl_restore_host(u64);
1717

1818
/* AMD specific Speculative Store Bypass MSR data */
1919
extern u64 x86_amd_ls_cfg_base;
20-
extern u64 x86_amd_ls_cfg_rds_mask;
20+
extern u64 x86_amd_ls_cfg_ssbd_mask;
2121

2222
/* The Intel SPEC CTRL MSR base value cache */
2323
extern u64 x86_spec_ctrl_base;
2424

25-
static inline u64 rds_tif_to_spec_ctrl(u64 tifn)
25+
static inline u64 ssbd_tif_to_spec_ctrl(u64 tifn)
2626
{
27-
BUILD_BUG_ON(TIF_RDS < SPEC_CTRL_RDS_SHIFT);
28-
return (tifn & _TIF_RDS) >> (TIF_RDS - SPEC_CTRL_RDS_SHIFT);
27+
BUILD_BUG_ON(TIF_SSBD < SPEC_CTRL_SSBD_SHIFT);
28+
return (tifn & _TIF_SSBD) >> (TIF_SSBD - SPEC_CTRL_SSBD_SHIFT);
2929
}
3030

31-
static inline u64 rds_tif_to_amd_ls_cfg(u64 tifn)
31+
static inline u64 ssbd_tif_to_amd_ls_cfg(u64 tifn)
3232
{
33-
return (tifn & _TIF_RDS) ? x86_amd_ls_cfg_rds_mask : 0ULL;
33+
return (tifn & _TIF_SSBD) ? x86_amd_ls_cfg_ssbd_mask : 0ULL;
3434
}
3535

3636
extern void speculative_store_bypass_update(void);

arch/x86/include/asm/thread_info.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ struct thread_info {
7979
#define TIF_SIGPENDING 2 /* signal pending */
8080
#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
8181
#define TIF_SINGLESTEP 4 /* reenable singlestep on user return*/
82-
#define TIF_RDS 5 /* Reduced data speculation */
82+
#define TIF_SSBD 5 /* Reduced data speculation */
8383
#define TIF_SYSCALL_EMU 6 /* syscall emulation active */
8484
#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */
8585
#define TIF_SECCOMP 8 /* secure computing */
@@ -106,7 +106,7 @@ struct thread_info {
106106
#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
107107
#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
108108
#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
109-
#define _TIF_RDS (1 << TIF_RDS)
109+
#define _TIF_SSBD (1 << TIF_SSBD)
110110
#define _TIF_SYSCALL_EMU (1 << TIF_SYSCALL_EMU)
111111
#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
112112
#define _TIF_SECCOMP (1 << TIF_SECCOMP)
@@ -146,7 +146,7 @@ struct thread_info {
146146

147147
/* flags to check in __switch_to() */
148148
#define _TIF_WORK_CTXSW \
149-
(_TIF_IO_BITMAP|_TIF_NOCPUID|_TIF_NOTSC|_TIF_BLOCKSTEP|_TIF_RDS)
149+
(_TIF_IO_BITMAP|_TIF_NOCPUID|_TIF_NOTSC|_TIF_BLOCKSTEP|_TIF_SSBD)
150150

151151
#define _TIF_WORK_CTXSW_PREV (_TIF_WORK_CTXSW|_TIF_USER_RETURN_NOTIFY)
152152
#define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW)

arch/x86/kernel/cpu/amd.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -567,12 +567,12 @@ static void bsp_init_amd(struct cpuinfo_x86 *c)
567567
}
568568
/*
569569
* Try to cache the base value so further operations can
570-
* avoid RMW. If that faults, do not enable RDS.
570+
* avoid RMW. If that faults, do not enable SSBD.
571571
*/
572572
if (!rdmsrl_safe(MSR_AMD64_LS_CFG, &x86_amd_ls_cfg_base)) {
573-
setup_force_cpu_cap(X86_FEATURE_RDS);
574-
setup_force_cpu_cap(X86_FEATURE_AMD_RDS);
575-
x86_amd_ls_cfg_rds_mask = 1ULL << bit;
573+
setup_force_cpu_cap(X86_FEATURE_SSBD);
574+
setup_force_cpu_cap(X86_FEATURE_AMD_SSBD);
575+
x86_amd_ls_cfg_ssbd_mask = 1ULL << bit;
576576
}
577577
}
578578
}
@@ -920,9 +920,9 @@ static void init_amd(struct cpuinfo_x86 *c)
920920
if (!cpu_has(c, X86_FEATURE_XENPV))
921921
set_cpu_bug(c, X86_BUG_SYSRET_SS_ATTRS);
922922

923-
if (boot_cpu_has(X86_FEATURE_AMD_RDS)) {
924-
set_cpu_cap(c, X86_FEATURE_RDS);
925-
set_cpu_cap(c, X86_FEATURE_AMD_RDS);
923+
if (boot_cpu_has(X86_FEATURE_AMD_SSBD)) {
924+
set_cpu_cap(c, X86_FEATURE_SSBD);
925+
set_cpu_cap(c, X86_FEATURE_AMD_SSBD);
926926
}
927927
}
928928

arch/x86/kernel/cpu/bugs.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ static u64 __ro_after_init x86_spec_ctrl_mask = ~SPEC_CTRL_IBRS;
4545

4646
/*
4747
* AMD specific MSR info for Speculative Store Bypass control.
48-
* x86_amd_ls_cfg_rds_mask is initialized in identify_boot_cpu().
48+
* x86_amd_ls_cfg_ssbd_mask is initialized in identify_boot_cpu().
4949
*/
5050
u64 __ro_after_init x86_amd_ls_cfg_base;
51-
u64 __ro_after_init x86_amd_ls_cfg_rds_mask;
51+
u64 __ro_after_init x86_amd_ls_cfg_ssbd_mask;
5252

5353
void __init check_bugs(void)
5454
{
@@ -146,7 +146,7 @@ u64 x86_spec_ctrl_get_default(void)
146146
u64 msrval = x86_spec_ctrl_base;
147147

148148
if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
149-
msrval |= rds_tif_to_spec_ctrl(current_thread_info()->flags);
149+
msrval |= ssbd_tif_to_spec_ctrl(current_thread_info()->flags);
150150
return msrval;
151151
}
152152
EXPORT_SYMBOL_GPL(x86_spec_ctrl_get_default);
@@ -159,7 +159,7 @@ void x86_spec_ctrl_set_guest(u64 guest_spec_ctrl)
159159
return;
160160

161161
if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
162-
host |= rds_tif_to_spec_ctrl(current_thread_info()->flags);
162+
host |= ssbd_tif_to_spec_ctrl(current_thread_info()->flags);
163163

164164
if (host != guest_spec_ctrl)
165165
wrmsrl(MSR_IA32_SPEC_CTRL, guest_spec_ctrl);
@@ -174,18 +174,18 @@ void x86_spec_ctrl_restore_host(u64 guest_spec_ctrl)
174174
return;
175175

176176
if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
177-
host |= rds_tif_to_spec_ctrl(current_thread_info()->flags);
177+
host |= ssbd_tif_to_spec_ctrl(current_thread_info()->flags);
178178

179179
if (host != guest_spec_ctrl)
180180
wrmsrl(MSR_IA32_SPEC_CTRL, host);
181181
}
182182
EXPORT_SYMBOL_GPL(x86_spec_ctrl_restore_host);
183183

184-
static void x86_amd_rds_enable(void)
184+
static void x86_amd_ssb_disable(void)
185185
{
186-
u64 msrval = x86_amd_ls_cfg_base | x86_amd_ls_cfg_rds_mask;
186+
u64 msrval = x86_amd_ls_cfg_base | x86_amd_ls_cfg_ssbd_mask;
187187

188-
if (boot_cpu_has(X86_FEATURE_AMD_RDS))
188+
if (boot_cpu_has(X86_FEATURE_AMD_SSBD))
189189
wrmsrl(MSR_AMD64_LS_CFG, msrval);
190190
}
191191

@@ -473,7 +473,7 @@ static enum ssb_mitigation_cmd __init __ssb_select_mitigation(void)
473473
enum ssb_mitigation mode = SPEC_STORE_BYPASS_NONE;
474474
enum ssb_mitigation_cmd cmd;
475475

476-
if (!boot_cpu_has(X86_FEATURE_RDS))
476+
if (!boot_cpu_has(X86_FEATURE_SSBD))
477477
return mode;
478478

479479
cmd = ssb_parse_cmdline();
@@ -507,7 +507,7 @@ static enum ssb_mitigation_cmd __init __ssb_select_mitigation(void)
507507
/*
508508
* We have three CPU feature flags that are in play here:
509509
* - X86_BUG_SPEC_STORE_BYPASS - CPU is susceptible.
510-
* - X86_FEATURE_RDS - CPU is able to turn off speculative store bypass
510+
* - X86_FEATURE_SSBD - CPU is able to turn off speculative store bypass
511511
* - X86_FEATURE_SPEC_STORE_BYPASS_DISABLE - engage the mitigation
512512
*/
513513
if (mode == SPEC_STORE_BYPASS_DISABLE) {
@@ -518,12 +518,12 @@ static enum ssb_mitigation_cmd __init __ssb_select_mitigation(void)
518518
*/
519519
switch (boot_cpu_data.x86_vendor) {
520520
case X86_VENDOR_INTEL:
521-
x86_spec_ctrl_base |= SPEC_CTRL_RDS;
522-
x86_spec_ctrl_mask &= ~SPEC_CTRL_RDS;
523-
x86_spec_ctrl_set(SPEC_CTRL_RDS);
521+
x86_spec_ctrl_base |= SPEC_CTRL_SSBD;
522+
x86_spec_ctrl_mask &= ~SPEC_CTRL_SSBD;
523+
x86_spec_ctrl_set(SPEC_CTRL_SSBD);
524524
break;
525525
case X86_VENDOR_AMD:
526-
x86_amd_rds_enable();
526+
x86_amd_ssb_disable();
527527
break;
528528
}
529529
}
@@ -556,16 +556,16 @@ static int ssb_prctl_set(struct task_struct *task, unsigned long ctrl)
556556
if (task_spec_ssb_force_disable(task))
557557
return -EPERM;
558558
task_clear_spec_ssb_disable(task);
559-
update = test_and_clear_tsk_thread_flag(task, TIF_RDS);
559+
update = test_and_clear_tsk_thread_flag(task, TIF_SSBD);
560560
break;
561561
case PR_SPEC_DISABLE:
562562
task_set_spec_ssb_disable(task);
563-
update = !test_and_set_tsk_thread_flag(task, TIF_RDS);
563+
update = !test_and_set_tsk_thread_flag(task, TIF_SSBD);
564564
break;
565565
case PR_SPEC_FORCE_DISABLE:
566566
task_set_spec_ssb_disable(task);
567567
task_set_spec_ssb_force_disable(task);
568-
update = !test_and_set_tsk_thread_flag(task, TIF_RDS);
568+
update = !test_and_set_tsk_thread_flag(task, TIF_SSBD);
569569
break;
570570
default:
571571
return -ERANGE;
@@ -635,7 +635,7 @@ void x86_spec_ctrl_setup_ap(void)
635635
x86_spec_ctrl_set(x86_spec_ctrl_base & ~x86_spec_ctrl_mask);
636636

637637
if (ssb_mode == SPEC_STORE_BYPASS_DISABLE)
638-
x86_amd_rds_enable();
638+
x86_amd_ssb_disable();
639639
}
640640

641641
#ifdef CONFIG_SYSFS

arch/x86/kernel/cpu/common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,7 @@ static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c)
959959
rdmsrl(MSR_IA32_ARCH_CAPABILITIES, ia32_cap);
960960

961961
if (!x86_match_cpu(cpu_no_spec_store_bypass) &&
962-
!(ia32_cap & ARCH_CAP_RDS_NO))
962+
!(ia32_cap & ARCH_CAP_SSBD_NO))
963963
setup_force_cpu_bug(X86_BUG_SPEC_STORE_BYPASS);
964964

965965
if (x86_match_cpu(cpu_no_speculation))

arch/x86/kernel/cpu/intel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ static void early_init_intel(struct cpuinfo_x86 *c)
189189
setup_clear_cpu_cap(X86_FEATURE_STIBP);
190190
setup_clear_cpu_cap(X86_FEATURE_SPEC_CTRL);
191191
setup_clear_cpu_cap(X86_FEATURE_INTEL_STIBP);
192-
setup_clear_cpu_cap(X86_FEATURE_RDS);
192+
setup_clear_cpu_cap(X86_FEATURE_SSBD);
193193
}
194194

195195
/*

arch/x86/kernel/process.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,11 +283,11 @@ static __always_inline void __speculative_store_bypass_update(unsigned long tifn
283283
{
284284
u64 msr;
285285

286-
if (static_cpu_has(X86_FEATURE_AMD_RDS)) {
287-
msr = x86_amd_ls_cfg_base | rds_tif_to_amd_ls_cfg(tifn);
286+
if (static_cpu_has(X86_FEATURE_AMD_SSBD)) {
287+
msr = x86_amd_ls_cfg_base | ssbd_tif_to_amd_ls_cfg(tifn);
288288
wrmsrl(MSR_AMD64_LS_CFG, msr);
289289
} else {
290-
msr = x86_spec_ctrl_base | rds_tif_to_spec_ctrl(tifn);
290+
msr = x86_spec_ctrl_base | ssbd_tif_to_spec_ctrl(tifn);
291291
wrmsrl(MSR_IA32_SPEC_CTRL, msr);
292292
}
293293
}
@@ -329,7 +329,7 @@ void __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p,
329329
if ((tifp ^ tifn) & _TIF_NOCPUID)
330330
set_cpuid_faulting(!!(tifn & _TIF_NOCPUID));
331331

332-
if ((tifp ^ tifn) & _TIF_RDS)
332+
if ((tifp ^ tifn) & _TIF_SSBD)
333333
__speculative_store_bypass_update(tifn);
334334
}
335335

arch/x86/kvm/cpuid.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
407407

408408
/* cpuid 7.0.edx*/
409409
const u32 kvm_cpuid_7_0_edx_x86_features =
410-
F(AVX512_4VNNIW) | F(AVX512_4FMAPS) | F(SPEC_CTRL) | F(RDS) |
410+
F(AVX512_4VNNIW) | F(AVX512_4FMAPS) | F(SPEC_CTRL) | F(SSBD) |
411411
F(ARCH_CAPABILITIES);
412412

413413
/* all calls to cpuid_count() should be made on the same cpu */

arch/x86/kvm/vmx.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3525,7 +3525,7 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
35253525
if (!msr_info->host_initiated &&
35263526
!guest_cpuid_has(vcpu, X86_FEATURE_IBRS) &&
35273527
!guest_cpuid_has(vcpu, X86_FEATURE_SPEC_CTRL) &&
3528-
!guest_cpuid_has(vcpu, X86_FEATURE_RDS))
3528+
!guest_cpuid_has(vcpu, X86_FEATURE_SSBD))
35293529
return 1;
35303530

35313531
msr_info->data = to_vmx(vcpu)->spec_ctrl;
@@ -3645,11 +3645,11 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
36453645
if (!msr_info->host_initiated &&
36463646
!guest_cpuid_has(vcpu, X86_FEATURE_IBRS) &&
36473647
!guest_cpuid_has(vcpu, X86_FEATURE_SPEC_CTRL) &&
3648-
!guest_cpuid_has(vcpu, X86_FEATURE_RDS))
3648+
!guest_cpuid_has(vcpu, X86_FEATURE_SSBD))
36493649
return 1;
36503650

36513651
/* The STIBP bit doesn't fault even if it's not advertised */
3652-
if (data & ~(SPEC_CTRL_IBRS | SPEC_CTRL_STIBP | SPEC_CTRL_RDS))
3652+
if (data & ~(SPEC_CTRL_IBRS | SPEC_CTRL_STIBP | SPEC_CTRL_SSBD))
36533653
return 1;
36543654

36553655
vmx->spec_ctrl = data;

0 commit comments

Comments
 (0)