[coreboot-gerrit] Patch set updated for coreboot: 3e00f10 cpu/intel: Make VMX bit configurable in CMOS

Edward O'Callaghan (eocallaghan@alterapraxis.com) gerrit at coreboot.org
Wed Jul 30 04:48:04 CEST 2014


Edward O'Callaghan (eocallaghan at alterapraxis.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6413

-gerrit

commit 3e00f10fe3e10e0bef421f1af82695353392bfac
Author: Edward O'Callaghan <eocallaghan at alterapraxis.com>
Date:   Wed Jul 30 11:45:10 2014 +1000

    cpu/intel: Make VMX bit configurable in CMOS
    
    Use cmos.layout over Kconfig variable to make VMX setting runtime
    configurable. Fix the following boards cmos.layout to match:
    
     * intel/cougar_canyon2
     * kontron/ktqm77
    
    Change-Id: I097b708fa22c735e962556e5d9e57caa322e0b24
    Signed-off-by: Edward O'Callaghan <eocallaghan at alterapraxis.com>
---
 src/cpu/intel/fsp_model_206ax/Kconfig            |  6 +-----
 src/cpu/intel/fsp_model_206ax/model_206ax_init.c |  9 ++++++---
 src/cpu/intel/haswell/Kconfig                    |  4 ----
 src/cpu/intel/haswell/haswell_init.c             | 10 +++++++---
 src/cpu/intel/model_2065x/Kconfig                |  6 +-----
 src/cpu/intel/model_2065x/model_2065x_init.c     | 10 +++++++---
 src/cpu/intel/model_206ax/Kconfig                |  6 +-----
 src/cpu/intel/model_206ax/model_206ax_init.c     | 10 +++++++---
 src/mainboard/intel/cougar_canyon2/Kconfig       |  1 -
 src/mainboard/intel/cougar_canyon2/cmos.layout   |  3 ++-
 src/mainboard/kontron/ktqm77/Kconfig             |  1 -
 src/mainboard/kontron/ktqm77/cmos.layout         |  3 ++-
 12 files changed, 34 insertions(+), 35 deletions(-)

diff --git a/src/cpu/intel/fsp_model_206ax/Kconfig b/src/cpu/intel/fsp_model_206ax/Kconfig
index 043320c..b642e18 100644
--- a/src/cpu/intel/fsp_model_206ax/Kconfig
+++ b/src/cpu/intel/fsp_model_206ax/Kconfig
@@ -49,10 +49,6 @@ config SMM_TSEG_SIZE
 	hex
 	default 0x800000
 
-config ENABLE_VMX
-	bool "Enable VMX for virtualization"
-	default n
-
 config CPU_MICROCODE_CBFS_LOC
 	hex
 	depends on SUPPORT_CPU_UCODE_IN_CBFS
@@ -69,4 +65,4 @@ config MICROCODE_INCLUDE_PATH
 	default "../intel/cpu/ivybridge/microcode" if CPU_INTEL_FSP_MODEL_306AX
 	default "../intel/cpu/sandybridge/microcode" if CPU_INTEL_FSP_MODEL_206AX
 
