summaryrefslogtreecommitdiff
path: root/sys/arch/amd64
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2013-03-20 21:23:06 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2013-03-20 21:23:06 +0000
commita8e9717221fc66f8204568908941eebdc146de91 (patch)
tree8fa415bd841f3c09eb5f8a29d5971036d990aa02 /sys/arch/amd64
parent88aa824b77244ed6b16a1f83a769df13bc483014 (diff)
Previous commit to acpi_machdep.c broke suspend because the IPI to save the
FPU state needs a little bit more setup. Fix things properly this time by simplifying matters and saving the FPU state from the IPI that halts the CPU. With help from deraadt@ and mlarkin@. ok deraadt@, mlarkin@
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r--sys/arch/amd64/amd64/acpi_machdep.c18
-rw-r--r--sys/arch/amd64/amd64/ipifuncs.c3
2 files changed, 7 insertions, 14 deletions
diff --git a/sys/arch/amd64/amd64/acpi_machdep.c b/sys/arch/amd64/amd64/acpi_machdep.c
index 93147f53f41..a8486017adc 100644
--- a/sys/arch/amd64/amd64/acpi_machdep.c
+++ b/sys/arch/amd64/amd64/acpi_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi_machdep.c,v 1.53 2013/03/19 06:46:27 deraadt Exp $ */
+/* $OpenBSD: acpi_machdep.c,v 1.54 2013/03/20 21:23:05 kettenis Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -356,18 +356,10 @@ acpi_sleep_mp(void)
sched_stop_secondary_cpus();
KASSERT(CPU_IS_PRIMARY(curcpu()));
- /* Wait for cpus to save their floating point context */
- x86_broadcast_ipi(X86_IPI_SYNCH_FPU);
- for (i = 0; i < ncpus; i++) {
- struct cpu_info *ci = cpu_info[i];
-
- if (CPU_IS_PRIMARY(ci))
- continue;
- while (ci->ci_fpcurproc)
- ;
- }
-
- /* Wait for cpus to halt so we know their caches are written back */
+ /*
+ * Wait for cpus to halt so we know their FPU state has been
+ * saved and their caches have been written back.
+ */
x86_broadcast_ipi(X86_IPI_HALT);
for (i = 0; i < ncpus; i++) {
struct cpu_info *ci = cpu_info[i];
diff --git a/sys/arch/amd64/amd64/ipifuncs.c b/sys/arch/amd64/amd64/ipifuncs.c
index ffeb7c71e3f..ad60e6944de 100644
--- a/sys/arch/amd64/amd64/ipifuncs.c
+++ b/sys/arch/amd64/amd64/ipifuncs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipifuncs.c,v 1.17 2012/12/05 23:20:10 deraadt Exp $ */
+/* $OpenBSD: ipifuncs.c,v 1.18 2013/03/20 21:23:05 kettenis Exp $ */
/* $NetBSD: ipifuncs.c,v 1.1 2003/04/26 18:39:28 fvdl Exp $ */
/*-
@@ -93,6 +93,7 @@ void
x86_64_ipi_halt(struct cpu_info *ci)
{
SCHED_ASSERT_UNLOCKED();
+ fpusave_cpu(ci, 1);
disable_intr();
wbinvd();
ci->ci_flags &= ~CPUF_RUNNING;