summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMike Larkin <mlarkin@cvs.openbsd.org>2016-09-27 08:04:50 +0000
committerMike Larkin <mlarkin@cvs.openbsd.org>2016-09-27 08:04:50 +0000
commit5b57e4b0afe8157a213ddf7cbd1ca0a085cd745c (patch)
tree46cc9fb98a8e8fb9bd710317d93070638b6ed8f4 /sys
parentcf4e08f2c7593ebe5dcc5bd9131b55bd7b48248d (diff)
read and cache VMFUNC capability during boot. for use in an upcoming diff
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/identcpu.c7
-rw-r--r--sys/arch/amd64/include/cpu.h3
-rw-r--r--sys/arch/amd64/include/specialreg.h3
3 files changed, 10 insertions, 3 deletions
diff --git a/sys/arch/amd64/amd64/identcpu.c b/sys/arch/amd64/amd64/identcpu.c
index 0ed16091edf..bbf6ba0e635 100644
--- a/sys/arch/amd64/amd64/identcpu.c
+++ b/sys/arch/amd64/amd64/identcpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: identcpu.c,v 1.74 2016/09/03 12:12:43 mlarkin Exp $ */
+/* $OpenBSD: identcpu.c,v 1.75 2016/09/27 08:04:49 mlarkin Exp $ */
/* $NetBSD: identcpu.c,v 1.1 2003/04/26 18:39:28 fvdl Exp $ */
/*
@@ -814,6 +814,11 @@ cpu_check_vmm_cap(struct cpu_info *ci)
/* EPT available? */
if (msr & (IA32_VMX_ENABLE_EPT) << 32)
ci->ci_vmm_flags |= CI_VMM_EPT;
+ /* VM Functions available? */
+ if (msr & (IA32_VMX_ENABLE_VM_FUNCTIONS) << 32) {
+ ci->ci_vmm_cap.vcc_vmx.vmx_vm_func =
+ rdmsr(IA32_VMX_VMFUNC);
+ }
}
}
diff --git a/sys/arch/amd64/include/cpu.h b/sys/arch/amd64/include/cpu.h
index 81050a320f0..5c83a5a2ca9 100644
--- a/sys/arch/amd64/include/cpu.h
+++ b/sys/arch/amd64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.103 2016/09/04 09:22:28 mpi Exp $ */
+/* $OpenBSD: cpu.h,v 1.104 2016/09/27 08:04:49 mlarkin Exp $ */
/* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */
/*-
@@ -69,6 +69,7 @@ struct vmx {
uint64_t vmx_cr4_fixed1;
uint32_t vmx_vmxon_revision;
uint32_t vmx_msr_table_size;
+ uint64_t vmx_vm_func;
};
/*
diff --git a/sys/arch/amd64/include/specialreg.h b/sys/arch/amd64/include/specialreg.h
index 0aca5d354dc..bbd03d4d51c 100644
--- a/sys/arch/amd64/include/specialreg.h
+++ b/sys/arch/amd64/include/specialreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: specialreg.h,v 1.48 2016/09/10 17:15:44 mlarkin Exp $ */
+/* $OpenBSD: specialreg.h,v 1.49 2016/09/27 08:04:49 mlarkin Exp $ */
/* $NetBSD: specialreg.h,v 1.1 2003/04/26 18:39:48 fvdl Exp $ */
/* $NetBSD: x86/specialreg.h,v 1.2 2003/04/25 21:54:30 fvdl Exp $ */
@@ -861,6 +861,7 @@
#define IA32_VMX_TRUE_PROCBASED_CTLS 0x48E
#define IA32_VMX_TRUE_EXIT_CTLS 0x48F
#define IA32_VMX_TRUE_ENTRY_CTLS 0x490
+#define IA32_VMX_VMFUNC 0x491
#define IA32_EPT_VPID_CAP_PAGE_WALK_4 (1ULL << 6)
#define IA32_EPT_VPID_CAP_WB (1ULL << 14)