diff options
author | Matt DeVillier <matt.devillier@gmail.com> | 2016-12-14 16:12:43 -0600 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2016-12-27 02:30:08 +0100 |
commit | ed6fe2f64b37d0c6161b23b20980f91e0be7a1ea (patch) | |
tree | 99aa4d662a9210e157672d26b801c0a1fc78ccf4 /src/cpu/intel/model_1067x | |
parent | 2a5897526463dfe00feb06d99f850c2874d1d257 (diff) |
cpu/intel/common: Add/Use common function to set virtualization
Migrate duplicated enable_vmx() method from multiple CPUs to common
folder. Add common virtualization option for CPUs which support it.
Note that this changes the default to enable virtualization on CPUs
that support it.
Change-Id: Ib110bed6c9f5508e3f867dcdc6f341fc50e501d1
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-on: https://review.coreboot.org/17874
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/cpu/intel/model_1067x')
-rw-r--r-- | src/cpu/intel/model_1067x/Kconfig | 1 | ||||
-rw-r--r-- | src/cpu/intel/model_1067x/Makefile.inc | 1 | ||||
-rw-r--r-- | src/cpu/intel/model_1067x/model_1067x_init.c | 38 |
3 files changed, 5 insertions, 35 deletions
diff --git a/src/cpu/intel/model_1067x/Kconfig b/src/cpu/intel/model_1067x/Kconfig index 12f04cc2a1..2e154a3b66 100644 --- a/src/cpu/intel/model_1067x/Kconfig +++ b/src/cpu/intel/model_1067x/Kconfig @@ -9,3 +9,4 @@ config CPU_INTEL_MODEL_1067X # select UDELAY_LAPIC select TSC_SYNC_MFENCE select SUPPORT_CPU_UCODE_IN_CBFS + select CPU_INTEL_COMMON diff --git a/src/cpu/intel/model_1067x/Makefile.inc b/src/cpu/intel/model_1067x/Makefile.inc index 3e0af86338..3e6cb2c24b 100644 --- a/src/cpu/intel/model_1067x/Makefile.inc +++ b/src/cpu/intel/model_1067x/Makefile.inc @@ -1,4 +1,5 @@ ramstage-y += model_1067x_init.c subdirs-y += ../../x86/name +subdirs-y += ../common cpu_microcode_bins += 3rdparty/blobs/cpu/intel/model_1067x/microcode.bin diff --git a/src/cpu/intel/model_1067x/model_1067x_init.c b/src/cpu/intel/model_1067x/model_1067x_init.c index e28a331225..e0f74b25c1 100644 --- a/src/cpu/intel/model_1067x/model_1067x_init.c +++ b/src/cpu/intel/model_1067x/model_1067x_init.c @@ -27,7 +27,7 @@ #include <cpu/intel/hyperthreading.h> #include <cpu/x86/cache.h> #include <cpu/x86/name.h> - +#include <cpu/intel/common/common.h> #include "chip.h" static void init_timer(void) @@ -42,38 +42,6 @@ static void init_timer(void) lapic_write(LAPIC_TMICT, 0xffffffff); } -#define IA32_FEATURE_CONTROL 0x003a - -#define CPUID_VMX (1 << 5) -#define CPUID_SMX (1 << 6) -static void enable_vmx(void) -{ - struct cpuid_result regs; - msr_t msr; - - msr = rdmsr(IA32_FEATURE_CONTROL); - - if (msr.lo & (1 << 0)) { - /* VMX locked. If we set it again we get an illegal - * instruction - */ - return; - } - - regs = cpuid(1); - if (regs.ecx & CPUID_VMX) { - msr.lo |= (1 << 2); - if (regs.ecx & CPUID_SMX) - msr.lo |= (1 << 1); - } - - wrmsr(IA32_FEATURE_CONTROL, msr); - - msr.lo |= (1 << 0); /* Set lock bit */ - - wrmsr(IA32_FEATURE_CONTROL, msr); -} - #define MSR_BBL_CR_CTL3 0x11e static void configure_c_states(const int quad) @@ -328,8 +296,8 @@ static void model_1067x_init(struct device *cpu) /* Initialize the APIC timer */ init_timer(); - /* Enable virtualization */ - enable_vmx(); + /* Set virtualization based on Kconfig option */ + set_vmx(); /* Configure C States */ configure_c_states(quad); |