mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-06 19:30:46 +00:00
HV: add CPU capabilities detection for L1TF mitigation
- detect if current processor is affected by L1TF - detect the presence of of "IA32_FLUSH_CMD(MSR 0x10B) if processor is affected by L1TF. Tracked-On: #1672 Signed-off-by: Yonghua Huang <yonghua.huang@intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
This commit is contained in:
@@ -30,6 +30,8 @@ uint64_t pcpu_active_bitmap = 0UL;
|
||||
|
||||
/* X2APIC mode is disabled by default. */
|
||||
bool x2apic_enabled = false;
|
||||
static bool skip_l1dfl_vmentry;
|
||||
static uint64_t x86_arch_capabilities;
|
||||
|
||||
/* TODO: add more capability per requirement */
|
||||
/* APICv features */
|
||||
@@ -418,6 +420,18 @@ void bsp_boot_init(void)
|
||||
|
||||
static bool check_cpu_security_config(void)
|
||||
{
|
||||
if (cpu_has_cap(X86_FEATURE_ARCH_CAP)) {
|
||||
x86_arch_capabilities = msr_read(MSR_IA32_ARCH_CAPABILITIES);
|
||||
skip_l1dfl_vmentry = ((x86_arch_capabilities
|
||||
& IA32_ARCH_CAP_SKIP_L1DFL_VMENTRY) != 0UL);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((!cpu_has_cap(X86_FEATURE_L1D_FLUSH)) && (!skip_l1dfl_vmentry)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!cpu_has_cap(X86_FEATURE_IBRS_IBPB) &&
|
||||
!cpu_has_cap(X86_FEATURE_STIBP)) {
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user