summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorStefan Fritsch <sf@cvs.openbsd.org>2015-09-11 14:26:13 +0000
committerStefan Fritsch <sf@cvs.openbsd.org>2015-09-11 14:26:13 +0000
commit087bd0466492520e20b5013d2266267e903e46b4 (patch)
tree5c4cc495cbc8023169e6d67adbef570ba2333cb1 /sys/arch
parent8ef3153da8bdf8e09981342d639964f2330bccb5 (diff)
Save/restore MSR_APICBASE during suspend/resume
This register contains the x2apic enable bit. Restoring it re-enables x2apic on the application processors at resume. On the boot processor, the normal initialization code path is used. Tested by many OK mlarkin@ "Go for it" deraadt@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/amd64/amd64/acpi_wakecode.S21
1 files changed, 20 insertions, 1 deletions
diff --git a/sys/arch/amd64/amd64/acpi_wakecode.S b/sys/arch/amd64/amd64/acpi_wakecode.S
index 0f2626476a8..68fe65b83af 100644
--- a/sys/arch/amd64/amd64/acpi_wakecode.S
+++ b/sys/arch/amd64/amd64/acpi_wakecode.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi_wakecode.S,v 1.36 2015/06/22 20:06:11 bluhm Exp $ */
+/* $OpenBSD: acpi_wakecode.S,v 1.37 2015/09/11 14:26:12 sf Exp $ */
/*
* Copyright (c) 2001 Takanori Watanabe <takawata@jp.freebsd.org>
* Copyright (c) 2001 Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
@@ -52,6 +52,7 @@
#include <machine/param.h>
#include <machine/segments.h>
#include <dev/acpi/acpivar.h>
+#include "lapic.h"
#define _ACPI_TRMP_LABEL(a) a = . - _C_LABEL(acpi_real_mode_resume) + \
ACPI_TRAMPOLINE
@@ -245,6 +246,13 @@ _C_LABEL(acpi_long_mode_resume):
movw %ax, %gs
/* Restore registers - start with the MSRs */
+#if NLAPIC > 0
+ movl $MSR_APICBASE, %ecx
+ movl acpi_saved_apicbase, %eax
+ movl acpi_saved_apicbase+4, %edx
+ wrmsr
+#endif
+
movl $MSR_STAR, %ecx
movl acpi_saved_star, %eax
movl acpi_saved_star+4, %edx
@@ -623,6 +631,10 @@ _ACPI_TRMP_DATA_LABEL(acpi_saved_cstar)
.quad 0
_ACPI_TRMP_DATA_LABEL(acpi_saved_sfmask)
.quad 0
+#if NLAPIC > 0
+_ACPI_TRMP_DATA_LABEL(acpi_saved_apicbase)
+ .quad 0
+#endif
.align 4
_ACPI_TRMP_DATA_LABEL(acpi_pdirpa)
@@ -682,6 +694,13 @@ NENTRY(acpi_savecpu)
pushq %rcx
pushq %rdx
+#if NLAPIC > 0
+ movl $MSR_APICBASE, %ecx
+ rdmsr
+ movl %eax, acpi_saved_apicbase
+ movl %edx, acpi_saved_apicbase+4
+#endif
+
movl $MSR_STAR, %ecx
rdmsr
movl %eax, acpi_saved_star