diff options
-rw-r--r-- | src/cpu/intel/common/common_init.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cpu/intel/common/common_init.c b/src/cpu/intel/common/common_init.c index 4f3bcacaf3..0aef3e873c 100644 --- a/src/cpu/intel/common/common_init.c +++ b/src/cpu/intel/common/common_init.c @@ -72,6 +72,13 @@ void set_feature_ctrl_lock(void) { msr_t msr; int lock = IS_ENABLED(CONFIG_SET_IA32_FC_LOCK_BIT); + uint32_t feature_flag = cpu_get_feature_flags_ecx(); + + /* Check if VMX is supported before reading or writing the MSR */ + if (!((feature_flag & CPUID_VMX) || (feature_flag & CPUID_SMX))) { + printk(BIOS_DEBUG, "Read IA32_FEATURE_CONTROL unsupported\n"); + return; + } msr = rdmsr(IA32_FEATURE_CONTROL); |