-endif
+endif # CPU_INTEL_FSP_MODEL_206AX || CPU_INTEL_FSP_MODEL_306AX
diff --git a/src/cpu/intel/fsp_model_206ax/model_206ax_init.c b/src/cpu/intel/fsp_model_206ax/model_206ax_init.c
index 55e0d4c..fc5e729 100644
--- a/src/cpu/intel/fsp_model_206ax/model_206ax_init.c
+++ b/src/cpu/intel/fsp_model_206ax/model_206ax_init.c
@@ -40,7 +40,10 @@ static void toggle_vmx(void)
 {
 	struct cpuid_result regs;
 	msr_t msr;
-	int enable = IS_ENABLED(CONFIG_ENABLE_VMX);
+	u8 enable_vmx;
+
+	if (get_option(&enable_vmx, "enable_vmx") != CB_SUCCESS)
+		enable_vmx = 0; /* Default to disable VMX */
 
 	regs = cpuid(1);
 	/* Check that the VMX is supported before reading or writing the MSR. */
@@ -62,9 +65,9 @@ static void toggle_vmx(void)
 	 */
 	msr.hi = msr.lo = 0;
 
-	printk(BIOS_DEBUG, "%s VMX\n", enable ? "Enabling" : "Disabling");
+	printk(BIOS_DEBUG, "%s VMX\n", enable_vmx ? "Enabling" : "Disabling");
 
-	if (enable) {
+	if (enable_vmx) {
 		msr.lo |= (1 << 2);
 		if (regs.ecx & CPUID_SMX)
 			msr.lo |= (1 << 1);
diff --git a/src/cpu/intel/haswell/Kconfig b/src/cpu/intel/haswell/Kconfig
index 9e62ae5..9cda140 100644
--- a/src/cpu/intel/haswell/Kconfig
+++ b/src/cpu/intel/haswell/Kconfig
@@ -34,10 +34,6 @@ config SMM_TSEG_SIZE
 	hex
 	default 0x800000
 
-config ENABLE_VMX
-	bool "Enable VMX for virtualization"
-	default n
-
 config IED_REGION_SIZE
 	hex
 	default 0x400000
diff --git a/src/cpu/intel/haswell/haswell_init.c b/src/cpu/intel/haswell/haswell_init.c
index 162f802..f98c691 100644
--- a/src/cpu/intel/haswell/haswell_init.c
+++ b/src/cpu/intel/haswell/haswell_init.c
@@ -150,11 +150,15 @@ static acpi_cstate_t cstate_map[NUM_C_STATES] = {
 	},
 };
 
+/* Enable VMX for virtualization in cmos.layout */
 static void toggle_vmx(void)
 {
 	struct cpuid_result regs;
 	msr_t msr;
-	int enable = IS_ENABLED(CONFIG_ENABLE_VMX);
+	u8 enable_vmx;
+
+	if (get_option(&enable_vmx, "enable_vmx") != CB_SUCCESS)
+		enable_vmx = 0; /* Default to disable VMX */
 
 	regs = cpuid(1);
 	/* Check that the VMX is supported before reading or writing the MSR. */
@@ -176,9 +180,9 @@ static void toggle_vmx(void)
 	 */
 	msr.hi = msr.lo = 0;
 
-	printk(BIOS_DEBUG, "%s VMX\n", enable ? "Enabling" : "Disabling");
+	printk(BIOS_DEBUG, "%s VMX\n", enable_vmx ? "Enabling" : "Disabling");
 
-	if (enable) {
+	if (enable_vmx) {
 		msr.lo |= (1 << 2);
 		if (regs.ecx & CPUID_SMX)
 			msr.lo |= (1 << 1);
diff --git a/src/cpu/intel/model_2065x/Kconfig b/src/cpu/intel/model_2065x/Kconfig
index 8185d3a..7bd6f88 100644
--- a/src/cpu/intel/model_2065x/Kconfig
+++ b/src/cpu/intel/model_2065x/Kconfig
@@ -28,12 +28,8 @@ config SMM_TSEG_SIZE
 	hex
 	default 0x800000
 
-config ENABLE_VMX
-	bool "Enable VMX for virtualization"
-	default n
-
 config XIP_ROM_SIZE
 	hex
 	default 0x20000
 
-endif
+endif # CPU_INTEL_MODEL_2065X
diff --git a/src/cpu/intel/model_2065x/model_2065x_init.c b/src/cpu/intel/model_2065x/model_2065x_init.c
index 2cff908..2b7ab46 100644
--- a/src/cpu/intel/model_2065x/model_2065x_init.c
+++ b/src/cpu/intel/model_2065x/model_2065x_init.c
@@ -114,11 +114,15 @@ static acpi_cstate_t cstate_map[] = {
 	{ 0 }
 };
 
+/* Enable VMX for virtualization in cmos.layout */
 static void toggle_vmx(void)
 {
 	struct cpuid_result regs;
 	msr_t msr;
-	int enable = CONFIG_ENABLE_VMX;
+	u8 enable_vmx;
+
+	if (get_option(&enable_vmx, "enable_vmx") != CB_SUCCESS)
+		enable_vmx = 0; /* Default to disable VMX */
 
 	regs = cpuid(1);
 	/* Check that the VMX is supported before reading or writing the MSR. */
@@ -140,7 +144,7 @@ static void toggle_vmx(void)
 	 */
 	msr.hi = msr.lo = 0;
 
-	printk(BIOS_DEBUG, "%s VMX\n", enable ? "Enabling" : "Disabling");
+	printk(BIOS_DEBUG, "%s VMX\n", enable_vmx ? "Enabling" : "Disabling");
 
 	/* Even though the Intel manual says you must set the lock bit in addition
 	 * to the VMX bit in order for VMX to work, it is incorrect.  Thus we leave
@@ -155,7 +159,7 @@ static void toggle_vmx(void)
 	 * By leaving this to the OS (e.g. Linux), people can do exactly what they
 	 * want on the fly, and do it correctly (e.g. across multiple cores).
 	 */
-	if (enable) {
+	if (enable_vmx) {
 		msr.lo |= (1 << 2);
 		if (regs.ecx & CPUID_SMX)
 			msr.lo |= (1 << 1);
diff --git a/src/cpu/intel/model_206ax/Kconfig b/src/cpu/intel/model_206ax/Kconfig
index afd155a..8a6cc65 100644
--- a/src/cpu/intel/model_206ax/Kconfig
+++ b/src/cpu/intel/model_206ax/Kconfig
@@ -29,8 +29,4 @@ config SMM_TSEG_SIZE
 	hex
 	default 0x800000
 
-config ENABLE_VMX
-	bool "Enable VMX for virtualization"
-	default n
-
-endif
+endif # CPU_INTEL_MODEL_206AX || CPU_INTEL_MODEL_306AX
diff --git a/src/cpu/intel/model_206ax/model_206ax_init.c b/src/cpu/intel/model_206ax/model_206ax_init.c
index 892d0d2..590e086 100644
--- a/src/cpu/intel/model_206ax/model_206ax_init.c
+++ b/src/cpu/intel/model_206ax/model_206ax_init.c
@@ -114,11 +114,15 @@ static acpi_cstate_t cstate_map[] = {
 	{ 0 }
 };
 
+/* Enable VMX for virtualization in cmos.layout */
 static void toggle_vmx(void)
 {
 	struct cpuid_result regs;
 	msr_t msr;
-	int enable = CONFIG_ENABLE_VMX;
+	u8 enable_vmx;
+
+	if (get_option(&enable_vmx, "enable_vmx") != CB_SUCCESS)
+		enable_vmx = 0; /* Default to disable VMX */
 
 	regs = cpuid(1);
 	/* Check that the VMX is supported before reading or writing the MSR. */
@@ -140,7 +144,7 @@ static void toggle_vmx(void)
 	 */
 	msr.hi = msr.lo = 0;
 
-	printk(BIOS_DEBUG, "%s VMX\n", enable ? "Enabling" : "Disabling");
+	printk(BIOS_DEBUG, "%s VMX\n", enable_vmx ? "Enabling" : "Disabling");
 
 	/* Even though the Intel manual says you must set the lock bit in addition
 	 * to the VMX bit in order for VMX to work, it is incorrect.  Thus we leave
@@ -155,7 +159,7 @@ static void toggle_vmx(void)
 	 * By leaving this to the OS (e.g. Linux), people can do exactly what they
 	 * want on the fly, and do it correctly (e.g. across multiple cores).
 	 */
-	if (enable) {
+	if (enable_vmx) {
 		msr.lo |= (1 << 2);
 		if (regs.ecx & CPUID_SMX)
 			msr.lo |= (1 << 1);
diff --git a/src/mainboard/intel/cougar_canyon2/Kconfig b/src/mainboard/intel/cougar_canyon2/Kconfig
index 389a13c..4b0927f 100644
--- a/src/mainboard/intel/cougar_canyon2/Kconfig
+++ b/src/mainboard/intel/cougar_canyon2/Kconfig
@@ -10,7 +10,6 @@ config BOARD_SPECIFIC_OPTIONS # dummy
 	select HAVE_OPTION_TABLE
 	select MMCONF_SUPPORT
 	select SUPERIO_SMSC_SIO1007
-	select ENABLE_VMX
 	select EARLY_CBMEM_INIT
 	select BROKEN_CAR_MIGRATE
 	select VGA
diff --git a/src/mainboard/intel/cougar_canyon2/cmos.layout b/src/mainboard/intel/cougar_canyon2/cmos.layout
index 2dfa156..b8d50a3 100644
--- a/src/mainboard/intel/cougar_canyon2/cmos.layout
+++ b/src/mainboard/intel/cougar_canyon2/cmos.layout
@@ -63,7 +63,8 @@ entries
 
 # -----------------------------------------------------------------
 0          120       r       0        reserved_memory
-#120        264       r       0        unused
+120        1       e       1        enable_vmx
+#121        263       r       0        unused
 
 # -----------------------------------------------------------------
 # RTC_BOOT_BYTE (coreboot hardcoded)
diff --git a/src/mainboard/kontron/ktqm77/Kconfig b/src/mainboard/kontron/ktqm77/Kconfig
index d1a7d42..226368f 100644
--- a/src/mainboard/kontron/ktqm77/Kconfig
+++ b/src/mainboard/kontron/ktqm77/Kconfig
@@ -12,7 +12,6 @@ config BOARD_SPECIFIC_OPTIONS # dummy
 	select HAVE_OPTION_TABLE
 	select HAVE_ACPI_RESUME
 	select HAVE_SMI_HANDLER
-	select ENABLE_VMX
 	select HAVE_MRC
 
 config MAINBOARD_DIR
diff --git a/src/mainboard/kontron/ktqm77/cmos.layout b/src/mainboard/kontron/ktqm77/cmos.layout
index 245b47e..b9577e0 100644
--- a/src/mainboard/kontron/ktqm77/cmos.layout
+++ b/src/mainboard/kontron/ktqm77/cmos.layout
@@ -63,7 +63,8 @@ entries
 
 # -----------------------------------------------------------------
 0          120       r       0        reserved_memory
-#120        264       r       0        unused
+120        1       e       1        enable_vmx
+#121        263       r       0        unused
 
 # -----------------------------------------------------------------
 # RTC_BOOT_BYTE (coreboot hardcoded)



More information about the coreboot-gerrit mailing list