aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTycho Nightingale <tychon@FreeBSD.org>2014-05-30 23:37:31 +0000
committerTycho Nightingale <tychon@FreeBSD.org>2014-05-30 23:37:31 +0000
commit11669a681c56caee9513a6290c75fc76186c5d85 (patch)
tree37fb88f095a45cfd662c9e69823bb370475b89fe
parent368541ba1e13599fba3b70fccc335fdae4f74313 (diff)
Notes
-rw-r--r--sys/amd64/vmm/intel/vmx.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/amd64/vmm/intel/vmx.c b/sys/amd64/vmm/intel/vmx.c
index ba76f114f4532..85e176a2c0fe1 100644
--- a/sys/amd64/vmm/intel/vmx.c
+++ b/sys/amd64/vmm/intel/vmx.c
@@ -512,6 +512,15 @@ static void
vmx_enable(void *arg __unused)
{
int error;
+ uint64_t feature_control;
+
+ feature_control = rdmsr(MSR_IA32_FEATURE_CONTROL);
+ if ((feature_control & IA32_FEATURE_CONTROL_LOCK) == 0 ||
+ (feature_control & IA32_FEATURE_CONTROL_VMX_EN) == 0) {
+ wrmsr(MSR_IA32_FEATURE_CONTROL,
+ feature_control | IA32_FEATURE_CONTROL_VMX_EN |
+ IA32_FEATURE_CONTROL_LOCK);
+ }
load_cr4(rcr4() | CR4_VMXE);
@@ -547,7 +556,7 @@ vmx_init(int ipinum)
* are set (bits 0 and 2 respectively).
*/
feature_control = rdmsr(MSR_IA32_FEATURE_CONTROL);
- if ((feature_control & IA32_FEATURE_CONTROL_LOCK) == 0 ||
+ if ((feature_control & IA32_FEATURE_CONTROL_LOCK) == 1 &&
(feature_control & IA32_FEATURE_CONTROL_VMX_EN) == 0) {
printf("vmx_init: VMX operation disabled by BIOS\n");
return (ENXIO);