mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-01-06 08:04:55 +00:00
hv: coding style: refine cpu related function to one exit
2) Fix procedure has more than one exit point. Tracked-On: #861 Signed-off-by: Li, Fei1 <fei1.li@intel.com>
This commit is contained in:
@@ -51,6 +51,7 @@ int32_t get_ibrs_type(void)
|
||||
|
||||
bool check_cpu_security_cap(void)
|
||||
{
|
||||
bool ret = true;
|
||||
uint64_t x86_arch_capabilities;
|
||||
|
||||
detect_ibrs();
|
||||
@@ -59,20 +60,18 @@ bool check_cpu_security_cap(void)
|
||||
x86_arch_capabilities = msr_read(MSR_IA32_ARCH_CAPABILITIES);
|
||||
skip_l1dfl_vmentry = ((x86_arch_capabilities
|
||||
& IA32_ARCH_CAP_SKIP_L1DFL_VMENTRY) != 0UL);
|
||||
|
||||
if ((!cpu_has_cap(X86_FEATURE_L1D_FLUSH)) && (!skip_l1dfl_vmentry)) {
|
||||
ret = false;
|
||||
} else if ((!cpu_has_cap(X86_FEATURE_IBRS_IBPB)) &&
|
||||
(!cpu_has_cap(X86_FEATURE_STIBP))) {
|
||||
ret = false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
ret = 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;
|
||||
}
|
||||
|
||||
return true;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void cpu_l1d_flush(void)
|
||||
|
||||
Reference in New Issue
Block a user