Resurrect the "park APs in realmode" idea that we explored back at t2k13
authormlarkin <mlarkin@openbsd.org>
Fri, 10 Jan 2014 22:34:41 +0000 (22:34 +0000)
committermlarkin <mlarkin@openbsd.org>
Fri, 10 Jan 2014 22:34:41 +0000 (22:34 +0000)
(and which didn't work at that time due to a bug which has since been
fixed). The APs are now demoted to real mode and placed in a HLT loop
while the hibernated image is being unpacked.

Helps my x230 significantly, no more spurious reboots on resume.

ok deraadt

sys/arch/amd64/amd64/acpi_wakecode.S
sys/arch/amd64/amd64/hibernate_machdep.c

index e8c54e7..670568e 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi_wakecode.S,v 1.23 2014/01/05 20:23:56 mlarkin Exp $ */
+/* $OpenBSD: acpi_wakecode.S,v 1.24 2014/01/10 22:34:41 mlarkin Exp $ */
 /*
  * Copyright (c) 2001 Takanori Watanabe <takawata@jp.freebsd.org>
  * Copyright (c) 2001 Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
@@ -394,12 +394,12 @@ _ACPI_TRMP_LABEL(hibernate_resume_vector_2)
        /* Get out of 64 bit CS */
        lgdtq   tmp_gdt6416
 
-       rex64   ljmp    *(hibernate_indirect_16)
+       rex64   ljmpq   *(hibernate_indirect_16)
 _ACPI_TRMP_LABEL(hibernate_indirect_16)
        .quad   hibernate_resume_vector_3
        .word   0x18
 
-_ACPI_TRMP_LABEL(hibernate_resume_vector_3)
+_ACPI_TRMP_OFFSET(hibernate_resume_vector_3)
        .code16
 
        movl    %cr0, %eax
@@ -432,12 +432,12 @@ _ACPI_TRMP_LABEL(hibernate_resume_vector_2b)
        /* Get out of 64 bit CS */
        lgdtq   tmp_gdt6416
 
-       rex64   ljmp    *(hibernate_indirect_16b)
+       rex64   ljmpq   *(hibernate_indirect_16b)
 _ACPI_TRMP_LABEL(hibernate_indirect_16b)
        .quad   hibernate_resume_vector_3b
        .word   0x18
 
-_ACPI_TRMP_LABEL(hibernate_resume_vector_3b)
+_ACPI_TRMP_OFFSET(hibernate_resume_vector_3b)
        .code16
 
        movl    %cr0, %eax
@@ -622,7 +622,7 @@ _ACPI_TRMP_LABEL(tmp_gdtable6416)
        .quad   0x0000000000000000
        .quad   0x00af9a000000ffff
        .quad   0x00cf92000000ffff
-       .quad   0x00009a000000ffff
+       .quad   0x00009a0110000fff
 _ACPI_TRMP_LABEL(tmp_gdt6416_end)
 
        .align 4
index 4d42977..8143947 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: hibernate_machdep.c,v 1.18 2014/01/05 23:06:54 mlarkin Exp $  */
+/*     $OpenBSD: hibernate_machdep.c,v 1.19 2014/01/10 22:34:41 mlarkin Exp $  */
 
 /*
  * Copyright (c) 2012 Mike Larkin <mlarkin@openbsd.org>
@@ -398,7 +398,11 @@ hibernate_quiesce_cpus(void)
        /* Start the hatched (but idling) APs */
        cpu_boot_secondary_processors();
 
-       /* Now shut them down */
-       acpi_sleep_mp();        
+       /* Demote the APs to real mode */
+        x86_broadcast_ipi(X86_IPI_HALT_REALMODE);
+
+       /* Wait a bit for the APs to park themselves */
+       delay(1000000);
+
 }
 #endif /* MULTIPROCESSOR */