summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMike Larkin <mlarkin@cvs.openbsd.org>2015-12-06 01:16:59 +0000
committerMike Larkin <mlarkin@cvs.openbsd.org>2015-12-06 01:16:59 +0000
commit84b36074604544e6acd5b15fd98d9fc24f0b892e (patch)
tree18e1e0b172ee5f141d55c0943f23612ab7392186 /sys/arch
parentd5d4daedcd59e86686b9eb74f78039bae423b84c (diff)
restore VMM mode after resume from suspend/hibernate
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/amd64/amd64/cpu.c7
-rw-r--r--sys/arch/amd64/amd64/vmm.c5
2 files changed, 9 insertions, 3 deletions
diff --git a/sys/arch/amd64/amd64/cpu.c b/sys/arch/amd64/amd64/cpu.c
index b4fee53307d..406fafbbd83 100644
--- a/sys/arch/amd64/amd64/cpu.c
+++ b/sys/arch/amd64/amd64/cpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.c,v 1.91 2015/11/23 22:57:12 deraadt Exp $ */
+/* $OpenBSD: cpu.c,v 1.92 2015/12/06 01:16:58 mlarkin Exp $ */
/* $NetBSD: cpu.c,v 1.1 2003/04/26 18:39:26 fvdl Exp $ */
/*-
@@ -91,6 +91,7 @@
#include <machine/segments.h>
#include <machine/gdt.h>
#include <machine/pio.h>
+#include <machine/vmmvar.h>
#if NLAPIC > 0
#include <machine/apicvar.h>
@@ -516,6 +517,10 @@ cpu_init(struct cpu_info *ci)
fpu_save_len = ebx;
}
+ /* Re-enable VMM if needed */
+ if (ci->ci_flags & CPUF_VMM)
+ start_vmm_on_cpu(ci);
+
#ifdef MULTIPROCESSOR
ci->ci_flags |= CPUF_RUNNING;
tlbflushg();
diff --git a/sys/arch/amd64/amd64/vmm.c b/sys/arch/amd64/amd64/vmm.c
index 9ef52a67dd0..4459933af98 100644
--- a/sys/arch/amd64/amd64/vmm.c
+++ b/sys/arch/amd64/amd64/vmm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmm.c,v 1.15 2015/12/01 12:03:55 mpi Exp $ */
+/* $OpenBSD: vmm.c,v 1.16 2015/12/06 01:16:58 mlarkin Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
@@ -647,7 +647,8 @@ start_vmm_on_cpu(struct cpu_info *ci)
uint32_t cr4;
/* No VMM mode? exit. */
- if (ci->ci_flags & CPUF_VMM)
+ if ((ci->ci_vmm_flags & CI_VMM_VMX) == 0 &&
+ (ci->ci_vmm_flags & CI_VMM_SVM) == 0)
return;
/*