diff options
author | Elyes HAOUAS <ehaouas@noos.fr> | 2019-01-07 20:39:14 +0100 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2019-01-09 09:49:50 +0000 |
commit | 909870aba677bf6a30edc2ab971e312cb5826999 (patch) | |
tree | 4ead6b30d1a1ee1dc0be9021ae60c23cef8873ef /src/cpu/intel/common | |
parent | 8c70dd66da02f4ee46086f0bdc54b56e39c7054f (diff) | |
download | coreboot-909870aba677bf6a30edc2ab971e312cb5826999.tar.xz |
cpu/intel/common: Fix generated exception if not supported VMX
Reading rdmsr(IA32_FEATURE_CONTROL) in function set_feature_ctrl_lock()
will generate an exception if the CPU do not support this MSR.
Tested on pentium4 (CPUID F65).
Change-Id: I72e138e3bcffe1dcd4e20739a8d07c9abfab4f80
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/30713
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Diffstat (limited to 'src/cpu/intel/common')
-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); |