Skip to content

Commit 6a11c86

Browse files
yang-weijiangsean-jc
authored andcommitted
KVM: x86: Report KVM supported CET MSRs as to-be-saved
Add CET MSRs to the list of MSRs reported to userspace if the feature, i.e. IBT or SHSTK, associated with the MSRs is supported by KVM. Suggested-by: Chao Gao <[email protected]> Signed-off-by: Yang Weijiang <[email protected]> Tested-by: Mathias Krause <[email protected]> Tested-by: John Allen <[email protected]> Tested-by: Rick Edgecombe <[email protected]> Signed-off-by: Chao Gao <[email protected]> Reviewed-by: Binbin Wu <[email protected]> Reviewed-by: Xiaoyao Li <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 586ef9d commit 6a11c86

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

arch/x86/kvm/x86.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,10 @@ static const u32 msrs_to_save_base[] = {
344344
MSR_IA32_UMWAIT_CONTROL,
345345

346346
MSR_IA32_XFD, MSR_IA32_XFD_ERR, MSR_IA32_XSS,
347+
348+
MSR_IA32_U_CET, MSR_IA32_S_CET,
349+
MSR_IA32_PL0_SSP, MSR_IA32_PL1_SSP, MSR_IA32_PL2_SSP,
350+
MSR_IA32_PL3_SSP, MSR_IA32_INT_SSP_TAB,
347351
};
348352

349353
static const u32 msrs_to_save_pmu[] = {
@@ -7603,6 +7607,20 @@ static void kvm_probe_msr_to_save(u32 msr_index)
76037607
if (!kvm_caps.supported_xss)
76047608
return;
76057609
break;
7610+
case MSR_IA32_U_CET:
7611+
case MSR_IA32_S_CET:
7612+
if (!kvm_cpu_cap_has(X86_FEATURE_SHSTK) &&
7613+
!kvm_cpu_cap_has(X86_FEATURE_IBT))
7614+
return;
7615+
break;
7616+
case MSR_IA32_INT_SSP_TAB:
7617+
if (!kvm_cpu_cap_has(X86_FEATURE_LM))
7618+
return;
7619+
fallthrough;
7620+
case MSR_IA32_PL0_SSP ... MSR_IA32_PL3_SSP:
7621+
if (!kvm_cpu_cap_has(X86_FEATURE_SHSTK))
7622+
return;
7623+
break;
76067624
default:
76077625
break;
76087626
}

0 commit comments

Comments
 (0)