Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/sys/arch/x86/acpi Pull up following revision(s) (requeste...



details:   https://anonhg.NetBSD.org/src/rev/8e91b3678450
branches:  netbsd-8
changeset: 434949:8e91b3678450
user:      martin <martin%NetBSD.org@localhost>
date:      Fri May 04 16:07:59 2018 +0000

description:
Pull up following revision(s) (requested by maya in ticket #784):
        sys/arch/x86/acpi/acpi_wakeup.c: revision 1.46
Save and restore xcr0 when doing ACPI sleeps. Should fix PR/49174.

diffstat:

 sys/arch/x86/acpi/acpi_wakeup.c |  24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)

diffs (78 lines):

diff -r 7f0d88b7f35d -r 8e91b3678450 sys/arch/x86/acpi/acpi_wakeup.c
--- a/sys/arch/x86/acpi/acpi_wakeup.c   Fri May 04 16:03:32 2018 +0000
+++ b/sys/arch/x86/acpi/acpi_wakeup.c   Fri May 04 16:07:59 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi_wakeup.c,v 1.45 2016/10/20 16:05:04 maxv Exp $    */
+/*     $NetBSD: acpi_wakeup.c,v 1.45.8.1 2018/05/04 16:07:59 martin Exp $      */
 
 /*-
  * Copyright (c) 2002, 2011 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.45 2016/10/20 16:05:04 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.45.8.1 2018/05/04 16:07:59 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -250,6 +250,7 @@
 void
 acpi_cpu_sleep(struct cpu_info *ci)
 {
+       uint64_t xcr0 = 0;
        int s;
 
        KASSERT(!CPU_IS_PRIMARY(ci));
@@ -259,12 +260,21 @@
        fpusave_cpu(true);
        x86_disable_intr();
 
+       /*
+        * XXX also need to save the PMCs, the dbregs, and probably a few
+        * MSRs too.
+        */
+       if (rcr4() & CR4_OSXSAVE)
+               xcr0 = rdxcr(0);
+
        if (acpi_md_sleep_prepare(-1))
                goto out;
 
        /* Execute Wakeup */
        cpu_init_msrs(ci, false);
        fpuinit(ci);
+       if (rcr4() & CR4_OSXSAVE)
+               wrxcr(0, xcr0);
 
 #if NLAPIC > 0
        lapic_enable();
@@ -285,6 +295,7 @@
 int
 acpi_md_sleep(int state)
 {
+       uint64_t xcr0 = 0;
        int s, ret = 0;
 #ifdef MULTIPROCESSOR
        struct cpu_info *ci;
@@ -315,12 +326,21 @@
        }
 #endif
 
+       /*
+        * XXX also need to save the PMCs, the dbregs, and probably a few
+        * MSRs too.
+        */
+       if (rcr4() & CR4_OSXSAVE)
+               xcr0 = rdxcr(0);
+
        if (acpi_md_sleep_prepare(state))
                goto out;
 
        /* Execute Wakeup */
        cpu_init_msrs(&cpu_info_primary, false);
        fpuinit(&cpu_info_primary);
+       if (rcr4() & CR4_OSXSAVE)
+               wrxcr(0, xcr0);
        i8259_reinit();
 #if NLAPIC > 0
        lapic_enable();



Home | Main Index | Thread Index | Old Index