Skip to content

Commit 076a30b

Browse files
yonghuahwenlingz
authored andcommitted
hv: refine security capability detection function.
ACRN hypervisor always print CPU microcode update warning message on KBL NUC platform, even after BIOS was updated to the latest. 'check_cpu_security_cap()' returns false if no ARCH_CAPABILITIES MSR support on current platform, but this MSR may not be available on some platforms. This patch is to remove this pre-condition. Tracked-On: #3317 Signed-off-by: Yonghua Huang <yonghua.huang@intel.com> Reviewed-by: Jason CJ Chen <jason.cj.chen@intel.com>
1 parent 127c98f commit 076a30b

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

hypervisor/arch/x86/security.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,16 @@ bool check_cpu_security_cap(void)
5959
x86_arch_capabilities = msr_read(MSR_IA32_ARCH_CAPABILITIES);
6060
skip_l1dfl_vmentry = ((x86_arch_capabilities
6161
& IA32_ARCH_CAP_SKIP_L1DFL_VMENTRY) != 0UL);
62+
}
6263

63-
if ((!pcpu_has_cap(X86_FEATURE_L1D_FLUSH)) && (!skip_l1dfl_vmentry)) {
64-
ret = false;
65-
} else if ((!pcpu_has_cap(X86_FEATURE_IBRS_IBPB)) &&
66-
(!pcpu_has_cap(X86_FEATURE_STIBP))) {
67-
ret = false;
68-
} else {
69-
/* No other state currently, do nothing */
70-
}
71-
} else {
64+
if ((!pcpu_has_cap(X86_FEATURE_L1D_FLUSH)) && (!skip_l1dfl_vmentry)) {
65+
/* Processor is affected by L1TF CPU vulnerability,
66+
* but no L1D_FLUSH command support.
67+
*/
68+
ret = false;
69+
}
70+
71+
if ((!pcpu_has_cap(X86_FEATURE_IBRS_IBPB)) && (!pcpu_has_cap(X86_FEATURE_STIBP))) {
7272
ret = false;
7373
}
7474

hypervisor/include/arch/x86/security.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
/* type of speculation control
1111
* 0 - no speculation control support
12-
* 1 - raw IBRS + IPBP support
12+
* 1 - raw IBRS + IBPB support
1313
* 2 - with STIBP optimization support
1414
*/
1515
#define IBRS_NONE 0

0 commit comments

Comments
 (0)