summaryrefslogtreecommitdiff
path: root/sys/arch/i386
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/i386
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/i386')
-rw-r--r--sys/arch/i386/i386/acpi_machdep.c20
-rw-r--r--sys/arch/i386/i386/ipifuncs.c3
2 files changed, 8 insertions, 15 deletions
diff --git a/sys/arch/i386/i386/acpi_machdep.c b/sys/arch/i386/i386/acpi_machdep.c
index e1d00650144..15ce3419ef8 100644
--- a/sys/arch/i386/i386/acpi_machdep.c
+++ b/sys/arch/i386/i386/acpi_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi_machdep.c,v 1.47 2013/03/19 06:46:28 deraadt Exp $ */
+/* $OpenBSD: acpi_machdep.c,v 1.48 2013/03/20 21:23:05 kettenis Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -374,25 +374,17 @@ acpi_resume_cpu(struct acpi_softc *sc)
#ifdef MULTIPROCESSOR
void
-acpi_sleep_mp()
+acpi_sleep_mp(void)
{
int i;
sched_stop_secondary_cpus();
KASSERT(CPU_IS_PRIMARY(curcpu()));
- /* Wait for cpus to save their floating point context */
- i386_broadcast_ipi(I386_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.
+ */
i386_broadcast_ipi(I386_IPI_HALT);
for (i = 0; i < ncpus; i++) {
struct cpu_info *ci = cpu_info[i];
diff --git a/sys/arch/i386/i386/ipifuncs.c b/sys/arch/i386/i386/ipifuncs.c
index 80ba35153cd..f3ba957a08e 100644
--- a/sys/arch/i386/i386/ipifuncs.c
+++ b/sys/arch/i386/i386/ipifuncs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipifuncs.c,v 1.20 2012/12/05 23:20:12 deraadt Exp $ */
+/* $OpenBSD: ipifuncs.c,v 1.21 2013/03/20 21:23:05 kettenis Exp $ */
/* $NetBSD: ipifuncs.c,v 1.1.2.3 2000/06/26 02:04:06 sommerfeld Exp $ */
/*-
@@ -99,6 +99,7 @@ void
i386_ipi_halt(struct cpu_info *ci)
{
SCHED_ASSERT_UNLOCKED();
+ npxsave_cpu(ci, 1);
disable_intr();
wbinvd();
ci->ci_flags &= ~CPUF_RUNNING;